parent
39e0fcbf1d
commit
a55e877bf1
|
@ -354,7 +354,7 @@ float Parameters::GetPercentageIgnoreWalkers(const ActorId &actor_id) const {
|
|||
return percentage;
|
||||
}
|
||||
|
||||
bool Parameters::GetUpdateVehicleLightState(const ActorId &actor_id) const {
|
||||
bool Parameters::GetUpdateVehicleLights(const ActorId &actor_id) const {
|
||||
bool do_update = false;
|
||||
|
||||
if (auto_update_vehicle_lights.Contains(actor_id)) {
|
||||
|
|
|
@ -236,7 +236,7 @@ public:
|
|||
float GetPercentageIgnoreWalkers(const ActorId &actor_id) const;
|
||||
|
||||
/// Method to get if the vehicle lights should be updates automatically
|
||||
bool GetUpdateVehicleLightState(const ActorId &actor_id) const;
|
||||
bool GetUpdateVehicleLights(const ActorId &actor_id) const;
|
||||
|
||||
/// Method to get synchronous mode.
|
||||
bool GetSynchronousMode() const;
|
||||
|
|
|
@ -232,6 +232,7 @@ void TrafficManagerLocal::Run() {
|
|||
collision_stage.Update(index);
|
||||
}
|
||||
collision_stage.ClearCycleCache();
|
||||
vehicle_light_stage.UpdateWorldInfo();
|
||||
for (unsigned long index = 0u; index < vehicle_id_list.size(); ++index) {
|
||||
traffic_light_stage.Update(index);
|
||||
motion_plan_stage.Update(index);
|
||||
|
|
|
@ -94,6 +94,11 @@ public:
|
|||
tm->SetPercentageSpeedDifference(carla::client::detail::ActorVariant(actor).Get(tm->GetEpisodeProxy()), percentage);
|
||||
});
|
||||
|
||||
/// Method to set the automatic management of the vehicle lights
|
||||
server->bind("update_vehicle_lights", [=](carla::rpc::Actor actor, const bool do_update) {
|
||||
tm->SetUpdateVehicleLights(carla::client::detail::ActorVariant(actor).Get(tm->GetEpisodeProxy()), do_update);
|
||||
});
|
||||
|
||||
/// Method to set a global % decrease in velocity with respect to the speed limit.
|
||||
/// If less than 0, it's a % increase.
|
||||
server->bind("set_global_percentage_speed_difference", [=](const float percentage) {
|
||||
|
|
|
@ -21,7 +21,7 @@ VehicleLightStage::VehicleLightStage(
|
|||
world(world),
|
||||
control_frame(control_frame) {}
|
||||
|
||||
void VehicleLightStage::ClearCycleCache() {
|
||||
void VehicleLightStage::UpdateWorldInfo() {
|
||||
// Get the global weather and all the vehicle light states at once
|
||||
all_light_states = world.GetVehiclesLightStates();
|
||||
weather = world.GetWeather();
|
||||
|
@ -30,7 +30,7 @@ void VehicleLightStage::ClearCycleCache() {
|
|||
void VehicleLightStage::Update(const unsigned long index) {
|
||||
ActorId actor_id = vehicle_id_list.at(index);
|
||||
|
||||
if (!parameters.GetUpdateVehicleLightState(actor_id))
|
||||
if (!parameters.GetUpdateVehicleLights(actor_id))
|
||||
return; // this vehicle is not set to have automatic lights update
|
||||
|
||||
rpc::VehicleLightState::flag_type light_states = uint32_t(-1);
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
const cc::World &world,
|
||||
ControlFrame& control_frame);
|
||||
|
||||
void ClearCycleCache();
|
||||
void UpdateWorldInfo();
|
||||
|
||||
void Update(const unsigned long index) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue