CARLA
ActorDynamicState.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/geom/Transform.h"
10 #include "carla/geom/Vector3D.h"
11 #include "carla/rpc/ActorId.h"
12 #include "carla/rpc/ActorState.h"
17 
18 #include <cstdint>
19 
20 namespace carla {
21 namespace sensor {
22 namespace data {
23 
24 namespace detail {
25 
26 #pragma pack(push, 1)
28  public:
29 
30  PackedVehicleControl() = default;
31 
33  : throttle(control.throttle),
34  steer(control.steer),
35  brake(control.brake),
36  hand_brake(control.hand_brake),
37  reverse(control.reverse),
39  gear(control.gear) {}
40 
41  operator rpc::VehicleControl() const {
43  }
44 
45  private:
46 
47  float throttle;
48  float steer;
49  float brake;
50  bool hand_brake;
51  bool reverse;
53  int32_t gear;
54  };
55 
56 #pragma pack(pop)
57 
58 #pragma pack(push, 1)
59  struct VehicleData {
60  VehicleData() = default;
61 
63  float speed_limit;
68  };
69 #pragma pack(pop)
70 
71 #pragma pack(push, 1)
73  public:
74 
75  PackedWalkerControl() = default;
76 
78  : direction{control.direction.x, control.direction.y, control.direction.z},
79  speed(control.speed),
80  jump(control.jump) {}
81 
82  operator rpc::WalkerControl() const {
83  return {geom::Vector3D{direction[0u], direction[1u], direction[2u]}, speed, jump};
84  }
85 
86  private:
87 
88  float direction[3u];
89  float speed;
90  bool jump;
91  };
92 
93 #pragma pack(pop)
94 
95 #pragma pack(push, 1)
96 
98  TrafficLightData() = default;
99 
100  char sign_id[32u];
101  float green_time;
102  float yellow_time;
103  float red_time;
105  uint32_t pole_index;
108  };
109 #pragma pack(pop)
110 
111 #pragma pack(push, 1)
112 
114  TrafficSignData() = default;
115 
116  char sign_id[32u];
117  };
118 #pragma pack(pop)
119 } // namespace detail
120 
121 #pragma pack(push, 1)
122 
123  /// Dynamic state of an actor at a certain frame.
125 
127 
129 
131 
133 
135 
137 
143  } state;
144  };
145 
146 #pragma pack(pop)
147 
148  static_assert(
149  sizeof(ActorDynamicState) == 119u,
150  "Invalid ActorDynamicState size! "
151  "If you modified this class please update the size here, else you may "
152  "comment this assert, but your platform may have compatibility issues "
153  "connecting to other platforms.");
154 
155 } // namespace data
156 } // namespace sensor
157 } // namespace carla
PackedWalkerControl(const rpc::WalkerControl &control)
Dynamic state of an actor at a certain frame.
rpc::ActorId ActorId
Definition: ActorId.h:18
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
PackedVehicleControl(const rpc::VehicleControl &control)
uint32_t ActorId
Definition: ActorId.h:14