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;
25 };
26 using KinematicStateMap = std::unordered_map<ActorId, KinematicState>;
27 
31 };
32 using TrafficLightStateMap = std::unordered_map<ActorId, TrafficLightState>;
33 
36  float half_length;
37  float half_width;
38  float half_height;
39 };
40 using StaticAttributeMap = std::unordered_map<ActorId, StaticAttributes>;
41 
42 /// This class holds the state of all the vehicles in the simlation.
44 
45 private:
46  // Structure to hold ids of all actors in the simulation.
47  std::unordered_set<ActorId> actor_set;
48  // Structure containing dynamic motion related state of actors.
50  // Structure containing static attributes of actors.
52  // Structure containing dynamic traffic light related state of actors.
54 
55 public :
57 
58  // Method to add an actor to the simulation state.
59  void AddActor(ActorId actor_id,
60  KinematicState kinematic_state,
61  StaticAttributes attributes,
62  TrafficLightState tl_state);
63 
64  // Method to verify if an actor is present currently present in the simulation state.
65  bool ContainsActor(ActorId actor_id) const;
66 
67  // Method to remove an actor from simulation state.
68  void RemoveActor(ActorId actor_id);
69 
70  // Method to flush all states and actors.
71  void Reset();
72 
73  void UpdateKinematicState(ActorId actor_id, KinematicState state);
74 
75  void UpdateKinematicHybridEndLocation(ActorId actor_id, cg::Location location);
76 
77  void UpdateTrafficLightState(ActorId actor_id, TrafficLightState state);
78 
79  cg::Location GetLocation(const ActorId actor_id) const;
80 
81  cg::Location GetHybridEndLocation(const ActorId actor_id) const;
82 
83  cg::Rotation GetRotation(const ActorId actor_id) const;
84 
85  cg::Vector3D GetHeading(const ActorId actor_id) const;
86 
87  cg::Vector3D GetVelocity(const ActorId actor_id) const;
88 
89  float GetSpeedLimit(const ActorId actor_id) const;
90 
91  bool IsPhysicsEnabled(const ActorId actor_id) const;
92 
93  bool IsDormant(const ActorId actor_id) const;
94 
95  cg::Location GetHeroLocation(const ActorId actor_id) const;
96 
97  TrafficLightState GetTLS(const ActorId actor_id) const;
98 
99  ActorType GetType(const ActorId actor_id) const;
100 
101  cg::Vector3D GetDimensions(const ActorId actor_id) const;
102 
103 };
104 
105 } // namespace traffic_manager
106 } // 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