11#include <unordered_map>
12#include <unordered_set>
22 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.state;
30 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.green_time;
34 GetEpisode().
Lock()->SetTrafficLightYellowTime(*
this, yellow_time);
38 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.yellow_time;
46 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.red_time;
50 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.elapsed_time;
59 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.time_is_frozen;
64 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.pole_index;
68 std::vector<SharedPtr<TrafficLight>> result;
72 result.push_back(boost::static_pointer_cast<TrafficLight>(actor));
82 std::vector<SharedPtr<Waypoint>> result;
84 std::vector<SharedPtr<Landmark>> landmarks = carla_map->GetLandmarksFromId(
GetOpenDRIVEID());
85 for (
auto& landmark : landmarks) {
87 if (validity._from_lane < validity._to_lane) {
88 for (
int lane_id = validity._from_lane; lane_id <= validity._to_lane; ++lane_id) {
89 if(lane_id == 0)
continue;
91 carla_map->GetWaypointXODR(
92 landmark->GetRoadId(), lane_id,
static_cast<float>(landmark->GetS())));
95 for (
int lane_id = validity._from_lane; lane_id >= validity._to_lane; --lane_id) {
96 if(lane_id == 0)
continue;
98 carla_map->GetWaypointXODR(
99 landmark->GetRoadId(), lane_id,
static_cast<float>(landmark->GetS())));
112 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.traffic_light_data.sign_id;
116 std::vector<SharedPtr<Waypoint>> result;
123 float min_x = -0.9f*box.
extent.
x;
124 float max_x = 0.9f*box.
extent.
x;
125 float current_x = min_x;
126 std::unordered_map<road::RoadId, std::unordered_set<road::LaneId>> road_lanes_map;
127 while (current_x < max_x) {
130 if (road_lanes_map[waypoint->GetRoadId()].count(waypoint->GetLaneId()) == 0) {
131 road_lanes_map[waypoint->GetRoadId()].insert(waypoint->GetLaneId());
132 result.emplace_back(waypoint);
geom::Transform GetTransform() const
Return the current transform of the actor.
void SetGreenTime(float green_time)
void SetYellowTime(float yellow_time)
float GetElapsedTime() const
rpc::TrafficLightState GetState() const
Return the current state of the traffic light.
road::SignId GetOpenDRIVEID() const
std::vector< SharedPtr< TrafficLight > > GetGroupTrafficLights()
Return all traffic lights in the group this one belongs to.
void SetState(rpc::TrafficLightState state)
uint32_t GetPoleIndex()
Returns the index of the pole in the traffic light group
std::vector< geom::BoundingBox > GetLightBoxes() const
std::vector< SharedPtr< Waypoint > > GetStopWaypoints() const
std::vector< SharedPtr< Waypoint > > GetAffectedLaneWaypoints() const
float GetGreenTime() const
void SetRedTime(float red_time)
float GetYellowTime() const
const geom::BoundingBox & GetTriggerVolume() const
SharedPtr< ActorList > GetActors() const
Return a list with all the actors currently present in the world.
EpisodeProxy & GetEpisode()
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
Location location
Center of the BoundingBox in local space
Vector3D extent
Half the size of the BoundingBox in local space
This file contains definitions of common data structures used in traffic manager.
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...