@@ -101,7 +101,7 @@ def create_lat_ctl2_msg(packer, mode: int, path_offset: float, path_angle: float
101
101
return packer .make_can_msg ("LateralMotionControl2" , CANBUS .main , values )
102
102
103
103
104
- def create_acc_msg (packer , long_active : bool , gas : float , accel : float , decel : bool , stopping : bool ):
104
+ def create_acc_msg (packer , long_active : bool , gas : float , accel : float , stopping : bool ):
105
105
"""
106
106
Creates a CAN message for the Ford ACC Command.
107
107
@@ -111,11 +111,13 @@ def create_acc_msg(packer, long_active: bool, gas: float, accel: float, decel: b
111
111
Frequency is 50Hz.
112
112
"""
113
113
114
+ decel = accel < 0 and long_active
114
115
values = {
115
116
"AccBrkTot_A_Rq" : accel , # Brake total accel request: [-20|11.9449] m/s^2
116
117
"Cmbb_B_Enbl" : 1 if long_active else 0 , # Enabled: 0=No, 1=Yes
117
118
"AccPrpl_A_Rq" : gas , # Acceleration request: [-5|5.23] m/s^2
118
119
"AccResumEnbl_B_Rq" : 1 if long_active else 0 ,
120
+ # TODO: we may be able to improve braking response by utilizing pre-charging better
119
121
"AccBrkPrchg_B_Rq" : 1 if decel else 0 , # Pre-charge brake request: 0=No, 1=Yes
120
122
"AccBrkDecel_B_Rq" : 1 if decel else 0 , # Deceleration request: 0=Inactive, 1=Active
121
123
"AccStopStat_B_Rq" : 1 if stopping else 0 ,
0 commit comments