CARLA
LibCarla/source/carla/rpc/WalkerControl.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "carla/MsgPack.h"
10 
11 #ifdef LIBCARLA_INCLUDED_FROM_UE4
13 #endif // LIBCARLA_INCLUDED_FROM_UE4
14 
15 namespace carla {
16 namespace rpc {
17 
18  class WalkerControl {
19  public:
20 
21  WalkerControl() = default;
22 
24  geom::Vector3D in_direction,
25  float in_speed,
26  bool in_jump)
27  : direction(in_direction),
28  speed(in_speed),
29  jump(in_jump) {}
30 
31  geom::Vector3D direction = {1.0f, 0.0f, 0.0f};
32 
33  float speed = 0.0f;
34 
35  bool jump = false;
36 
37 #ifdef LIBCARLA_INCLUDED_FROM_UE4
38 
39  WalkerControl(const FWalkerControl &Control)
40  : direction(Control.Direction.X, Control.Direction.Y, Control.Direction.Z),
41  speed(1e-2f * Control.Speed),
42  jump(Control.Jump) {}
43 
44  operator FWalkerControl() const {
45  FWalkerControl Control;
46  Control.Direction = {direction.x, direction.y, direction.z};
47  Control.Speed = 1e2f * speed;
48  Control.Jump = jump;
49  return Control;
50  }
51 
52 #endif // LIBCARLA_INCLUDED_FROM_UE4
53 
54  bool operator!=(const WalkerControl &rhs) const {
55  return direction != rhs.direction || speed != rhs.speed || jump != rhs.jump;
56  }
57 
58  bool operator==(const WalkerControl &rhs) const {
59  return !(*this != rhs);
60  }
61 
62  MSGPACK_DEFINE_ARRAY(direction, speed, jump);
63  };
64 
65 } // namespace rpc
66 } // namespace carla
WalkerControl(geom::Vector3D in_direction, float in_speed, bool in_jump)
MSGPACK_DEFINE_ARRAY(direction, speed, jump)
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
bool operator==(const WalkerControl &rhs) const
bool operator!=(const WalkerControl &rhs) const