sot-talos-balance
2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_dcmSingleAnkleControl.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_dcmSingleAnkleControl.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('robot.distribute.phase.value = -1')
26
runCommandClient
(
27
"plug(robot.distribute.emergencyStop,robot.cm.emergencyStop_distribute)"
28
)
29
runCommandClient
(
"robot.rightRollAnkleController.Kp.value = KpRoll"
)
30
runCommandClient
(
"robot.rightPitchAnkleController.Kp.value = KpPitch"
)
31
runCommandClient
(
"robot.dcm_control.resetDcmIntegralError()"
)
32
runCommandClient
(
"robot.dcm_control.Ki.value = Ki_dcm"
)
33
34
c =
ask_for_confirmation
(
"Execute a sinusoid?"
)
35
if
c:
36
print(
"Putting the robot in position..."
)
37
runCommandClient
(
"robot.comTrajGen.move(1,-0.025,1.0)"
)
38
sleep(1.0)
39
print(
"Robot is in position!"
)
40
41
c2 =
ask_for_confirmation
(
"Confirm executing the sinusoid?"
)
42
if
c2:
43
print(
"Executing the sinusoid..."
)
44
runCommandClient
(
"robot.comTrajGen.startSinusoid(1,0.025,2.0)"
)
45
print(
"Sinusoid started!"
)
46
else
:
47
print(
"Not executing the sinusoid"
)
48
49
c3 =
ask_for_confirmation
(
"Put the robot back?"
)
50
if
c3:
51
print(
"Stopping the robot..."
)
52
runCommandClient
(
"robot.comTrajGen.stop(1)"
)
53
sleep(5.0)
54
print(
"Putting the robot back..."
)
55
runCommandClient
(
"robot.comTrajGen.move(1,0.0,1.0)"
)
56
sleep(1.0)
57
print(
"The robot is back in position!"
)
58
else
:
59
print(
"Not putting the robot back"
)
60
else
:
61
print(
"Not executing the sinusoid"
)
62
63
c =
ask_for_confirmation
(
"Raise the foot?"
)
64
if
c:
65
print(
"Putting the robot in position..."
)
66
runCommandClient
(
"robot.comTrajGen.move(1,-0.08,10.0)"
)
67
runCommandClient
(
"robot.rhoTrajGen.move(0,0.4,10.0)"
)
68
sleep(10.0)
69
print(
"Robot is in position!"
)
70
71
c2 =
ask_for_confirmation
(
"Confirm raising the foot?"
)
72
if
c2:
73
print(
"Raising the foot..."
)
74
runCommandClient
(
"robot.distribute.phase.value = -1"
)
75
runCommandClient
(
"h = robot.dynamic.LF.value[2][3]"
)
76
runCommandClient
(
"robot.lfTrajGen.move(2,h+0.05,10.0)"
)
77
sleep(10.0)
78
print(
"Foot has been raised!"
)
79
c3 =
ask_for_confirmation
(
"Put the foot back?"
)
80
else
:
81
print(
"Not raising the foot"
)
82
c3 =
False
83
84
if
c3:
85
print(
"Putting the foot back..."
)
86
runCommandClient
(
"robot.lfTrajGen.move(2,h,10.0)"
)
87
sleep(10.0)
88
runCommandClient
(
"robot.distribute.phase.value = 0"
)
89
print(
"The foot is back in position!"
)
90
else
:
91
print(
"Not putting the foot back"
)
92
93
if
c3
or
not
c2:
94
c4 =
ask_for_confirmation
(
"Put the robot back?"
)
95
else
:
96
c4 =
False
97
98
if
c4:
99
print(
"Putting the robot back..."
)
100
runCommandClient
(
"robot.comTrajGen.move(1,0.0,10.0)"
)
101
runCommandClient
(
"robot.rhoTrajGen.move(0,0.5,10.0)"
)
102
sleep(10.0)
103
print(
"The robot is back in position!"
)
104
else
:
105
print(
"Not raising the foot"
)
106
107
# input("Wait before dumping the data")
108
109
# 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.test.test_dcmSingleAnkleControl.input
input
Definition:
test_dcmSingleAnkleControl.py:13
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_dcmSingleAnkleControl.py
Generated by
1.8.17