sot-talos-balance
2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_dcmZmpControl_distribute.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_dcmZmpControl_distribute.py"
)
18
19
run_ft_calibration
(
"robot.ftc"
)
20
21
use_force_distribution =
ask_for_confirmation
(
"Use output of force distribution?"
)
22
if
use_force_distribution:
23
print(
"Using output of force distribution"
)
24
else
:
25
print(
"Not using output of force distribution"
)
26
27
input
(
"Wait before running the test"
)
28
29
# Connect ZMP reference and reset controllers
30
print(
"Connect ZMP reference"
)
31
runCommandClient
(
"plug(robot.zmp_estimator.emergencyStop,robot.cm.emergencyStop_zmp)"
)
32
if
use_force_distribution:
33
runCommandClient
(
34
"plug(robot.distribute.emergencyStop,robot.cm.emergencyStop_distribute)"
35
)
36
runCommandClient
(
37
"plug(robot.distribute.zmpRef,robot.com_admittance_control.zmpDes)"
38
)
39
else
:
40
runCommandClient
(
41
"plug(robot.dcm_control.zmpRef,robot.com_admittance_control.zmpDes)"
42
)
43
runCommandClient
(
44
"robot.com_admittance_control.setState(robot.wp.comDes.value,[0.0,0.0,0.0])"
45
)
46
runCommandClient
(
"robot.com_admittance_control.Kp.value = Kp_adm"
)
47
runCommandClient
(
"robot.dcm_control.resetDcmIntegralError()"
)
48
runCommandClient
(
"robot.dcm_control.Ki.value = Ki_dcm"
)
49
50
c =
ask_for_confirmation
(
"Execute a sinusoid?"
)
51
if
c:
52
print(
"Putting the robot in position..."
)
53
runCommandClient
(
"robot.comTrajGen.move(1,-0.025,1.0)"
)
54
sleep(1.0)
55
print(
"Robot is in position!"
)
56
57
c2 =
ask_for_confirmation
(
"Confirm executing the sinusoid?"
)
58
if
c2:
59
print(
"Executing the sinusoid..."
)
60
runCommandClient
(
"robot.comTrajGen.startSinusoid(1,0.025,2.0)"
)
61
print(
"Sinusoid started!"
)
62
else
:
63
print(
"Not executing the sinusoid"
)
64
65
c3 =
ask_for_confirmation
(
"Put the robot back?"
)
66
if
c3:
67
print(
"Stopping the robot..."
)
68
runCommandClient
(
"robot.comTrajGen.stop(1)"
)
69
sleep(5.0)
70
print(
"Putting the robot back..."
)
71
runCommandClient
(
"robot.comTrajGen.move(1,0.0,1.0)"
)
72
sleep(1.0)
73
print(
"The robot is back in position!"
)
74
else
:
75
print(
"Not putting the robot back"
)
76
else
:
77
print(
"Not executing the sinusoid"
)
78
79
c =
ask_for_confirmation
(
"Raise the foot?"
)
80
if
c:
81
print(
"Putting the robot in position..."
)
82
runCommandClient
(
"robot.comTrajGen.move(1,-0.08,10.0)"
)
83
runCommandClient
(
"robot.rhoTrajGen.move(0,0.4,10.0)"
)
84
sleep(10.0)
85
print(
"Robot is in position!"
)
86
87
c2 =
ask_for_confirmation
(
"Confirm raising the foot?"
)
88
if
c2:
89
print(
"Raising the foot..."
)
90
runCommandClient
(
"robot.phaseTrajGen.set(0,-1)"
)
91
runCommandClient
(
"h = robot.dynamic.LF.value[2][3]"
)
92
runCommandClient
(
"robot.lfTrajGen.move(2,h+0.05,10.0)"
)
93
sleep(10.0)
94
print(
"Foot has been raised!"
)
95
c3 =
ask_for_confirmation
(
"Put the foot back?"
)
96
else
:
97
print(
"Not raising the foot"
)
98
c3 =
False
99
100
if
c3:
101
print(
"Putting the foot back..."
)
102
runCommandClient
(
"robot.lfTrajGen.move(2,h,10.0)"
)
103
sleep(10.0)
104
runCommandClient
(
"robot.phaseTrajGen.set(0,0)"
)
105
print(
"The foot is back in position!"
)
106
c4 =
ask_for_confirmation
(
"Put the robot back?"
)
107
else
:
108
print(
"Not putting the foot back"
)
109
c4 =
False
110
111
if
c4:
112
print(
"Putting the robot back..."
)
113
runCommandClient
(
"robot.comTrajGen.move(1,0.0,10.0)"
)
114
runCommandClient
(
"robot.rhoTrajGen.move(0,0.5,10.0)"
)
115
sleep(10.0)
116
print(
"The robot is back in position!"
)
117
else
:
118
print(
"Not raising the foot"
)
119
120
input
(
"Wait before dumping the data"
)
121
122
runCommandClient
(
"dump_tracer(robot.tracer)"
)
sot_talos_balance.utils.run_test_utils.runCommandClient
runCommandClient
Definition:
run_test_utils.py:23
sot_talos_balance.test.test_dcmZmpControl_distribute.input
input
Definition:
test_dcmZmpControl_distribute.py:13
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
src
dynamic_graph
sot_talos_balance
test
test_dcmZmpControl_distribute.py
Generated by
1.8.17