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