Skip to content

Commit 0055f6e

Browse files
committed
Minor update to order in simulation code
1 parent f161c4e commit 0055f6e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

control_approx_linearization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565

6666
for k in range(1, N):
6767

68+
# Simulate the differential drive vehicle motion
69+
x[:, k] = rk_four(vehicle.f, x[:, k - 1], u[:, k - 1], T)
70+
6871
# Compute the approximate linearization
6972
A = np.array(
7073
[
@@ -83,9 +86,6 @@
8386
u_unicycle = -K.gain_matrix @ (x[:, k - 1] - x_d[:, k - 1]) + u_d[:, k - 1]
8487
u[:, k] = vehicle.uni2diff(u_unicycle)
8588

86-
# Simulate the differential drive vehicle motion
87-
x[:, k] = rk_four(vehicle.f, x[:, k - 1], u[:, k - 1], T)
88-
8989
# %%
9090
# MAKE PLOTS
9191

dynamic_extension_tracking.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@
9999

100100
for k in range(1, N):
101101

102+
# Simulate the vehicle motion
103+
x[:, k] = rk_four(vehicle.f, x[:, k - 1], u[:, k - 1], T)
104+
105+
# Update the extended system states
106+
xi[0, k] = x[0, k]
107+
xi[1, k] = x[1, k]
108+
xi[2, k] = u_unicycle[0] * np.cos(x[2, k])
109+
xi[3, k] = u_unicycle[0] * np.sin(x[2, k])
110+
102111
# Compute the extended linear system input control signals
103112
eta = K.gain_matrix @ (xi_d[:, k - 1] - xi[:, k - 1]) + ddz_d[:, k - 1]
104113

@@ -116,15 +125,6 @@
116125
# Convert unicycle inputs to differential drive wheel speeds
117126
u[:, k] = vehicle.uni2diff(u_unicycle)
118127

119-
# Simulate the vehicle motion
120-
x[:, k] = rk_four(vehicle.f, x[:, k - 1], u[:, k - 1], T)
121-
122-
# Update the extended system states
123-
xi[0, k] = x[0, k]
124-
xi[1, k] = x[1, k]
125-
xi[2, k] = u_unicycle[0] * np.cos(x[2, k])
126-
xi[3, k] = u_unicycle[0] * np.sin(x[2, k])
127-
128128
# %%
129129
# MAKE PLOTS
130130

0 commit comments

Comments
 (0)