sot-talos-balance
2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_dcmZmpCopControl.py
Go to the documentation of this file.
1
"""Test CoM admittance control as described in paper."""
2
from
time
import
sleep
3
4
from
dynamic_graph.sot_talos_balance.utils.run_test_utils
import
(
5
ask_for_confirmation,
6
run_ft_calibration,
7
run_test,
8
runCommandClient,
9
)
10
11
try
:
12
# Python 2
13
input = raw_input
# noqa
14
except
NameError:
15
pass
16
17
run_test
(
"appli_dcmZmpCopControl.py"
)
18
19
run_ft_calibration
(
"robot.ftc"
)
20
input
(
"Wait before running the test"
)
21
22
# Connect ZMP reference and reset controllers
23
print(
"Set controller"
)
24
runCommandClient
(
"plug(robot.zmp_estimator.emergencyStop,robot.cm.emergencyStop_zmp)"
)
25
runCommandClient
(
26
"plug(robot.distribute.emergencyStop,robot.cm.emergencyStop_distribute)"
27
)
28
runCommandClient
(
"plug(robot.distribute.zmpRef,robot.com_admittance_control.zmpDes)"
)
29
runCommandClient
(
30
"robot.com_admittance_control.setState(robot.wp.comDes.value,[0.0,0.0,0.0])"
31
)
32
runCommandClient
(
"robot.com_admittance_control.Kp.value = Kp_adm"
)
33
runCommandClient
(
"robot.rightAnkleController.gainsXY.value = Kp_ankles"
)
34
runCommandClient
(
"robot.leftAnkleController.gainsXY.value = Kp_ankles"
)
35
runCommandClient
(
"robot.dcm_control.resetDcmIntegralError()"
)
36
runCommandClient
(
"robot.dcm_control.Ki.value = Ki_dcm"
)
37
38
c =
ask_for_confirmation
(
"Execute a sinusoid?"
)
39
if
c:
40
print(
"Putting the robot in position..."
)
41
runCommandClient
(
"robot.comTrajGen.move(1,-0.025,1.0)"
)
42
sleep(1.0)
43
print(
"Robot is in position!"
)
44
45
c2 =
ask_for_confirmation
(
"Confirm executing the sinusoid?"
)
46
if
c2:
47
print(
"Executing the sinusoid..."
)
48
runCommandClient
(
"robot.comTrajGen.startSinusoid(1,0.025,2.0)"
)
49
print(
"Sinusoid started!"
)
50
else
:
51
print(
"Not executing the sinusoid"
)
52
53
c3 =
ask_for_confirmation
(
"Put the robot back?"
)
54
if
c3:
55
print(
"Stopping the robot..."
)
56
runCommandClient
(
"robot.comTrajGen.stop(1)"
)
57
sleep(5.0)
58
print(
"Putting the robot back..."
)
59
runCommandClient
(
"robot.comTrajGen.move(1,0.0,1.0)"
)
60
sleep(1.0)
61
print(
"The robot is back in position!"
)
62
else
:
63
print(
"Not putting the robot back"
)
64
else
:
65
print(
"Not executing the sinusoid"
)
66
67
c =
ask_for_confirmation
(
"Raise the foot?"
)
68
if
c:
69
print(
"Putting the robot in position..."
)
70
runCommandClient
(
"robot.comTrajGen.move(1,-0.08,10.0)"
)
71
runCommandClient
(
"robot.rhoTrajGen.move(0,0.4,10.0)"
)
72
sleep(10.0)
73
print(
"Robot is in position!"
)
74
75
c2 =
ask_for_confirmation
(
"Confirm raising the foot?"
)
76
if
c2:
77
print(
"Raising the foot..."
)
78
runCommandClient
(
"robot.distribute.phase.value = -1"
)
79
runCommandClient
(
"h = robot.dynamic.LF.value[2][3]"
)
80
runCommandClient
(
"robot.lfTrajGen.move(2,h+0.05,10.0)"
)
81
sleep(10.0)
82
print(
"Foot has been raised!"
)
83
c3 =
ask_for_confirmation
(
"Put the foot back?"
)
84
else
:
85
print(
"Not raising the foot"
)
86
c3 =
False
87
88
if
c3:
89
print(
"Putting the foot back..."
)
90
runCommandClient
(
"robot.lfTrajGen.move(2,h,10.0)"
)
91
sleep(10.0)
92
runCommandClient
(
"robot.distribute.phase.value = 0"
)
93
print(
"The foot is back in position!"
)
94
else
:
95
print(
"Not putting the foot back"
)
96
97
if
c3
or
not
c2:
98
c4 =
ask_for_confirmation
(
"Put the robot back?"
)
99
else
:
100
c4 =
False
101
102
if
c4:
103
print(
"Putting the robot back..."
)
104
runCommandClient
(
"robot.comTrajGen.move(1,0.0,10.0)"
)
105
runCommandClient
(
"robot.rhoTrajGen.move(0,0.5,10.0)"
)
106
sleep(10.0)
107
print(
"The robot is back in position!"
)
108
else
:
109
print(
"Not raising the foot"
)
110
111
# raw_input("Wait before dumping the data")
112
113
# runCommandClient('dump_tracer(robot.tracer)')
sot_talos_balance.utils.run_test_utils.runCommandClient
runCommandClient
Definition:
run_test_utils.py:23
sot_talos_balance.utils.run_test_utils.ask_for_confirmation
def ask_for_confirmation(text)
Definition:
run_test_utils.py:110
sot_talos_balance.utils.run_test_utils.run_ft_calibration
def run_ft_calibration(sensor_name, force=False)
Definition:
run_test_utils.py:118
sot_talos_balance.utils.run_test_utils.run_test
def run_test(appli, verbosity=1, interactive=True)
Definition:
run_test_utils.py:83
sot_talos_balance.test.test_dcmZmpCopControl.input
input
Definition:
test_dcmZmpCopControl.py:13
src
dynamic_graph
sot_talos_balance
test
test_dcmZmpCopControl.py
Generated by
1.8.17