From a96c5bbdf513dc035baf2d00caa9dc05ece91544 Mon Sep 17 00:00:00 2001 From: Joel Moriana Date: Tue, 8 Feb 2022 11:57:51 +0100 Subject: [PATCH] fixed bug not getting max steering when applying commands --- ...ekrmannController.cpp => AckermannController.cpp} | 12 ++++++------ .../Source/Carla/Vehicle/CarlaWheeledVehicle.cpp | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) rename Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/{AcekrmannController.cpp => AckermannController.cpp} (94%) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/AcekrmannController.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/AckermannController.cpp similarity index 94% rename from Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/AcekrmannController.cpp rename to Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/AckermannController.cpp index 689132ea3..d629f4638 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/AcekrmannController.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/AckermannController.cpp @@ -124,14 +124,14 @@ void FAckermannController::RunControlReverse() { // Change of driving direction to forward. bReverse = false; } + } else { + if (FMath::Sign(VehicleSpeed) * FMath::Sign(UserTargetPoint.Speed) == -1) { + // Requested for change of driving direction. + // First we have to come to full stop before changing driving direction + TargetSpeed = 0.0; + } } - if (FMath::Sign(VehicleSpeed) * FMath::Sign(UserTargetPoint.Speed) == -1) { - // Requested for change of driving direction. - // First we have to come to full stop before changing driving direction - UE_LOG(LogCarla, Log, TEXT("Requested change of driving direction. First going to full stop")); - TargetSpeed = 0.0; - } } void FAckermannController::RunControlSpeed() { diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CarlaWheeledVehicle.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CarlaWheeledVehicle.cpp index be6c2afa3..fbd81868a 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CarlaWheeledVehicle.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CarlaWheeledVehicle.cpp @@ -193,6 +193,9 @@ void ACarlaWheeledVehicle::BeginPlay() MovementComponent->WheelSetups = NewWheelSetups; LastPhysicsControl = GetVehiclePhysicsControl(); + + // Update physics in the Ackermann Controller + AckermannController.UpdateVehiclePhysics(this); } }