|
|
|
@ -3,9 +3,10 @@ from common.numpy_fast import mean |
|
|
|
|
from opendbc.can.can_define import CANDefine |
|
|
|
|
from opendbc.can.parser import CANParser |
|
|
|
|
from selfdrive.car.interfaces import CarStateBase |
|
|
|
|
from selfdrive.car.gm.values import DBC, CAR, AccState, CanBus, STEER_THRESHOLD |
|
|
|
|
|
|
|
|
|
from selfdrive.car.gm.values import DBC, AccState, CanBus, STEER_THRESHOLD |
|
|
|
|
|
|
|
|
|
TransmissionType = car.CarParams.TransmissionType |
|
|
|
|
# TODO: Switch from hardcoded car to CarParams trans |
|
|
|
|
class CarState(CarStateBase): |
|
|
|
|
def __init__(self, CP): |
|
|
|
|
super().__init__(CP) |
|
|
|
@ -35,7 +36,7 @@ class CarState(CarStateBase): |
|
|
|
|
ret.brakePressed = pt_cp.vl["EBCMBrakePedalPosition"]["BrakePedalPosition"] >= 10 |
|
|
|
|
|
|
|
|
|
# Regen braking is braking |
|
|
|
|
if self.car_fingerprint == CAR.VOLT: |
|
|
|
|
if self.CP.transmissionType == TransmissionType.direct: |
|
|
|
|
ret.brakePressed = ret.brakePressed or pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0 |
|
|
|
|
|
|
|
|
|
ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254. |
|
|
|
@ -120,7 +121,7 @@ class CarState(CarStateBase): |
|
|
|
|
("EBCMBrakePedalPosition", 100), |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
if CP.carFingerprint == CAR.VOLT: |
|
|
|
|
if CP.transmissionType == TransmissionType.direct: |
|
|
|
|
signals.append(("RegenPaddle", "EBCMRegenPaddle")) |
|
|
|
|
checks.append(("EBCMRegenPaddle", 50)) |
|
|
|
|
|
|
|
|
|