|
|
|
@ -51,33 +51,40 @@ def create_acc_commands(packer, enabled, active, accel, gas, stopping, car_finge |
|
|
|
|
min_gas_accel = CarControllerParams.BOSCH_GAS_LOOKUP_BP[0] |
|
|
|
|
|
|
|
|
|
control_on = 5 if enabled else 0 |
|
|
|
|
control_off = not enabled |
|
|
|
|
gas_command = gas if active and accel > min_gas_accel else -30000 |
|
|
|
|
accel_command = accel if active else 0 |
|
|
|
|
braking = 1 if active and accel < min_gas_accel else 0 |
|
|
|
|
standstill = 1 if active and stopping else 0 |
|
|
|
|
standstill_release = 1 if active and not stopping else 0 |
|
|
|
|
|
|
|
|
|
acc_control_values = { |
|
|
|
|
# setting CONTROL_ON causes car to set POWERTRAIN_DATA->ACC_STATUS = 1 |
|
|
|
|
"CONTROL_ON": control_on, |
|
|
|
|
"GAS_COMMAND": gas_command, # used for gas |
|
|
|
|
"ACCEL_COMMAND": accel_command, # used for brakes |
|
|
|
|
"BRAKE_LIGHTS": braking, |
|
|
|
|
"BRAKE_REQUEST": braking, |
|
|
|
|
"STANDSTILL": standstill, |
|
|
|
|
"STANDSTILL_RELEASE": standstill_release, |
|
|
|
|
} |
|
|
|
|
commands.append(packer.make_can_msg("ACC_CONTROL", bus, acc_control_values)) |
|
|
|
|
|
|
|
|
|
acc_control_on_values = { |
|
|
|
|
"SET_TO_3": 0x03, |
|
|
|
|
"CONTROL_ON": enabled, |
|
|
|
|
"SET_TO_FF": 0xff, |
|
|
|
|
"SET_TO_75": 0x75, |
|
|
|
|
"SET_TO_30": 0x30, |
|
|
|
|
} |
|
|
|
|
commands.append(packer.make_can_msg("ACC_CONTROL_ON", bus, acc_control_on_values)) |
|
|
|
|
|
|
|
|
|
if car_fingerprint in HONDA_BOSCH_RADARLESS: |
|
|
|
|
acc_control_values = { |
|
|
|
|
"CONTROL_ON": control_on, |
|
|
|
|
"CONTROL_OFF": control_off, |
|
|
|
|
"ACCEL_COMMAND": accel_command, |
|
|
|
|
} |
|
|
|
|
commands.append(packer.make_can_msg("ACC_CONTROL", bus, acc_control_values)) |
|
|
|
|
else: |
|
|
|
|
acc_control_values = { |
|
|
|
|
# setting CONTROL_ON causes car to set POWERTRAIN_DATA->ACC_STATUS = 1 |
|
|
|
|
"CONTROL_ON": control_on, |
|
|
|
|
"GAS_COMMAND": gas_command, # used for gas |
|
|
|
|
"ACCEL_COMMAND": accel_command, # used for brakes |
|
|
|
|
"BRAKE_LIGHTS": braking, |
|
|
|
|
"BRAKE_REQUEST": braking, |
|
|
|
|
"STANDSTILL": standstill, |
|
|
|
|
"STANDSTILL_RELEASE": standstill_release, |
|
|
|
|
} |
|
|
|
|
commands.append(packer.make_can_msg("ACC_CONTROL", bus, acc_control_values)) |
|
|
|
|
acc_control_on_values = { |
|
|
|
|
"SET_TO_3": 0x03, |
|
|
|
|
"CONTROL_ON": enabled, |
|
|
|
|
"SET_TO_FF": 0xff, |
|
|
|
|
"SET_TO_75": 0x75, |
|
|
|
|
"SET_TO_30": 0x30, |
|
|
|
|
} |
|
|
|
|
commands.append(packer.make_can_msg("ACC_CONTROL_ON", bus, acc_control_on_values)) |
|
|
|
|
return commands |
|
|
|
|
|
|
|
|
|
|
|
|
|
|