CARLA
Loading...
Searching...
No Matches
SimulationState.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <unordered_set>
5
7
8namespace carla {
9namespace traffic_manager {
10
16
26using KinematicStateMap = std::unordered_map<ActorId, KinematicState>;
27
32using TrafficLightStateMap = std::unordered_map<ActorId, TrafficLightState>;
33
39 // Physical front-wheel steering lock in degrees (vehicles only). Queried
40 // once at registration from the vehicle physics control; the default is the
41 // car-class value the controller gains are anchored on.
42 float max_steer_angle = 70.0f;
43};
44using StaticAttributeMap = std::unordered_map<ActorId, StaticAttributes>;
45
46/// This class holds the state of all the vehicles in the simlation.
48
49private:
50 // Structure to hold ids of all actors in the simulation.
51 std::unordered_set<ActorId> actor_set;
52 // Structure containing dynamic motion related state of actors.
54 // Structure containing static attributes of actors.
56 // Structure containing dynamic traffic light related state of actors.
58
59public :
61
62 // Method to add an actor to the simulation state.
63 void AddActor(ActorId actor_id,
64 KinematicState kinematic_state,
65 StaticAttributes attributes,
66 TrafficLightState tl_state);
67
68 // Method to verify if an actor is present currently present in the simulation state.
69 bool ContainsActor(ActorId actor_id) const;
70
71 // Method to remove an actor from simulation state.
72 void RemoveActor(ActorId actor_id);
73
74 // Method to flush all states and actors.
75 void Reset();
76
77 void UpdateKinematicState(ActorId actor_id, KinematicState state);
78
80
82
83 cg::Location GetLocation(const ActorId actor_id) const;
84
85 cg::Location GetHybridEndLocation(const ActorId actor_id) const;
86
87 cg::Rotation GetRotation(const ActorId actor_id) const;
88
89 cg::Vector3D GetHeading(const ActorId actor_id) const;
90
91 cg::Vector3D GetVelocity(const ActorId actor_id) const;
92
93 float GetSpeedLimit(const ActorId actor_id) const;
94
95 bool IsPhysicsEnabled(const ActorId actor_id) const;
96
97 bool IsDormant(const ActorId actor_id) const;
98
99 cg::Location GetHeroLocation(const ActorId actor_id) const;
100
101 TrafficLightState GetTLS(const ActorId actor_id) const;
102
103 ActorType GetType(const ActorId actor_id) const;
104
105 cg::Vector3D GetDimensions(const ActorId actor_id) const;
106
107 float GetMaxSteerAngle(const ActorId actor_id) const;
108
109};
110
111} // namespace traffic_manager
112} // namespace carla
Euler angles of a rotation in CARLA's / Unreal's left-handed frame: x forward, y right,...
Definition Rotation.h:45
This class holds the state of all the vehicles in the simlation.
cg::Location GetHeroLocation(const ActorId actor_id) const
bool ContainsActor(ActorId actor_id) const
cg::Location GetLocation(const ActorId actor_id) const
void UpdateKinematicHybridEndLocation(ActorId actor_id, cg::Location location)
cg::Vector3D GetHeading(const ActorId actor_id) const
cg::Location GetHybridEndLocation(const ActorId actor_id) const
void UpdateKinematicState(ActorId actor_id, KinematicState state)
void AddActor(ActorId actor_id, KinematicState kinematic_state, StaticAttributes attributes, TrafficLightState tl_state)
void UpdateTrafficLightState(ActorId actor_id, TrafficLightState state)
float GetSpeedLimit(const ActorId actor_id) const
cg::Rotation GetRotation(const ActorId actor_id) const
cg::Vector3D GetVelocity(const ActorId actor_id) const
bool IsPhysicsEnabled(const ActorId actor_id) const
std::unordered_set< ActorId > actor_set
ActorType GetType(const ActorId actor_id) const
cg::Vector3D GetDimensions(const ActorId actor_id) const
TrafficLightState GetTLS(const ActorId actor_id) const
float GetMaxSteerAngle(const ActorId actor_id) const
bool IsDormant(const ActorId actor_id) const
std::unordered_map< ActorId, TrafficLightState > TrafficLightStateMap
std::unordered_map< ActorId, StaticAttributes > StaticAttributeMap
std::unordered_map< ActorId, KinematicState > KinematicStateMap
This file contains definitions of common data structures used in traffic manager.