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"
16 
17 #include <cstdint>
18 
19 namespace carla {
20 namespace sensor {
21 namespace data {
22 
23 namespace detail {
24 
25 #pragma pack(push, 1)
27  public:
28 
29  PackedVehicleControl() = default;
30 
32  : throttle(control.throttle),
33  steer(control.steer),
34  brake(control.brake),
35  hand_brake(control.hand_brake),
36  reverse(control.reverse),
38  gear(control.gear) {}
39 
40  operator rpc::VehicleControl() const {
42  }
43 
44  private:
45 
46  float throttle;
47  float steer;
48  float brake;
49  bool hand_brake;
50  bool reverse;
52  int32_t gear;
53  };
54 
55 #pragma pack(pop)
56 
57 #pragma pack(push, 1)
58  struct VehicleData {
59  VehicleData() = default;
60 
62  float speed_limit;
66  };
67 #pragma pack(pop)
68 
69 #pragma pack(push, 1)
71  public:
72 
73  PackedWalkerControl() = default;
74 
76  : direction{control.direction.x, control.direction.y, control.direction.z},
77  speed(control.speed),
78  jump(control.jump) {}
79 
80  operator rpc::WalkerControl() const {
81  return {geom::Vector3D{direction[0u], direction[1u], direction[2u]}, speed, jump};
82  }
83 
84  private:
85 
86  float direction[3u];
87  float speed;
88  bool jump;
89  };
90 
91 #pragma pack(pop)
92 
93 #pragma pack(push, 1)
94 
96  TrafficLightData() = default;
97 
98  char sign_id[32u];
99  float green_time;
100  float yellow_time;
101  float red_time;
103  uint32_t pole_index;
106  };
107 #pragma pack(pop)
108 
109 #pragma pack(push, 1)
110 
112  TrafficSignData() = default;
113 
114  char sign_id[32u];
115  };
116 #pragma pack(pop)
117 } // namespace detail
118 
119 #pragma pack(push, 1)
120 
121  /// Dynamic state of an actor at a certain frame.
123 
125 
127 
129 
131 
133 
135 
141  } state;
142  };
143 
144 #pragma pack(pop)
145 
146  static_assert(
147  sizeof(ActorDynamicState) == 119u,
148  "Invalid ActorDynamicState size! "
149  "If you modified this class please update the size here, else you may "
150  "comment this assert, but your platform may have compatibility issues "
151  "connecting to other platforms.");
152 
153 } // namespace data
154 } // namespace sensor
155 } // 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