1 import ex_4_conf
as conf
2 import LMPC_walking.second_order.plot_utils
as plot_utils
3 import matplotlib.pyplot
as plt
5 from LMPC_walking.second_order.LIPM_to_whole_body
import (
14 data = np.load(conf.DATA_FILE_LIPM)
15 com_state_x = data[
"com_state_x"]
16 com_state_y = data[
"com_state_y"]
17 cop_ref = data[
"cop_ref"]
20 foot_steps = data[
"foot_steps"]
24 com, dcom, ddcom, cop, contact_phase, foot_steps_ctrl = interpolate_lipm_traj(
40 N = conf.nb_steps * round(conf.T_step / conf.dt_mpc)
41 N_ctrl = int((N * conf.dt_mpc) / dt_ctrl)
42 foot_steps_RF = foot_steps[::2, :]
43 x_RF, dx_RF, ddx_RF = compute_foot_traj(
44 foot_steps_RF, N_ctrl, dt_ctrl, conf.T_step, conf.step_height,
"stance"
46 foot_steps_LF = foot_steps[1::2, :]
47 x_LF, dx_LF, ddx_LF = compute_foot_traj(
48 foot_steps_LF, N_ctrl, dt_ctrl, conf.T_step, conf.step_height,
"swing"
63 contact_phase=contact_phase,
68 time_ctrl = np.arange(0, round(N_ctrl * dt_ctrl, 2), dt_ctrl)
72 plt.plot(time_ctrl, x_RF[i, :-1], label=
"x RF " + str(i))
73 plt.plot(time_ctrl, x_LF[i, :-1], label=
"x LF " + str(i))
88 time = np.arange(0, round(N * conf.dt_mpc, 2), conf.dt_mpc)
91 plt.plot(time_ctrl, cop[i, :-1], label=
"CoP")
93 plt.plot(time_ctrl, com[i, :-1],
"g", label=
"CoM")
95 plt.plot(time, com_state_x[:-1, 0],
":", label=
"CoM TO")
97 plt.plot(time, com_state_y[:-1, 0],
":", label=
"CoM TO")
114 foot_length = conf.lxn + conf.lxp
115 foot_width = conf.lyn + conf.lyp
124 com[0, :].reshape((N_ctrl + 1, 1)),
125 com[1, :].reshape((N_ctrl + 1, 1)),
133 plt.gca().set_xlim([-0.2, 0.4])
134 plt.gca().set_ylim([-0.3, 0.3])