wip
This commit is contained in:
@@ -213,6 +213,7 @@ class CarController(CarControllerBase):
|
|||||||
elif CC.cruiseControl.resume:
|
elif CC.cruiseControl.resume:
|
||||||
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
||||||
# TODO: resume for alt button cars
|
# TODO: resume for alt button cars
|
||||||
|
print (CS.cruise_can_msg)
|
||||||
CS.lkas_trigger_result = 3
|
CS.lkas_trigger_result = 3
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -273,6 +273,8 @@ class CarState(CarStateBase):
|
|||||||
if self.CP.flags & HyundaiFlags.EV:
|
if self.CP.flags & HyundaiFlags.EV:
|
||||||
ret.cruiseState.nonAdaptive = cp.vl["MANUAL_SPEED_LIMIT_ASSIST"]["MSLA_ENABLED"] == 1
|
ret.cruiseState.nonAdaptive = cp.vl["MANUAL_SPEED_LIMIT_ASSIST"]["MSLA_ENABLED"] == 1
|
||||||
|
|
||||||
|
self.cruise_can_msg = copy.copy(cp.vl_all[self.cruise_btns_msg_canfd])
|
||||||
|
|
||||||
self.prev_cruise_buttons = self.cruise_buttons[-1]
|
self.prev_cruise_buttons = self.cruise_buttons[-1]
|
||||||
self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"])
|
self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"])
|
||||||
self.prev_main_buttons = self.main_buttons[-1]
|
self.prev_main_buttons = self.main_buttons[-1]
|
||||||
|
|||||||
@@ -161,11 +161,12 @@ class CarInterface(CarInterfaceBase):
|
|||||||
def _update(self, c, frogpilot_variables):
|
def _update(self, c, frogpilot_variables):
|
||||||
ret = self.CS.update(self.cp, self.cp_cam, frogpilot_variables)
|
ret = self.CS.update(self.cp, self.cp_cam, frogpilot_variables)
|
||||||
|
|
||||||
if self.CS.CP.openpilotLongitudinalControl:
|
# todo: this check probably needs to be removed on other cars
|
||||||
ret.buttonEvents = [
|
# if self.CS.CP.openpilotLongitudinalControl:
|
||||||
*create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT),
|
ret.buttonEvents = [
|
||||||
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
|
*create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT),
|
||||||
]
|
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
|
||||||
|
]
|
||||||
|
|
||||||
# On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state
|
# On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state
|
||||||
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons
|
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ class Controls:
|
|||||||
# Compute actuators (runs PID loops and lateral MPC)
|
# Compute actuators (runs PID loops and lateral MPC)
|
||||||
CC, lac_log = self.state_control(CS)
|
CC, lac_log = self.state_control(CS)
|
||||||
CC = self.clearpilot_state_control(CC, CS)
|
CC = self.clearpilot_state_control(CC, CS)
|
||||||
|
|
||||||
# Publish data
|
# Publish data
|
||||||
self.publish_logs(CS, start_time, CC, lac_log)
|
self.publish_logs(CS, start_time, CC, lac_log)
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ class Controls:
|
|||||||
self.mismatch_counter += 1
|
self.mismatch_counter += 1
|
||||||
|
|
||||||
return CS
|
return CS
|
||||||
|
|
||||||
def update_events(self, CS):
|
def update_events(self, CS):
|
||||||
"""Compute onroadEvents from carState"""
|
"""Compute onroadEvents from carState"""
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ class Controls:
|
|||||||
# CLEARPILOT TODO: Make this a toggle
|
# CLEARPILOT TODO: Make this a toggle
|
||||||
# Clearpilot abstract this into a behavior
|
# Clearpilot abstract this into a behavior
|
||||||
NoLaneChange = False
|
NoLaneChange = False
|
||||||
if not NoLaneChange:
|
if not NoLaneChange:
|
||||||
if self.sm['modelV2'].meta.laneChangeState == LaneChangeState.preLaneChange:
|
if self.sm['modelV2'].meta.laneChangeState == LaneChangeState.preLaneChange:
|
||||||
direction = self.sm['modelV2'].meta.laneChangeDirection
|
direction = self.sm['modelV2'].meta.laneChangeDirection
|
||||||
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
|
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
|
||||||
@@ -1233,15 +1233,11 @@ class Controls:
|
|||||||
if (len(CS.buttonEvents) > 0):
|
if (len(CS.buttonEvents) > 0):
|
||||||
print (CS.buttonEvents)
|
print (CS.buttonEvents)
|
||||||
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
|
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
|
||||||
exit() # Just cause a crash for testing
|
|
||||||
self.events.add(EventName.clpDebug)
|
self.events.add(EventName.clpDebug)
|
||||||
# clearpilot_notice(CP_NOTICE_DEBUG, "LKAS Debug Action Invoked")
|
|
||||||
foo = "bar"
|
|
||||||
|
|
||||||
|
|
||||||
def clearpilot_state_control(self, CC, CS):
|
def clearpilot_state_control(self, CC, CS):
|
||||||
foo = "bar"
|
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
|
||||||
|
CC.cruiseControl.resume = True
|
||||||
return CC
|
return CC
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user