|
|
@ -619,11 +619,18 @@ class Controls: |
|
|
|
else: |
|
|
|
else: |
|
|
|
lac_log = log.ControlsState.LateralDebugState.new_message() |
|
|
|
lac_log = log.ControlsState.LateralDebugState.new_message() |
|
|
|
if self.sm.rcv_frame['testJoystick'] > 0: |
|
|
|
if self.sm.rcv_frame['testJoystick'] > 0: |
|
|
|
|
|
|
|
# reset joystick if it hasn't been received in a while |
|
|
|
|
|
|
|
should_reset_joystick = (self.sm.frame - self.sm.rcv_frame['testJoystick'])*DT_CTRL > 0.2 |
|
|
|
|
|
|
|
if not should_reset_joystick: |
|
|
|
|
|
|
|
joystick_axes = self.sm['testJoystick'].axes |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
joystick_axes = [0.0, 0.0] |
|
|
|
|
|
|
|
|
|
|
|
if CC.longActive: |
|
|
|
if CC.longActive: |
|
|
|
actuators.accel = 4.0*clip(self.sm['testJoystick'].axes[0], -1, 1) |
|
|
|
actuators.accel = 4.0*clip(joystick_axes[0], -1, 1) |
|
|
|
|
|
|
|
|
|
|
|
if CC.latActive: |
|
|
|
if CC.latActive: |
|
|
|
steer = clip(self.sm['testJoystick'].axes[1], -1, 1) |
|
|
|
steer = clip(joystick_axes[1], -1, 1) |
|
|
|
# max angle is 45 for angle-based cars, max curvature is 0.02 |
|
|
|
# max angle is 45 for angle-based cars, max curvature is 0.02 |
|
|
|
actuators.steer, actuators.steeringAngleDeg, actuators.curvature = steer, steer * 45., steer * -0.02 |
|
|
|
actuators.steer, actuators.steeringAngleDeg, actuators.curvature = steer, steer * 45., steer * -0.02 |
|
|
|
|
|
|
|
|
|
|
|