Skip to content

Commit

Permalink
fixed zero speed division
Browse files Browse the repository at this point in the history
  • Loading branch information
ShisatoYano committed Jan 24, 2025
1 parent 02f5e12 commit 96520ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/control/stanley/stanley_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def _calculate_control_input(self, state, error_lat_m, error_yaw_rad):

# calculate steering angle input
curr_spd = state.get_speed_mps()
error_steer_rad = atan2(self.CONTROL_GAIN * error_lat_m, curr_spd)
if abs(curr_spd) != 0.0:
error_steer_rad = atan2(self.CONTROL_GAIN * error_lat_m, curr_spd)
else:
error_steer_rad = 0.0
self.target_steer_rad = -1 * (error_steer_rad + error_yaw_rad)

# calculate yaw rate input
Expand Down

0 comments on commit 96520ce

Please sign in to comment.