Remove TM's Traffic Light reset, and use the new one from World instead

This commit is contained in:
Jacopo Bartiromo 2020-10-22 16:54:05 +02:00 committed by Jacopo Bartiromo
parent d3f61335dd
commit 52d706014b
9 changed files with 1 additions and 57 deletions

View File

@ -181,14 +181,6 @@ public:
}
}
/// Method to reset all traffic lights.
void ResetAllTrafficLights() {
TrafficManagerBase* tm_ptr = GetTM(_port);
if(tm_ptr != nullptr){
tm_ptr->ResetAllTrafficLights();
}
}
/// Method to switch traffic manager into synchronous execution.
void SetSynchronousMode(bool mode) {
TrafficManagerBase* tm_ptr = GetTM(_port);

View File

@ -86,9 +86,6 @@ public:
/// Method to provide synchronous tick
virtual bool SynchronousTick() = 0;
/// Method to reset all traffic lights.
virtual void ResetAllTrafficLights() = 0;
/// Get carla episode information
virtual carla::client::detail::EpisodeProxy& GetEpisodeProxy() = 0;

View File

@ -156,12 +156,6 @@ public:
return _client->call("synchronous_tick").as<bool>();
}
/// Method to reset all traffic light groups to the initial stage.
void ResetAllTrafficLights() {
DEBUG_ASSERT(_client != nullptr);
_client->call("reset_all_traffic_lights");
}
/// Check if remote traffic manager is alive
void HealthCheckRemoteTM() {
DEBUG_ASSERT(_client != nullptr);

View File

@ -361,26 +361,6 @@ bool TrafficManagerLocal::CheckAllFrozen(TLGroup tl_to_freeze) {
return true;
}
void TrafficManagerLocal::ResetAllTrafficLights() {
// Filter based on wildcard pattern.
const auto world_traffic_lights = world.GetActors()->Filter("*traffic_light*");
std::vector<TLGroup> list_of_all_groups;
std::vector<carla::ActorId> list_of_ids;
for (auto iter = world_traffic_lights->begin(); iter != world_traffic_lights->end(); iter++) {
auto tl = *iter;
if (!(std::find(list_of_ids.begin(), list_of_ids.end(), tl->GetId()) != list_of_ids.end())) {
const TLGroup tl_group = boost::static_pointer_cast<cc::TrafficLight>(tl)->GetGroupTrafficLights();
list_of_all_groups.push_back(tl_group);
}
}
for (TLGroup &tl_group : list_of_all_groups) {
tl_group.front()->ResetGroup();
}
}
void TrafficManagerLocal::SetSynchronousMode(bool mode) {
const bool previous_mode = parameters.GetSynchronousMode();
parameters.SetSynchronousMode(mode);
@ -404,7 +384,7 @@ std::vector<ActorId> TrafficManagerLocal::GetRegisteredVehiclesIDs() {
void TrafficManagerLocal::SetRandomDeviceSeed(const uint64_t _seed) {
seed = _seed;
ResetAllTrafficLights();
world.ResetAllTrafficLights();
}
} // namespace traffic_manager

View File

@ -199,12 +199,6 @@ public:
/// Method to provide synchronous tick.
bool SynchronousTick();
/// Method to reset all traffic light groups to the initial stage.
void ResetAllTrafficLights();
/// Method to start all traffic light groups to the initial stage.
void StartAllTrafficLights();
/// Get CARLA episode information.
carla::client::detail::EpisodeProxy &GetEpisodeProxy();

View File

@ -185,10 +185,6 @@ void TrafficManagerRemote::SetOSMMode(const bool mode_switch) {
client.SetOSMMode(mode_switch);
}
void TrafficManagerRemote::ResetAllTrafficLights() {
client.ResetAllTrafficLights();
}
void TrafficManagerRemote::SetSynchronousMode(bool mode) {
client.SetSynchronousMode(mode);
}

View File

@ -108,9 +108,6 @@ public:
/// Method to provide synchronous tick
bool SynchronousTick();
/// Method to reset all traffic lights.
void ResetAllTrafficLights();
/// Get CARLA episode information.
carla::client::detail::EpisodeProxy& GetEpisodeProxy();

View File

@ -188,11 +188,6 @@ public:
return tm->SynchronousTick();
});
/// Method to reset all traffic lights.
server->bind("reset_all_traffic_lights", [=]() {
tm->ResetAllTrafficLights();
});
/// Method to check server is alive or not.
server->bind("health_check_remote_TM", [=](){});

View File

@ -25,7 +25,6 @@ void export_trafficmanager() {
.def("force_lane_change", &ctm::TrafficManager::SetForceLaneChange)
.def("auto_lane_change", &ctm::TrafficManager::SetAutoLaneChange)
.def("distance_to_leading_vehicle", &ctm::TrafficManager::SetDistanceToLeadingVehicle)
.def("reset_traffic_lights", &ctm::TrafficManager::ResetAllTrafficLights)
.def("ignore_walkers_percentage", &ctm::TrafficManager::SetPercentageIgnoreWalkers)
.def("ignore_vehicles_percentage", &ctm::TrafficManager::SetPercentageIgnoreVehicles)
.def("ignore_lights_percentage", &ctm::TrafficManager::SetPercentageRunningLight)