Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toyota long maneuvers v2 #14

Open
wants to merge 21 commits into
base: toyota-lat-only-mode-v4
Choose a base branch
from
Prev Previous commit
Next Next commit
hmmmmm
  • Loading branch information
ntegan1 committed Feb 23, 2023
commit 3cf09c4dcaad8edcc147853a1ba0751285c8fa8b
4 changes: 4 additions & 0 deletions selfdrive/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def update(self, cp, cp_cam):
event = car.CarState.ButtonEvent.new_message()
event.type = car.CarState.ButtonEvent.Type.gapAdjustCruise
event.pressed = fd_button
if fd_button:
print("carstate pressed: ")
else:
print("carstate not pressed: ")
be.append(event)
self.gapAdjustCruisePrev = fd_button
ret.buttonEvents = be
Expand Down
6 changes: 5 additions & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,17 @@ def state_control(self, CS):
for b in be:
if b.type == car.CarState.ButtonEvent.Type.gapAdjustCruise:
if b.pressed is True:
print("controlsd pressed")
maneuver_reset = True
elif b.pressed is False:
maneuver_reset = True
print("controlsd not pressed")

if maneuver_reset:
print("controlsd maneuver reset")
if not CC.latActive:
self.LaC.reset()
if not CC.longActive or maneuver_reset:
if not CC.longActive:
self.LoC.reset(v_pid=CS.vEgo)

if not self.joystick_mode:
Expand Down
6 changes: 4 additions & 2 deletions selfdrive/controls/lib/longitudinal_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ class LongitudinalPlanner:
def maneuver_update(self, be, lmt):
for b in be:
if b.type == car.CarState.ButtonEvent.Type.gapAdjustCruise:
if b.pressed is True:
if b.pressed is True and not self.maneuvering:
print("longplanner update maneuver pressed")
self.maneuvering = True
self.maneuverStartMonoTime = lmt
if b.pressed is False:
if b.pressed is False and self.maneuvering:
print("longplanner update maneuver not pressed")
self.maneuvering = False
self.maneuverStartMonoTime = None
def __init__(self, CP, init_v=0.0, init_a=0.0):
Expand Down