8 namespace traffic_manager {
10 using namespace constants::VehicleLight;
13 const std::vector<ActorId> &vehicle_id_list,
18 : vehicle_id_list(vehicle_id_list),
19 buffer_map(buffer_map),
20 parameters(parameters),
22 control_frame(control_frame) {}
37 bool brake_lights =
false;
38 bool left_turn_indicator =
false;
39 bool right_turn_indicator =
false;
40 bool position =
false;
41 bool low_beam =
false;
42 bool high_beam =
false;
43 bool fog_lights =
false;
47 if (vls.first == actor_id) {
48 light_states = vls.second;
56 cg::Location front_location = waypoint_buffer.front()->GetLocation();
59 if (waypoint->CheckJunction()) {
60 RoadOption target_ro = waypoint->GetRoadOption();
72 if (
auto* maybe_ctrl = boost::variant2::get_if<carla::rpc::Command::ApplyVehicleControl>(&
control_frame[
cc].command)) {
74 if (ctrl.
actor == actor_id) {
114 if (left_turn_indicator)
119 if (right_turn_indicator)
145 if (new_light_states != light_states)
static const float SUN_ALTITUDE_DEGREES_JUST_AFTER_DAWN
bool GetUpdateVehicleLights(const ActorId &actor_id) const
Method to get if the vehicle lights should be updates automatically.
std::vector< carla::rpc::Command > ControlFrame
const BufferMap & buffer_map
rpc::VehicleLightStateList all_light_states
All vehicle light states.
static const float FOG_DENSITY_THRESHOLD
This file contains definitions of common data structures used in traffic manager. ...
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
static auto DistanceSquared(const Vector3D &a, const Vector3D &b)
std::unordered_map< carla::ActorId, Buffer > BufferMap
rpc::VehicleLightStateList GetVehiclesLightStates() const
Returns a list of pairs where the firts element is the vehicle ID and the second one is the light sta...
const std::vector< ActorId > & vehicle_id_list
VehicleLightStage(const std::vector< ActorId > &vehicle_id_list, const BufferMap &buffer_map, const Parameters ¶meters, const cc::World &world, ControlFrame &control_frame)
void Update(const unsigned long index) override
const Parameters & parameters
ControlFrame & control_frame
static const float MAX_DISTANCE_LIGHT_CHECK
rpc::WeatherParameters GetWeather() const
Retrieve the weather parameters currently active in the world.
rpc::WeatherParameters weather
Current weather parameters.
void RemoveActor(const ActorId actor_id) override
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
static const float SUN_ALTITUDE_DEGREES_JUST_BEFORE_SUNSET
static const float SUN_ALTITUDE_DEGREES_AFTER_SUNSET
static const float SUN_ALTITUDE_DEGREES_BEFORE_DAWN
static const float HEAVY_PRECIPITATION_THRESHOLD