From 51116cddba34dc402aa76b19c07877f3bfa2252f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 18 May 2023 02:44:43 -0700 Subject: [PATCH] add comment and fix --- selfdrive/car/ford/carcontroller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py index 630e2239cc..b5267ea8bb 100644 --- a/selfdrive/car/ford/carcontroller.py +++ b/selfdrive/car/ford/carcontroller.py @@ -82,10 +82,10 @@ class CarController: ### longitudinal control ### # send acc msg at 50Hz if self.CP.openpilotLongitudinalControl and (self.frame % CarControllerParams.ACC_CONTROL_STEP) == 0: + # Both gas and accel are in m/s^2, accel is used solely for braking accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX) - # TODO FIX - gas = clip(actuators.accel, CarControllerParams.MIN_GAS, CarControllerParams.ACCEL_MAX) - if not CC.longActive: + gas = accel + if not CC.longActive or gas < CarControllerParams.MIN_GAS: gas = -5.0 stopping = CC.actuators.longControlState == LongCtrlState.stopping