mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 06:22:06 +08:00
GM pcmCruise: cancel more reliably (#25454)
* Cancel more reliably * Apply suggestions from code review * Try sending multiple * Apply suggestions from code review * Apply suggestions from code review * Update selfdrive/car/gm/carcontroller.py * lower rate a bit * try this * Update selfdrive/car/gm/carcontroller.py
This commit is contained in:
@@ -109,10 +109,10 @@ class CarController:
|
||||
|
||||
else:
|
||||
# Stock longitudinal, integrated at camera
|
||||
if (self.frame - self.last_button_frame) * DT_CTRL > 0.1:
|
||||
if (self.frame - self.last_button_frame) * DT_CTRL > 0.04:
|
||||
if CC.cruiseControl.cancel:
|
||||
self.last_button_frame = self.frame
|
||||
can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CruiseButtons.CANCEL))
|
||||
can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL))
|
||||
|
||||
# Show green icon when LKA torque is applied, and
|
||||
# alarming orange icon when approaching torque limit.
|
||||
|
||||
@@ -16,12 +16,14 @@ class CarState(CarStateBase):
|
||||
can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
|
||||
self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"]
|
||||
self.lka_steering_cmd_counter = 0
|
||||
self.buttons_counter = 0
|
||||
|
||||
def update(self, pt_cp, cam_cp, loopback_cp):
|
||||
ret = car.CarState.new_message()
|
||||
|
||||
self.prev_cruise_buttons = self.cruise_buttons
|
||||
self.cruise_buttons = pt_cp.vl["ASCMSteeringButton"]["ACCButtons"]
|
||||
self.buttons_counter = pt_cp.vl["ASCMSteeringButton"]["RollingCounter"]
|
||||
|
||||
ret.wheelSpeeds = self.get_wheel_speeds(
|
||||
pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"],
|
||||
@@ -109,6 +111,7 @@ class CarState(CarStateBase):
|
||||
("AcceleratorPedal2", "AcceleratorPedal2"),
|
||||
("CruiseState", "AcceleratorPedal2"),
|
||||
("ACCButtons", "ASCMSteeringButton"),
|
||||
("RollingCounter", "ASCMSteeringButton"),
|
||||
("SteeringWheelAngle", "PSCMSteeringAngle"),
|
||||
("SteeringWheelRate", "PSCMSteeringAngle"),
|
||||
("FLWheelSpd", "EBCMWheelSpdFront"),
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from selfdrive.car import make_can_msg
|
||||
|
||||
def create_buttons(packer, bus, button):
|
||||
values = {"ACCButtons": button}
|
||||
def create_buttons(packer, bus, idx, button):
|
||||
values = {
|
||||
"ACCButtons": button,
|
||||
"RollingCounter": idx,
|
||||
}
|
||||
return packer.make_can_msg("ASCMSteeringButton", bus, values)
|
||||
|
||||
def create_steering_control(packer, bus, apply_steer, idx, lkas_active):
|
||||
|
||||
Reference in New Issue
Block a user