Revert "capnp: consolidate TurnDirection enum" (#1376)

Revert "capnp: consolidate TurnDirection enum (#1370)"

This reverts commit 7229c7541e.
This commit is contained in:
Jason Wen
2025-10-14 00:19:21 -04:00
committed by GitHub
parent 59c64acc29
commit 339bc0b8b3
3 changed files with 15 additions and 15 deletions

View File

@@ -404,12 +404,12 @@ struct LiveMapDataSP @0xf416ec09499d9d19 {
struct ModelDataV2SP @0xa1680744031fdb2d {
laneTurnDirection @0 :TurnDirection;
}
enum TurnDirection {
none @0;
turnLeft @1;
turnRight @2;
}
enum TurnDirection {
none @0;
turnLeft @1;
turnRight @2;
}
struct CustomReserved10 @0xcb9fd56c7057593a {

View File

@@ -32,9 +32,9 @@ DESIRES = {
}
TURN_DESIRES = {
custom.ModelDataV2SP.TurnDirection.none: log.Desire.none,
custom.ModelDataV2SP.TurnDirection.turnLeft: log.Desire.turnLeft,
custom.ModelDataV2SP.TurnDirection.turnRight: log.Desire.turnRight,
custom.TurnDirection.none: log.Desire.none,
custom.TurnDirection.turnLeft: log.Desire.turnLeft,
custom.TurnDirection.turnRight: log.Desire.turnRight,
}
@@ -49,7 +49,7 @@ class DesireHelper:
self.desire = log.Desire.none
self.alc = AutoLaneChangeController(self)
self.lane_turn_controller = LaneTurnController(self)
self.lane_turn_direction = custom.ModelDataV2SP.TurnDirection.none
self.lane_turn_direction = custom.TurnDirection.none
@staticmethod
def get_lane_change_direction(CS):
@@ -126,7 +126,7 @@ class DesireHelper:
self.prev_one_blinker = one_blinker
if self.lane_turn_direction != custom.ModelDataV2SP.TurnDirection.none:
if self.lane_turn_direction != custom.TurnDirection.none:
self.desire = TURN_DESIRES[self.lane_turn_direction]
else:
self.desire = DESIRES[self.lane_change_direction][self.lane_change_state]

View File

@@ -15,7 +15,7 @@ LANE_CHANGE_SPEED_MIN = 20 * CV.MPH_TO_MS
class LaneTurnController:
def __init__(self, desire_helper):
self.DH = desire_helper
self.turn_direction = custom.ModelDataV2SP.TurnDirection.none
self.turn_direction = custom.TurnDirection.none
self.params = Params()
self.lane_turn_value = float(self.params.get("LaneTurnValue", return_default=True)) * CV.MPH_TO_MS
self.param_read_counter = 0
@@ -33,13 +33,13 @@ class LaneTurnController:
def update_lane_turn(self, blindspot_left: bool, blindspot_right: bool, left_blinker: bool, right_blinker: bool, v_ego: float) -> None:
if left_blinker and not right_blinker and v_ego < self.lane_turn_value and not blindspot_left:
self.turn_direction = custom.ModelDataV2SP.TurnDirection.turnLeft
self.turn_direction = custom.TurnDirection.turnLeft
elif right_blinker and not left_blinker and v_ego < self.lane_turn_value and not blindspot_right:
self.turn_direction = custom.ModelDataV2SP.TurnDirection.turnRight
self.turn_direction = custom.TurnDirection.turnRight
else:
self.turn_direction = custom.ModelDataV2SP.TurnDirection.none
self.turn_direction = custom.TurnDirection.none
def get_turn_direction(self):
if not self.enabled:
return custom.ModelDataV2SP.TurnDirection.none
return custom.TurnDirection.none
return self.turn_direction