CARLA
SimulationState.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <unordered_set>
5 
7 
8 namespace carla {
9 namespace traffic_manager {
10 
11 enum ActorType {
15 };
16 
21  float speed_limit;
23  bool is_dormant;
24 };
25 using KinematicStateMap = std::unordered_map<ActorId, KinematicState>;
26 
30 };
31 using TrafficLightStateMap = std::unordered_map<ActorId, TrafficLightState>;
32 
35  float half_length;
36  float half_width;
37  float half_height;
38 };
39 using StaticAttributeMap = std::unordered_map<ActorId, StaticAttributes>;
40 
41 /// This class holds the state of all the vehicles in the simlation.
43 
44 private:
45  // Structure to hold ids of all actors in the simulation.
46  std::unordered_set<ActorId> actor_set;
47  // Structure containing dynamic motion related state of actors.
49  // Structure containing static attributes of actors.
51  // Structure containing dynamic traffic light related state of actors.
53 
54 public :
56 
57  // Method to add an actor to the simulation state.
58  void AddActor(ActorId actor_id,
59  KinematicState kinematic_state,
60  StaticAttributes attributes,
61  TrafficLightState tl_state);
62 
63  // Method to verify if an actor is present currently present in the simulation state.
64  bool ContainsActor(ActorId actor_id) const;
65 
66  // Method to remove an actor from simulation state.
67  void RemoveActor(ActorId actor_id);
68 
69  // Method to flush all states and actors.
70  void Reset();
71 
72  void UpdateKinematicState(ActorId actor_id, KinematicState state);
73 
74  void UpdateTrafficLightState(ActorId actor_id, TrafficLightState state);
75 
76  cg::Location GetLocation(const ActorId actor_id) const;
77 
78  cg::Rotation GetRotation(const ActorId actor_id) const;
79 
80  cg::Vector3D GetHeading(const ActorId actor_id) const;
81 
82  cg::Vector3D GetVelocity(const ActorId actor_id) const;
83 
84  float GetSpeedLimit(const ActorId actor_id) const;
85 
86  bool IsPhysicsEnabled(const ActorId actor_id) const;
87 
88  bool IsDormant(const ActorId actor_id) const;
89 
90  cg::Location GetHeroLocation(const ActorId actor_id) const;
91 
92  TrafficLightState GetTLS(const ActorId actor_id) const;
93 
94  ActorType GetType(const ActorId actor_id) const;
95 
96  cg::Vector3D GetDimensions(const ActorId actor_id) const;
97 
98 };
99 
100 } // namespace traffic_manager
101 } // namespace carla
std::unordered_map< ActorId, TrafficLightState > TrafficLightStateMap
std::unordered_map< ActorId, StaticAttributes > StaticAttributeMap
This class holds the state of all the vehicles in the simlation.
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
std::unordered_map< ActorId, KinematicState > KinematicStateMap
std::unordered_set< ActorId > actor_set
carla::ActorId ActorId
static LaneMarking::Type GetType(std::string str)
Definition: LaneMarking.cpp:17