Added toggle to enable NNFF.

Credit goes to Twilsonco!

https: //github.com/twilsonco
Co-Authored-By: Tim Wilson <7284371+twilsonco@users.noreply.github.com>
This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent 7c2814329d
commit dd127f97db
435 changed files with 746 additions and 18 deletions

View File

@@ -205,6 +205,7 @@ class Controls:
self.experimental_mode = False
self.v_cruise_helper = VCruiseHelper(self.CP)
self.recalibrating_seen = False
self.nn_alert_shown = False
self.can_log_mono_time = 0
@@ -258,6 +259,11 @@ class Controls:
if self.CP.passive:
return
# show alert to indicate whether NNFF is loaded
if not self.nn_alert_shown and self.sm.frame % 550 == 0 and self.CP.lateralTuning.which() == 'torque' and self.CI.has_lateral_torque_nn:
self.nn_alert_shown = True
self.events.add(FrogPilotEventName.torqueNNLoad)
# Block resume if cruise never previously enabled
resume_pressed = any(be.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for be in CS.buttonEvents)
if not self.CP.pcmCruise and not self.v_cruise_helper.v_cruise_initialized and resume_pressed:
@@ -678,7 +684,8 @@ class Controls:
self.average_desired_curvature)
actuators.steer, actuators.steeringAngleDeg, lac_log = self.LaC.update(CC.latActive, CS, self.VM, lp,
self.steer_limited, self.desired_curvature,
self.desired_curvature_rate, self.sm['liveLocationKalman'])
self.desired_curvature_rate, self.sm['liveLocationKalman'],
lat_plan=lat_plan, model_data=self.sm['modelV2'])
actuators.curvature = self.desired_curvature
else:
lac_log = log.ControlsState.LateralDebugState.new_message()