Prompt Title: Simplify Python GM controller.

Created 1 year ago
Votes 0
Views 80 times
0

Prompt Detail:

Here's a simplified version of the Python code:

python
elif CS.adaptive_Cruise: ConstAccel = interp(CS.out.vEgo, [18.0 * CV.KPH_TO_MS, 100.0 * CV.KPH_TO_MS], [0.17, 0.2125]) accel_diff = (actuators.accel - ConstAccel) accelFomula = (accel_diff / 6.0) if accel_diff < 0 else (accel_diff / 8.0) accelFomula = round(accelFomula + 0.00001, 4) pedal_values = [0.0, ConstAccel, ConstAccel + 0.0250] pedal_ranges = [-0.875, 0.00, 0.30] self.comma_pedal_original = clip(interp(actuators.accel, pedal_ranges, pedal_values) + accelFomula, 0., 1.) self.pedal_hyst_gap = interp(CS.out.vEgo, [40.0 * CV.KPH_TO_MS, 100.0 * CV.KPH_TO_MS], [0.01, 0.0055]) self.pedal_final, self.pedal_steady = actuator_hystereses(self.comma_pedal_original, self.pedal_steady, self.pedal_hyst_gap) self.comma_pedal = clip(self.pedal_final, 0., 1.) actuators.commaPedalOrigin = self.comma_pedal if CS.CP.restartForceAccel: d = self.scc_smoother.get_lead(controls.sm).dRel if self.scc_smoother.get_lead(controls.sm) is not None else 0 stoppingStateWindowsActiveCounterLimits = 1500 if not self.st
avatar
jc01rho
Shared 1 prompt
Created 1 year ago

Leave a Comment