Add Subaru gearShifter to carstate (#1318)
* Add Subaru gearShifter to carstate * reset submodules, remove ignore gearshifter from subaru interface * update apks to master * update ref_commit
This commit is contained in:
parent
6013704586
commit
d0b3c69505
|
@ -1,5 +1,6 @@
|
|||
import copy
|
||||
from cereal import car
|
||||
from opendbc.can.can_define import CANDefine
|
||||
from selfdrive.config import Conversions as CV
|
||||
from selfdrive.car.interfaces import CarStateBase
|
||||
from opendbc.can.parser import CANParser
|
||||
|
@ -11,6 +12,8 @@ class CarState(CarStateBase):
|
|||
super().__init__(CP)
|
||||
self.left_blinker_cnt = 0
|
||||
self.right_blinker_cnt = 0
|
||||
can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
|
||||
self.shifter_values = can_define.dv["Transmission"]['Gear']
|
||||
|
||||
def update(self, cp, cp_cam):
|
||||
ret = car.CarState.new_message()
|
||||
|
@ -35,6 +38,9 @@ class CarState(CarStateBase):
|
|||
self.right_blinker_cnt = 50 if cp.vl["Dashlights"]['RIGHT_BLINKER'] else max(self.right_blinker_cnt - 1, 0)
|
||||
ret.rightBlinker = self.right_blinker_cnt > 0
|
||||
|
||||
can_gear = int(cp.vl["Transmission"]['Gear'])
|
||||
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None))
|
||||
|
||||
ret.steeringAngle = cp.vl["Steering_Torque"]['Steering_Angle']
|
||||
ret.steeringTorque = cp.vl["Steering_Torque"]['Steer_Torque_Sensor']
|
||||
ret.steeringPressed = abs(ret.steeringTorque) > STEER_THRESHOLD[self.car_fingerprint]
|
||||
|
@ -80,6 +86,7 @@ class CarState(CarStateBase):
|
|||
("DOOR_OPEN_RR", "BodyInfo", 1),
|
||||
("DOOR_OPEN_RL", "BodyInfo", 1),
|
||||
("Units", "Dash_State", 1),
|
||||
("Gear", "Transmission", 0),
|
||||
]
|
||||
|
||||
checks = [
|
||||
|
|
|
@ -66,7 +66,7 @@ class CarInterface(CarInterfaceBase):
|
|||
be.type = car.CarState.ButtonEvent.Type.accelCruise
|
||||
buttonEvents.append(be)
|
||||
|
||||
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.unknown])
|
||||
events = self.create_common_events(ret)
|
||||
|
||||
if ret.cruiseState.enabled and not self.cruise_enabled_prev:
|
||||
events.append(create_event('pcmEnable', [ET.ENABLE]))
|
||||
|
|
|
@ -1 +1 @@
|
|||
63ee3eaab23b45821a3a04888ae7506ec27dedb3
|
||||
852b5b42981cf17a18c7eebc9b501db2f5b0c33b
|
||||
|
|
Loading…
Reference in a new issue