|
2 | 2 | compute_double_support_polygon, |
3 | 3 | compute_single_support_polygon, |
4 | 4 | ) |
5 | | -from biped_walking_controller.state_machine import WalkingState |
6 | 5 |
|
7 | 6 |
|
8 | 7 | def plot_steps(axes, steps_pose, step_shape): |
@@ -188,36 +187,20 @@ def traj2d(arr): # drop last 2 samples as in your code |
188 | 187 | ax2.set_title(f"{title_prefix} — plan view (x–y)") |
189 | 188 |
|
190 | 189 |
|
191 | | -def plot_contact_forces_and_state( |
| 190 | +def plot_contact_forces( |
192 | 191 | t: float, |
193 | 192 | force_rf: float, |
194 | 193 | force_lf: float, |
195 | | - states: WalkingState, |
196 | | - title: str = "Contact force Fx", |
197 | 194 | ): |
198 | 195 | t = np.asarray(t).ravel() |
199 | 196 | force_rf = np.asarray(force_rf).ravel() |
200 | 197 | force_lf = np.asarray(force_lf).ravel() |
201 | 198 | assert t.size == force_rf.size == force_lf.size |
202 | 199 |
|
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