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);
void SetGreenTime(float green_time)
SharedPtr< ActorList > GetActors() const
Return a list with all the actors currently present in the world.
std::vector< SharedPtr< TrafficLight > > GetGroupTrafficLights()
Return all traffic lights in the group this one belongs to.
Location location
Center of the BoundingBox in local space.
Vector3D extent
Half the size of the BoundingBox in local space.
std::vector< SharedPtr< Waypoint > > GetAffectedLaneWaypoints() const
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
EpisodeProxy & GetEpisode()
const geom::BoundingBox & GetTriggerVolume() const
std::vector< SharedPtr< Waypoint > > GetStopWaypoints() const
float GetElapsedTime() const
float GetGreenTime() const
void SetRedTime(float red_time)
void SetState(rpc::TrafficLightState state)
geom::Transform GetTransform() const
Return the current transform of the actor.
rpc::TrafficLightState GetState() const
Return the current state of the traffic light.
void SetYellowTime(float yellow_time)
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
float GetYellowTime() const
std::vector< geom::BoundingBox > GetLightBoxes() const
uint32_t GetPoleIndex()
Returns the index of the pole in the traffic light group.
road::SignId GetOpenDRIVEID() const