Skip to content

Commit daae534

Browse files
committed
Update guidance.py
1 parent 7a84713 commit daae534

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/python_vehicle_simulator/lib/guidance.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
# reference model for generation of a smooth desired position x_d, velocity |v_d| < v_max,
1818
# and acceleration a_d. Inputs are natural frequency wn_d and relative damping zeta_d.
1919
def refModel3(x_d, v_d, a_d, r, wn_d, zeta_d, v_max, sampleTime):
20-
21-
# Velocity saturation
22-
if (v_d > v_max):
23-
v_d = v_max
24-
elif (v_d < -v_max):
25-
v_d = -v_max
2620

2721
# desired "jerk"
2822
j_d = wn_d**3 * (r -x_d) - (2*zeta_d+1) * wn_d**2 * v_d - (2*zeta_d+1) * wn_d * a_d
@@ -32,4 +26,10 @@ def refModel3(x_d, v_d, a_d, r, wn_d, zeta_d, v_max, sampleTime):
3226
v_d += sampleTime * a_d # desired velocity
3327
a_d += sampleTime * j_d # desired acceleration
3428

29+
# Velocity saturation
30+
if (v_d > v_max):
31+
v_d = v_max
32+
elif (v_d < -v_max):
33+
v_d = -v_max
34+
3535
return x_d, v_d, a_d

0 commit comments

Comments
 (0)