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
25using KinematicStateMap = std::unordered_map<ActorId, KinematicState>;
26
31using TrafficLightStateMap = std::unordered_map<ActorId, TrafficLightState>;
32
38 // Physical front-wheel steering lock in degrees (vehicles only). Queried
39 // once at registration from the vehicle physics control; the default is the
40 // car-class value the controller gains are anchored on.
41 float max_steer_angle = 70.0f;
42};
43using StaticAttributeMap = std::unordered_map<ActorId, StaticAttributes>;
44
45/// This class holds the state of all the vehicles in the simlation.
47
48private:
49 // Structure to hold ids of all actors in the simulation.
50 std::unordered_set<ActorId> actor_set;
51 // Structure containing dynamic motion related state of actors.
53 // Structure containing static attributes of actors.
55 // Structure containing dynamic traffic light related state of actors.
57
58public :
60
61 // Method to add an actor to the simulation state.
62 void AddActor(ActorId actor_id,
63 KinematicState kinematic_state,
64 StaticAttributes attributes,
65 TrafficLightState tl_state);
66
67 // Method to verify if an actor is present currently present in the simulation state.
68 bool ContainsActor(ActorId actor_id) const;
69
70 // Method to remove an actor from simulation state.
71 void RemoveActor(ActorId actor_id);
72
73 // Method to flush all states and actors.
74 void Reset();
75
76 void UpdateKinematicState(ActorId actor_id, KinematicState state);
77
79
81
82 cg::Location GetLocation(const ActorId actor_id) const;
83
84 cg::Location GetHybridEndLocation(const ActorId actor_id) const;
85
86 cg::Rotation GetRotation(const ActorId actor_id) const;
87
88 cg::Vector3D GetHeading(const ActorId actor_id) const;
89
90 cg::Vector3D GetVelocity(const ActorId actor_id) const;
91
92 float GetSpeedLimit(const ActorId actor_id) const;
93
94 bool IsPhysicsEnabled(const ActorId actor_id) const;
95
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 float GetMaxSteerAngle(const ActorId actor_id) const;
104
105};
106
107} // namespace traffic_manager
108} // namespace carla
Euler angles of a rotation in CARLA's / Unreal's left-handed frame: x forward, y right,...
Definition Rotation.h:45
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
carla::rpc::TrafficLightState TLS
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.