Skip to content

Commit 6c67cef

Browse files
committed
Added feedforward reference trajectory accleration
1 parent 111f1b4 commit 6c67cef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dynamic_extension_tracking.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
x_d = np.zeros((3, N))
3535
u_d = np.zeros((2, N))
3636
z_d = np.zeros((4, N))
37+
dz_d = np.zeros((2, N))
3738
for k in range(0, N):
3839
x_d[0, k] = R * np.sin(OMEGA * t[k])
3940
x_d[1, k] = R * (1 - np.cos(OMEGA * t[k]))
@@ -48,6 +49,11 @@
4849
z_d[2, k] = u_d[0, k] * np.cos(x_d[2, k])
4950
z_d[3, k] = u_d[0, k] * np.sin(x_d[2, k])
5051

52+
# Precompute the extended system reference acceleration
53+
for k in range(0, N):
54+
dz_d[0, k] = -u_d[0, k] * u_d[1, k] * np.sin(x_d[2, k])
55+
dz_d[1, k] = u_d[0, k] * u_d[1, k] * np.cos(x_d[2, k])
56+
5157
# %%
5258
# VEHICLE SETUP
5359

@@ -94,7 +100,7 @@
94100
for k in range(1, N):
95101

96102
# Compute the extended linear system input control signals
97-
eta = K.gain_matrix @ (z_d[:, k - 1] - z[:, k - 1])
103+
eta = K.gain_matrix @ (z_d[:, k - 1] - z[:, k - 1]) + dz_d[:, k - 1]
98104

99105
# Compute the new (unicycle) vehicle inputs
100106
B_inv = np.array(

0 commit comments

Comments
 (0)