Add carstate changes

old-commit-hash: 8a6f7a5e785b88851f834783f82d3593555ce3b4
This commit is contained in:
Ted Slesinski 2017-11-28 17:27:13 -05:00 committed by Ted Slesinski
parent dbbdedb331
commit 814d829b8d
1 changed files with 70 additions and 0 deletions

View File

@ -261,6 +261,59 @@ def get_can_signals(CP):
(0x324, 10), (0x324, 10),
(0x405, 3), (0x405, 3),
] ]
elif CP.carFingerprint == "HONDA ODYSSEY 2018 EX-L":
dbc_f = 'honda_odyssey_exl_2018.dbc'
signals = [
("XMISSION_SPEED", 0x158, 0),
("WHEEL_SPEED_FL", 0x1d0, 0),
("WHEEL_SPEED_FR", 0x1d0, 0),
("WHEEL_SPEED_RL", 0x1d0, 0),
("WHEEL_SPEED_RR", 0x1d0, 0),
("STEER_ANGLE", 0x156, 0),
("STEER_ANGLE_RATE", 0x156, 0),
("STEER_TORQUE_SENSOR", 0x18f, 0),
("GEAR", 0x1a3, 0),
("WHEELS_MOVING", 0x1b0, 1),
("DOOR_OPEN_FL", 0x405, 1),
("DOOR_OPEN_FR", 0x405, 1),
("DOOR_OPEN_RL", 0x405, 1),
("DOOR_OPEN_RR", 0x405, 1),
("CRUISE_SPEED_PCM", 0x324, 0),
("SEATBELT_DRIVER_LAMP", 0x305, 1),
("SEATBELT_DRIVER_LATCHED", 0x305, 0),
("BRAKE_PRESSED", 0x17c, 0),
("BRAKE_SWITCH", 0x17c, 0),
("CRUISE_BUTTONS", 0x296, 0),
("ESP_DISABLED", 0x1a4, 1),
("HUD_LEAD", 0x30c, 0),
("USER_BRAKE", 0x1a4, 0),
("STEER_STATUS", 0x18f, 5),
("BRAKE_ERROR_1", 0x1b0, 1),
("BRAKE_ERROR_2", 0x1b0, 1),
("GEAR_SHIFTER", 0x1a3, 0),
("MAIN_ON", 0x1a6, 0),
("ACC_STATUS", 0x17c, 0),
("PEDAL_GAS", 0x17c, 0),
("CRUISE_SETTING", 0x296, 0),
("LEFT_BLINKER", 0x326, 0),
("RIGHT_BLINKER", 0x326, 0),
("CRUISE_SPEED_OFFSET", 0x37c, 0)
]
checks = [
(0x156, 100),
(0x158, 100),
(0x17c, 100),
(0x1a3, 50),
(0x1a4, 50),
(0x1b0, 50),
(0x1d0, 50),
(0x296, 25),
(0x305, 10),
(0x324, 10),
(0x326, 10),
(0x37c, 10),
(0x405, 3),
]
# add gas interceptor reading if we are using it # add gas interceptor reading if we are using it
if CP.enableGas: if CP.enableGas:
signals.append(("INTERCEPTOR_GAS", 0x201, 0)) signals.append(("INTERCEPTOR_GAS", 0x201, 0))
@ -278,6 +331,7 @@ class CarState(object):
self.civic = False self.civic = False
self.accord = False self.accord = False
self.crv = False self.crv = False
self.odyssey = False
if CP.carFingerprint == "HONDA CIVIC 2016 TOURING": if CP.carFingerprint == "HONDA CIVIC 2016 TOURING":
self.civic = True self.civic = True
elif CP.carFingerprint == "ACURA ILX 2016 ACURAWATCH PLUS": elif CP.carFingerprint == "ACURA ILX 2016 ACURAWATCH PLUS":
@ -286,6 +340,8 @@ class CarState(object):
self.accord = True self.accord = True
elif CP.carFingerprint == "HONDA CR-V 2016 TOURING": elif CP.carFingerprint == "HONDA CR-V 2016 TOURING":
self.crv = True self.crv = True
elif CP.carFingerprint == "HONDA ODYSSEY 2018 EX-L":
self.odyssey = True
else: else:
raise ValueError("unsupported car %s" % CP.carFingerprint) raise ValueError("unsupported car %s" % CP.carFingerprint)
@ -418,6 +474,20 @@ class CarState(object):
self.cruise_speed_offset = -0.3 self.cruise_speed_offset = -0.3
self.park_brake = 0 # TODO self.park_brake = 0 # TODO
self.brake_hold = 0 # TODO self.brake_hold = 0 # TODO
elif self.odyssey:
can_gear_shifter = cp.vl[0x1A3]['GEAR_SHIFTER']
self.angle_steers = cp.vl[0x156]['STEER_ANGLE']
self.angle_steers_rate = cp.vl[0x156]['STEER_ANGLE_RATE']
self.gear = cp.vl[0x1A3]['GEAR']
self.cruise_setting = cp.vl[0x296]['CRUISE_SETTING']
self.cruise_buttons = cp.vl[0x296]['CRUISE_BUTTONS']
self.main_on = cp.vl[0x326]['MAIN_ON']
self.blinker_on = cp.vl[0x326]['LEFT_BLINKER'] or cp.vl[0x326]['RIGHT_BLINKER']
self.left_blinker_on = cp.vl[0x326]['LEFT_BLINKER']
self.right_blinker_on = cp.vl[0x326]['RIGHT_BLINKER']
self.cruise_speed_offset = calc_cruise_offset(cp.vl[0x37c]['CRUISE_SPEED_OFFSET'], self.v_ego)
self.park_brake = cp.vl[0x1c2]['EPB_STATE'] != 0
self.brake_hold = cp.vl[0x1A4]['BRAKE_HOLD_ACTIVE']
elif self.acura: elif self.acura:
can_gear_shifter = cp.vl[0x1A3]['GEAR_SHIFTER'] can_gear_shifter = cp.vl[0x1A3]['GEAR_SHIFTER']
self.angle_steers = cp.vl[0x156]['STEER_ANGLE'] self.angle_steers = cp.vl[0x156]['STEER_ANGLE']