From 837198c016236953226d2814d778b9985e1de5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alptu=C4=9F=20C=C4=B1r=C4=B1t?= Date: Fri, 13 Sep 2024 11:58:44 +0300 Subject: [PATCH] fix: keyboard control logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alptuğ Cırıt --- .../Resources/URP Presets/LightingSettings.lighting | 2 +- .../Vehicles/VPP Integration/AutowareVPPAdapter.cs | 12 +++--------- .../IVehicleControlModes/ControlMode.cs | 8 ++++---- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Assets/AWSIM/Resources/URP Presets/LightingSettings.lighting b/Assets/AWSIM/Resources/URP Presets/LightingSettings.lighting index bbfd447e9..eba130bee 100644 --- a/Assets/AWSIM/Resources/URP Presets/LightingSettings.lighting +++ b/Assets/AWSIM/Resources/URP Presets/LightingSettings.lighting @@ -8,7 +8,7 @@ LightingSettings: m_PrefabAsset: {fileID: 0} m_Name: LightingSettings serializedVersion: 6 - m_GIWorkflowMode: 0 + m_GIWorkflowMode: 1 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 m_RealtimeEnvironmentLighting: 0 diff --git a/Assets/AWSIM/Scripts/Vehicles/VPP Integration/AutowareVPPAdapter.cs b/Assets/AWSIM/Scripts/Vehicles/VPP Integration/AutowareVPPAdapter.cs index 9bb2b7024..ad93823af 100644 --- a/Assets/AWSIM/Scripts/Vehicles/VPP Integration/AutowareVPPAdapter.cs +++ b/Assets/AWSIM/Scripts/Vehicles/VPP Integration/AutowareVPPAdapter.cs @@ -23,6 +23,7 @@ public class AutowareVPPAdapter : MonoBehaviour /// Control inputs from Autoware [NonSerialized] public float SteerAngleInput; + private float _steerAngleInput => SteerAngleInput; public bool IsDefinedSteeringTireRotationRateInput { get; set; } @@ -253,15 +254,8 @@ public void HandleAcceleration() // Store current values CurrentSpeed = _vehicleController.speed; - if (_throttleInput > 0) - { - SetThrottle((int)(_throttleInput * AutowareToVppMultiplier)); - } - - if (_brakeInput > 0) - { - SetBrake((int)(_brakeInput * AutowareToVppMultiplier)); - } + SetThrottle((int)(_throttleInput * AutowareToVppMultiplier)); + SetBrake((int)(_brakeInput * AutowareToVppMultiplier)); } /// diff --git a/Assets/AWSIM/Scripts/Vehicles/VPP Integration/IVehicleControlModes/ControlMode.cs b/Assets/AWSIM/Scripts/Vehicles/VPP Integration/IVehicleControlModes/ControlMode.cs index 3b73cae89..e194cd3c0 100644 --- a/Assets/AWSIM/Scripts/Vehicles/VPP Integration/IVehicleControlModes/ControlMode.cs +++ b/Assets/AWSIM/Scripts/Vehicles/VPP Integration/IVehicleControlModes/ControlMode.cs @@ -9,7 +9,7 @@ public class NoCommand : IVehicleControlMode { public void ExecuteControlMode(AutowareVPPAdapter adapter) { - Debug.Log("Control mode: No command"); + // Debug.Log("Control mode: No command"); } } @@ -51,7 +51,7 @@ public class Manual : IVehicleControlMode { public void ExecuteControlMode(AutowareVPPAdapter adapter) { - Debug.Log("Control mode: Manual"); + // Debug.Log("Control mode: Manual"); } } @@ -59,7 +59,7 @@ public class Disengaged : IVehicleControlMode { public void ExecuteControlMode(AutowareVPPAdapter adapter) { - Debug.Log("Control mode: Disengaged"); + // Debug.Log("Control mode: Disengaged"); } } @@ -67,7 +67,7 @@ public class NotReady : IVehicleControlMode { public void ExecuteControlMode(AutowareVPPAdapter adapter) { - Debug.Log("Control mode: Not ready"); + // Debug.Log("Control mode: Not ready"); } } }