Skip to content

Commit 4c0c996

Browse files
committed
fix: Replace max/min with np.clip for steering angle limitation in pure pursuit control
1 parent 42ea7da commit 4c0c996

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PathTracking/pure_pursuit/pure_pursuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def pure_pursuit_steer_control(state, trajectory, pind):
146146
delta = state.direction * math.atan2(2.0 * WB * math.sin(alpha) / Lf, 1.0)
147147

148148
# Limit steering angle to max value
149-
delta = max(min(delta, MAX_STEER), -MAX_STEER)
149+
delta = np.clip(delta, -MAX_STEER, MAX_STEER)
150150

151151
return delta, ind
152152

0 commit comments

Comments
 (0)