CARLA
SimulationState.cpp
Go to the documentation of this file.
1 
3 
4 namespace carla {
5 namespace traffic_manager {
6 
8 
10  KinematicState kinematic_state,
11  StaticAttributes attributes,
12  TrafficLightState tl_state) {
13  actor_set.insert(actor_id);
14  kinematic_state_map.insert({actor_id, kinematic_state});
15  static_attribute_map.insert({actor_id, attributes});
16  tl_state_map.insert({actor_id, tl_state});
17 }
18 
20  return actor_set.find(actor_id) != actor_set.end();
21 }
22 
24  actor_set.erase(actor_id);
25  kinematic_state_map.erase(actor_id);
26  static_attribute_map.erase(actor_id);
27  tl_state_map.erase(actor_id);
28 }
29 
31  actor_set.clear();
32  kinematic_state_map.clear();
33  static_attribute_map.clear();
34  tl_state_map.clear();
35 }
36 
38  kinematic_state_map.at(actor_id) = state;
39 }
40 
42  tl_state_map.at(actor_id) = state;
43 }
44 
46  return kinematic_state_map.at(actor_id).location;
47 }
48 
50  return kinematic_state_map.at(actor_id).rotation;
51 }
52 
54  return kinematic_state_map.at(actor_id).rotation.GetForwardVector();
55 }
56 
58  return kinematic_state_map.at(actor_id).velocity;
59 }
60 
61 float SimulationState::GetSpeedLimit(ActorId actor_id) const {
62  return kinematic_state_map.at(actor_id).speed_limit;
63 }
64 
66  return kinematic_state_map.at(actor_id).physics_enabled;
67 }
68 
70  return tl_state_map.at(actor_id);
71 }
72 
74  return static_attribute_map.at(actor_id).actor_type;
75 }
76 
78  const StaticAttributes &attributes = static_attribute_map.at(actor_id);
79  return cg::Vector3D(attributes.half_length, attributes.half_width, attributes.half_height);
80 }
81 
82 } // namespace traffic_manager
83 } // namespace carla
void UpdateTrafficLightState(ActorId actor_id, TrafficLightState state)
TrafficLightState GetTLS(const ActorId actor_id) const
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
cg::Vector3D GetDimensions(const ActorId actor_id) const
ActorType GetType(const ActorId actor_id) const
void UpdateKinematicState(ActorId actor_id, KinematicState state)
std::unordered_set< ActorId > actor_set
cg::Location GetLocation(const ActorId actor_id) const
geom::Vector3D Vector3D
Definition: rpc/Vector3D.h:14
cg::Rotation GetRotation(const ActorId actor_id) const
float GetSpeedLimit(const ActorId actor_id) const
carla::ActorId ActorId
bool ContainsActor(ActorId actor_id) const
cg::Vector3D GetHeading(const ActorId actor_id) const
bool IsPhysicsEnabled(const ActorId actor_id) const
void AddActor(ActorId actor_id, KinematicState kinematic_state, StaticAttributes attributes, TrafficLightState tl_state)
cg::Vector3D GetVelocity(const ActorId actor_id) const