From 301eb9032ee2627f7374adec82a903d742d4ae34 Mon Sep 17 00:00:00 2001 From: Daniel Santos-Olivan Date: Tue, 3 Nov 2020 17:08:53 +0100 Subject: [PATCH] Changed default substepping parameters --- LibCarla/source/carla/rpc/EpisodeSettings.h | 8 ++++---- PythonAPI/carla/source/libcarla/World.cpp | 4 ++-- .../Carla/Source/Carla/Game/CarlaEngine.cpp | 18 +----------------- .../Source/Carla/Settings/EpisodeSettings.h | 4 ++-- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/LibCarla/source/carla/rpc/EpisodeSettings.h b/LibCarla/source/carla/rpc/EpisodeSettings.h index 31e64fcd1..7112372e7 100644 --- a/LibCarla/source/carla/rpc/EpisodeSettings.h +++ b/LibCarla/source/carla/rpc/EpisodeSettings.h @@ -33,9 +33,9 @@ namespace rpc { bool substepping = true; - double max_substep_delta_time = 0.016667; + double max_substep_delta_time = 0.01; - int max_substeps = 6; + int max_substeps = 10; MSGPACK_DEFINE_ARRAY(synchronous_mode, no_rendering_mode, fixed_delta_seconds, substepping, max_substep_delta_time, max_substeps); @@ -51,8 +51,8 @@ namespace rpc { bool no_rendering_mode, double fixed_delta_seconds = 0.0, bool substepping = true, - double max_substep_delta_time = 0.016667, - int max_substeps = 6) + double max_substep_delta_time = 0.01, + int max_substeps = 10) : synchronous_mode(synchronous_mode), no_rendering_mode(no_rendering_mode), fixed_delta_seconds( diff --git a/PythonAPI/carla/source/libcarla/World.cpp b/PythonAPI/carla/source/libcarla/World.cpp index d6c5e6053..faa6a84c1 100644 --- a/PythonAPI/carla/source/libcarla/World.cpp +++ b/PythonAPI/carla/source/libcarla/World.cpp @@ -146,8 +146,8 @@ void export_world() { arg("no_rendering_mode")=false, arg("fixed_delta_seconds")=0.0, arg("substepping")=true, - arg("max_substep_delta_time")=0.016667, - arg("max_substeps")=6))) + arg("max_substep_delta_time")=0.01, + arg("max_substeps")=10))) .def_readwrite("synchronous_mode", &cr::EpisodeSettings::synchronous_mode) .def_readwrite("no_rendering_mode", &cr::EpisodeSettings::no_rendering_mode) .def_readwrite("substepping", &cr::EpisodeSettings::substepping) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaEngine.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaEngine.cpp index d5afb4b12..3b4a73720 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaEngine.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/CarlaEngine.cpp @@ -16,7 +16,6 @@ #include "Runtime/Core/Public/Misc/App.h" #include "PhysicsEngine/PhysicsSettings.h" -#include "Engine/World.h" #include @@ -153,26 +152,11 @@ void FCarlaEngine::OnEpisodeSettingsChanged(const FEpisodeSettings &Settings) FCarlaEngine_SetFixedDeltaSeconds(Settings.FixedDeltaSeconds); + // Setting parameters for physics substepping UPhysicsSettings* PhysSett = UPhysicsSettings::Get(); - PhysSett->bSubstepping = Settings.bSubstepping; PhysSett->MaxSubstepDeltaTime = Settings.MaxSubstepDeltaTime; PhysSett->MaxSubsteps = Settings.MaxSubsteps; - - - - UE_LOG(LogCarla, Error, TEXT("-------------------------------------------------------------")); - UE_LOG(LogCarla, Error, TEXT("Syncronous Mode %d"), Settings.bSynchronousMode); - UE_LOG(LogCarla, Error, TEXT("Substepping %d"), Settings.bSubstepping); - UE_LOG(LogCarla, Error, TEXT("FixedDelta Secs %f"), Settings.FixedDeltaSeconds.Get(0.0)); - UE_LOG(LogCarla, Error, TEXT("MaxSubstepDat %f"), Settings.MaxSubstepDeltaTime); - UE_LOG(LogCarla, Error, TEXT("MaxSubsteps %d"), Settings.MaxSubsteps); - //UE_LOG(LogCarla, Error, TEXT("PS: EditChange %d"), PhysSett->CanEditChange(UPhysicsSettings::bSubstepping)); - UE_LOG(LogCarla, Error, TEXT("FA: DeltaTime %f"), CurrentEpisode->GetWorld()->GetDeltaSeconds() ); - UE_LOG(LogCarla, Error, TEXT("PS: Substepping %d"), PhysSett->bSubstepping); - UE_LOG(LogCarla, Error, TEXT("PS: MaxSubsDt %f"), PhysSett->MaxSubstepDeltaTime); - UE_LOG(LogCarla, Error, TEXT("PS: MaxSubsNum %d"), PhysSett->MaxSubsteps); - } void FCarlaEngine::ResetSimulationState() diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/EpisodeSettings.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/EpisodeSettings.h index 6fea085cb..a15f2ecc0 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/EpisodeSettings.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/EpisodeSettings.h @@ -24,7 +24,7 @@ struct CARLA_API FEpisodeSettings TOptional FixedDeltaSeconds; - double MaxSubstepDeltaTime = 0.016667; + double MaxSubstepDeltaTime = 0.01; - int MaxSubsteps = 6; + int MaxSubsteps = 10; };