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); } }