Skip to content

Commit e3bc05a

Browse files
committed
realistic mouse params
1 parent 37db7da commit e3bc05a

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

proj/environment/plotter.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,21 @@ def _plot_accelerations(self):
217217
)
218218
ax.set(xticklabels=["$\dot{v}$", "$\dot{\omega}$"], xticks=[0, 1])
219219

220-
def _plot_cost(self):
220+
def _plot_cost(self, keep_s=1.2):
221+
keep_n = int(keep_s / self.model.dt)
222+
221223
ax = self.cost_ax
222224
ax.clear()
223225

224226
for k, v in self.cost_history.items():
225227
if "total" not in k:
228+
n = len(v)
226229
ax.plot(
227-
v, label=k, lw=3, solid_capstyle="round", color=colors[k],
230+
v[n - keep_n],
231+
label=k,
232+
lw=3,
233+
solid_capstyle="round",
234+
color=colors[k],
228235
)
229236
ax.legend()
230237

proj/model/config.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Config:
1212
STATE_SIZE = 5
1313
INPUT_SIZE = 2
1414

15-
R = np.diag([1.5, 1.5]) # control cost
15+
R = np.diag([0.0001, 0.0001]) # control cost
1616
Q = np.diag([5, 5, 1, 5, 0]) # state cost | x, y, theta, v, omega
1717
Sf = np.diag([0, 0, 0, 0, 0]) # final state cost
1818

@@ -24,14 +24,24 @@ class Config:
2424
# Sf = np.diag([2.5, 2.5, 0, 0]) # final state cost
2525

2626
# ------------------------------- Mouse params ------------------------------- #
27+
# ? works
28+
# mouse = dict(
29+
# L=1.5, # half body width | cm
30+
# R=1, # radius of wheels | cm
31+
# d=0.1, # distance between axel and CoM | cm
32+
# length=3, # cm
33+
# m=round(20 / 9.81, 2), # mass | g
34+
# m_w=round(2 / 9.81, 2), # mass of wheels/legs |g
35+
# )
2736

37+
# ? more realistic
2838
mouse = dict(
29-
L=1.5, # half body width | cm
30-
R=1, # radius of wheels | cm
31-
d=0.1, # distance between axel and CoM | cm
32-
length=3, # cm
33-
m=round(20 / 9.81, 2), # mass | g
34-
m_w=round(2 / 9.81, 2), # mass of wheels/legs |g
39+
L=2, # half body width | cm
40+
R=2, # radius of wheels | cm
41+
d=3, # distance between axel and CoM | cm
42+
length=8.6, # cm
43+
m=round(25 / 9.81, 2), # mass | g
44+
m_w=round(0.6 / 9.81, 2), # mass of wheels/legs |g
3545
)
3646

3747
# ------------------------------ Goal trajectory ----------------------------- #

0 commit comments

Comments
 (0)