diff --git a/LibCarla/source/carla/client/World.cpp b/LibCarla/source/carla/client/World.cpp index 0eb241e3c..3aa952641 100644 --- a/LibCarla/source/carla/client/World.cpp +++ b/LibCarla/source/carla/client/World.cpp @@ -53,6 +53,10 @@ namespace client { uint64_t World::ApplySettings(const rpc::EpisodeSettings &settings, time_duration timeout) { rpc::EpisodeSettings new_settings = settings; uint64_t id = _episode.Lock()->SetEpisodeSettings(settings); + + time_duration local_timeout = timeout.milliseconds() == 0 ? + _episode.Lock()->GetNetworkingTimeout() : timeout; + if (settings.fixed_delta_seconds.has_value()) { using namespace std::literals::chrono_literals; @@ -68,7 +72,7 @@ namespace client { if (tics_correct >= 2) return id; - Tick(timeout); + Tick(local_timeout); } log_warning("World::ApplySettings: After", number_of_attemps, " attemps, the settings were not correctly set. Please check that everything is consistent."); @@ -129,7 +133,10 @@ namespace client { } WorldSnapshot World::WaitForTick(time_duration timeout) const { - return _episode.Lock()->WaitForTick(timeout); + time_duration local_timeout = timeout.milliseconds() == 0 ? + _episode.Lock()->GetNetworkingTimeout() : timeout; + + return _episode.Lock()->WaitForTick(local_timeout); } size_t World::OnTick(std::function callback) { @@ -141,7 +148,9 @@ namespace client { } uint64_t World::Tick(time_duration timeout) { - return _episode.Lock()->Tick(timeout); + time_duration local_timeout = timeout.milliseconds() == 0 ? + _episode.Lock()->GetNetworkingTimeout() : timeout; + return _episode.Lock()->Tick(local_timeout); } void World::SetPedestriansCrossFactor(float percentage) { diff --git a/PythonAPI/carla/source/libcarla/World.cpp b/PythonAPI/carla/source/libcarla/World.cpp index 9c38ec706..e87c1caa0 100644 --- a/PythonAPI/carla/source/libcarla/World.cpp +++ b/PythonAPI/carla/source/libcarla/World.cpp @@ -271,7 +271,7 @@ void export_world() { .def("get_random_location_from_navigation", CALL_RETURNING_OPTIONAL_WITHOUT_GIL(cc::World, GetRandomLocationFromNavigation)) .def("get_spectator", CONST_CALL_WITHOUT_GIL(cc::World, GetSpectator)) .def("get_settings", CONST_CALL_WITHOUT_GIL(cc::World, GetSettings)) - .def("apply_settings", &ApplySettings, (arg("settings"), arg("seconds")=10.0)) + .def("apply_settings", &ApplySettings, (arg("settings"), arg("seconds")=0.0)) .def("get_weather", CONST_CALL_WITHOUT_GIL(cc::World, GetWeather)) .def("set_weather", &cc::World::SetWeather) .def("get_snapshot", &cc::World::GetSnapshot) @@ -280,10 +280,10 @@ void export_world() { .def("get_actors", &GetActorsById, (arg("actor_ids"))) .def("spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(SpawnActor)) .def("try_spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(TrySpawnActor)) - .def("wait_for_tick", &WaitForTick, (arg("seconds")=10.0)) + .def("wait_for_tick", &WaitForTick, (arg("seconds")=0.0)) .def("on_tick", &OnTick, (arg("callback"))) .def("remove_on_tick", &cc::World::RemoveOnTick, (arg("callback_id"))) - .def("tick", &Tick, (arg("seconds")=10.0)) + .def("tick", &Tick, (arg("seconds")=0.0)) .def("set_pedestrians_cross_factor", CALL_WITHOUT_GIL_1(cc::World, SetPedestriansCrossFactor, float), (arg("percentage"))) .def("get_traffic_sign", CONST_CALL_WITHOUT_GIL_1(cc::World, GetTrafficSign, cc::Landmark), arg("landmark")) .def("get_traffic_light", CONST_CALL_WITHOUT_GIL_1(cc::World, GetTrafficLight, cc::Landmark), arg("landmark"))