mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-11 10:43:46 +08:00
Turn Desires
This commit is contained in:
@@ -30,6 +30,13 @@ DESIRES = {
|
||||
}
|
||||
|
||||
# FrogPilot variables
|
||||
TurnDirection = log.Desire
|
||||
|
||||
TURN_DESIRES = {
|
||||
TurnDirection.none: log.Desire.none,
|
||||
TurnDirection.turnLeft: log.Desire.turnLeft,
|
||||
TurnDirection.turnRight: log.Desire.turnRight,
|
||||
}
|
||||
|
||||
|
||||
class DesireHelper:
|
||||
@@ -131,7 +138,12 @@ class DesireHelper:
|
||||
|
||||
self.prev_one_blinker = one_blinker
|
||||
|
||||
self.desire = DESIRES[self.lane_change_direction][self.lane_change_state]
|
||||
if lateral_active and one_blinker and below_lane_change_speed and not carstate.standstill and frogpilot_toggles.use_turn_desires:
|
||||
self.turn_direction = TurnDirection.turnLeft if carstate.leftBlinker else TurnDirection.turnRight
|
||||
self.desire = TURN_DESIRES[self.turn_direction]
|
||||
else:
|
||||
self.turn_direction = TurnDirection.none
|
||||
self.desire = DESIRES[self.lane_change_direction][self.lane_change_state]
|
||||
|
||||
# Send keep pulse once per second during LaneChangeStart.preLaneChange
|
||||
if self.lane_change_state in (LaneChangeState.off, LaneChangeState.laneChangeStarting):
|
||||
|
||||
@@ -409,6 +409,7 @@ def main(demo=False):
|
||||
|
||||
# FrogPilot variables
|
||||
frogpilot_modelv2_send = messaging.new_message('frogpilotModelV2')
|
||||
frogpilot_modelv2_send.frogpilotModelV2.turnDirection = DH.turn_direction
|
||||
|
||||
pm.send('frogpilotModelV2', frogpilot_modelv2_send)
|
||||
last_vipc_frame_id = meta_main.frame_id
|
||||
|
||||
@@ -1204,6 +1204,22 @@ FROGPILOT_EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
Priority.LOW, VisualAlert.none, AudibleAlert.prompt, 3.),
|
||||
},
|
||||
|
||||
FrogPilotEventName.turningLeft: {
|
||||
ET.WARNING: Alert(
|
||||
"Turning Left",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1),
|
||||
},
|
||||
|
||||
FrogPilotEventName.turningRight: {
|
||||
ET.WARNING: Alert(
|
||||
"Turning Right",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1),
|
||||
},
|
||||
|
||||
# Random Events
|
||||
FrogPilotEventName.accel30: {
|
||||
ET.WARNING: Alert(
|
||||
|
||||
Reference in New Issue
Block a user