Skip to content

Commit 9d32c57

Browse files
committed
Simplify plot
1 parent f1cfd60 commit 9d32c57

1 file changed

Lines changed: 8 additions & 25 deletions

File tree

biped_walking_controller/plot.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
compute_double_support_polygon,
33
compute_single_support_polygon,
44
)
5-
from biped_walking_controller.state_machine import WalkingState
65

76

87
def plot_steps(axes, steps_pose, step_shape):
@@ -188,36 +187,20 @@ def traj2d(arr): # drop last 2 samples as in your code
188187
ax2.set_title(f"{title_prefix} — plan view (x–y)")
189188

190189

191-
def plot_contact_forces_and_state(
190+
def plot_contact_forces(
192191
t: float,
193192
force_rf: float,
194193
force_lf: float,
195-
states: WalkingState,
196-
title: str = "Contact force Fx",
197194
):
198195
t = np.asarray(t).ravel()
199196
force_rf = np.asarray(force_rf).ravel()
200197
force_lf = np.asarray(force_lf).ravel()
201198
assert t.size == force_rf.size == force_lf.size
202199

203-
fig, ax = plt.subplots(2, figsize=(12, 8), layout="constrained", sharex=True)
204-
ax[0].plot(t, force_rf, label="right foot", marker="*")
205-
ax[0].plot(t, force_lf, label="left foot", marker="*")
206-
ax[0].set_ylabel("Normal force [N]")
207-
ax[0].set_title("Contact Force Fx")
208-
ax[0].grid(True)
209-
ax[0].legend()
210-
211-
ticks = []
212-
labels = []
213-
for data in WalkingState:
214-
ticks.append(data.value)
215-
labels.append(data.name)
216-
217-
ax[1].plot(t, states, label="state", marker="*")
218-
ax[1].set_xlabel("t [s]")
219-
ax[1].set_ylabel("State [-]")
220-
ax[1].set_title("State")
221-
ax[1].set_yticks(ticks, labels)
222-
ax[1].grid(True)
223-
ax[1].legend()
200+
fig, ax = plt.subplots(figsize=(12, 8), layout="constrained", sharex=True)
201+
ax.plot(t, force_rf, label="right foot", marker="*")
202+
ax.plot(t, force_lf, label="left foot", marker="*")
203+
ax.set_ylabel("Normal force [N]")
204+
ax.set_title("Contact Force Fx")
205+
ax.grid(True)
206+
ax.legend()

0 commit comments

Comments
 (0)