Skip to content

Commit 79349dd

Browse files
committed
plotting more stuff
1 parent 961b257 commit 79349dd

File tree

2 files changed

+63
-9
lines changed

2 files changed

+63
-9
lines changed

proj/model/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Config:
5454
SPAWN_TYPE = "trajectory"
5555
LIVE_PLOT = False
5656

57-
mouse_type = "easy"
57+
mouse_type = "realistic"
5858
model_type = "cart"
5959

6060
dt = 0.005

proj/plotting/results.py

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,23 @@
1212

1313

1414
def _make_figure():
15-
f = plt.figure(figsize=(16, 8))
15+
f = plt.figure(figsize=(20, 8))
1616

17-
gs = f.add_gridspec(2, 6)
17+
gs = f.add_gridspec(2, 8)
1818

1919
xy_ax = f.add_subplot(gs[:, :2])
2020
xy_ax.axis("equal")
2121
xy_ax.axis("off")
2222

2323
tau_ax = f.add_subplot(gs[0, 2:4])
2424
sax = f.add_subplot(gs[1, 2:4])
25-
accel_ax = f.add_subplot(gs[0, 4:])
26-
cost_ax = f.add_subplot(gs[1, 4:])
25+
accel_ax = f.add_subplot(gs[0, 4:6])
26+
cost_ax = f.add_subplot(gs[1, 4:6])
2727

28-
return f, xy_ax, tau_ax, sax, accel_ax, cost_ax
28+
tau_int_ax = f.add_subplot(gs[0, 6:])
29+
acc_int_ax = f.add_subplot(gs[1, 6:])
30+
31+
return f, xy_ax, tau_ax, sax, accel_ax, cost_ax, tau_int_ax, acc_int_ax
2932

3033

3134
def _plot_xy(history, trajectory, plot_every, ax=None):
@@ -71,7 +74,6 @@ def _plot_control(history, ax=None):
7174
color=colors["tau_r"],
7275
label="$\\tau_R$",
7376
lw=2,
74-
solid_joinstyle="round",
7577
solid_capstyle="round",
7678
)
7779
plot_line_outlined(
@@ -80,7 +82,6 @@ def _plot_control(history, ax=None):
8082
color=colors["tau_l"],
8183
label="$\\tau_L$",
8284
lw=2,
83-
solid_joinstyle="round",
8485
solid_capstyle="round",
8586
)
8687
ax.legend()
@@ -133,18 +134,71 @@ def _plot_cost(cost_history, ax=None):
133134
ax.legend()
134135

135136

137+
def _plot_integrals(history, tax=None, aax=None):
138+
R, L = history["tau_r"], history["tau_l"]
139+
140+
plot_line_outlined(
141+
tax,
142+
R,
143+
color=desaturate_color(colors["tau_r"]),
144+
label="R_wheel_speed",
145+
lw=2,
146+
solid_capstyle="round",
147+
)
148+
plot_line_outlined(
149+
tax,
150+
L,
151+
color=desaturate_color(colors["tau_l"]),
152+
label="L_wheel_speed",
153+
lw=2,
154+
solid_capstyle="round",
155+
)
156+
tax.legend()
157+
158+
# plot v and omega
159+
v, omega = history["v"], history["omega"]
160+
161+
plot_line_outlined(
162+
aax,
163+
v,
164+
color=desaturate_color(colors["v"]),
165+
label="$v$",
166+
lw=2,
167+
solid_capstyle="round",
168+
)
169+
plot_line_outlined(
170+
aax,
171+
omega,
172+
color=desaturate_color(colors["omega"]),
173+
label="$\\omega$",
174+
lw=2,
175+
solid_capstyle="round",
176+
)
177+
aax.legend()
178+
179+
136180
def plot_results(results_folder, plot_every=20, save_path=None):
137181
config, trajectory, history, cost_history = load_results_from_folder(
138182
results_folder
139183
)
140184

141-
f, xy_ax, tau_ax, sax, accel_ax, cost_ax = _make_figure()
185+
(
186+
f,
187+
xy_ax,
188+
tau_ax,
189+
sax,
190+
accel_ax,
191+
cost_ax,
192+
tau_int_ax,
193+
acc_int_ax,
194+
) = _make_figure()
142195

143196
_plot_xy(history, trajectory, plot_every, ax=xy_ax)
144197
_plot_control(history, ax=tau_ax)
145198
_plot_v(history, trajectory, plot_every, ax=sax)
146199
_plot_accel(history, ax=accel_ax)
147200
_plot_cost(cost_history, ax=cost_ax)
201+
_plot_integrals(history, tax=tau_int_ax, aax=acc_int_ax)
148202

149203
clean_axes(f)
150204

0 commit comments

Comments
 (0)