1 """Test CoM admittance control as described in paper."""
4 import matplotlib.pyplot
as plt
6 from dynamic_graph.sot_talos_balance.utils.run_test_utils
import (
19 run_test(
"appli_dcmZmpControl_feedback.py")
22 input(
"Wait before running the test")
25 print(
"Connect ZMP reference")
26 runCommandClient(
"plug(robot.zmp_estimator.emergencyStop,robot.cm.emergencyStop_zmp)")
27 runCommandClient(
"plug(robot.dcm_control.zmpRef,robot.com_admittance_control.zmpDes)")
28 runCommandClient(
"robot.com_admittance_control.setState(comDes,[0.0,0.0,0.0])")
39 comDes_data = np.loadtxt(
43 comEst_data = np.loadtxt(
47 comRef_data = np.loadtxt(
48 "/tmp/dg_" +
evalCommandClient(
"robot.com_admittance_control.name") +
"-comRef.dat"
50 comSOT_data = np.loadtxt(
54 dcmDes_data = np.loadtxt(
57 dcmEst_data = np.loadtxt(
61 zmpDes_data = np.loadtxt(
64 zmpSOT_data = np.loadtxt(
67 zmpEst_data = np.loadtxt(
70 zmpRef_data = np.loadtxt(
77 plt.plot(comDes_data[:, 1],
"b--")
78 plt.plot(comEst_data[:, 1],
"b-")
79 plt.plot(comRef_data[:, 1],
"b:")
80 plt.plot(comSOT_data[:, 1],
"b-.")
81 plt.plot(comDes_data[:, 2],
"r--")
82 plt.plot(comEst_data[:, 2],
"r-")
83 plt.plot(comRef_data[:, 2],
"r:")
84 plt.plot(comSOT_data[:, 2],
"r-.")
85 plt.plot(comDes_data[:, 3],
"g--")
86 plt.plot(comEst_data[:, 3],
"g-")
87 plt.plot(comRef_data[:, 3],
"g:")
88 plt.plot(comSOT_data[:, 3],
"g-.")
108 plt.plot(dcmDes_data[:, 1],
"b--")
109 plt.plot(dcmEst_data[:, 1],
"b-")
110 plt.plot(dcmDes_data[:, 2],
"r--")
111 plt.plot(dcmEst_data[:, 2],
"r-")
113 plt.legend([
"Desired x",
"Estimated x",
"Desired y",
"Estimated y"])
116 plt.plot(zmpDes_data[:, 1],
"b--")
117 plt.plot(zmpSOT_data[:, 1],
"b-")
118 plt.plot(zmpRef_data[:, 1],
"b:")
119 plt.plot(zmpDes_data[:, 2],
"r--")
120 plt.plot(zmpSOT_data[:, 2],
"r-")
121 plt.plot(zmpRef_data[:, 2],
"r:")
123 plt.legend([
"Desired x",
"SOT x",
"Reference x",
"Desired y",
"SOT y",
"Reference y"])
125 zmpErrSOT = zmpSOT_data - zmpDes_data
128 plt.plot(zmpErrSOT[:, 1],
"b-")
129 plt.plot(zmpErrSOT[:, 2],
"r-")
130 plt.title(
"ZMP SOT error")
131 plt.legend([
"Error on x",
"Error on y"])
133 input(
"Wait before leaving the simulation")