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
15 #endif // LIBCARLA_INCLUDED_FROM_UE4
16 
17 namespace carla {
18 namespace rpc {
19 
20  class WalkerControl {
21  public:
22 
23  WalkerControl() = default;
24 
26  geom::Vector3D in_direction,
27  float in_speed,
28  bool in_jump)
29  : direction(in_direction),
30  speed(in_speed),
31  jump(in_jump) {}
32 
33  geom::Vector3D direction = {1.0f, 0.0f, 0.0f};
34 
35  float speed = 0.0f;
36 
37  bool jump = false;
38 
39 #ifdef LIBCARLA_INCLUDED_FROM_UE4
40 
41  WalkerControl(const FWalkerControl &Control)
42  : direction(Control.Direction.X, Control.Direction.Y, Control.Direction.Z),
43  speed(1e-2f * Control.Speed),
44  jump(Control.Jump) {}
45 
46  operator FWalkerControl() const {
47  FWalkerControl Control;
48  Control.Direction = {direction.x, direction.y, direction.z};
49  Control.Speed = 1e2f * speed;
50  Control.Jump = jump;
51  return Control;
52  }
53 
54 #endif // LIBCARLA_INCLUDED_FROM_UE4
55 
56  bool operator!=(const WalkerControl &rhs) const {
57  return direction != rhs.direction || speed != rhs.speed || jump != rhs.jump;
58  }
59 
60  bool operator==(const WalkerControl &rhs) const {
61  return !(*this != rhs);
62  }
63 
64  MSGPACK_DEFINE_ARRAY(direction, speed, jump);
65  };
66 
67 } // namespace rpc
68 } // 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:133
bool operator==(const WalkerControl &rhs) const
bool operator!=(const WalkerControl &rhs) const