sot-talos-balance
2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_simple_ankle_admittance.py
Go to the documentation of this file.
1
from
time
import
sleep
2
3
from
dynamic_graph.sot_talos_balance.utils.run_test_utils
import
(
4
ask_for_confirmation,
5
evalCommandClient,
6
run_test,
7
runCommandClient,
8
)
9
10
run_test
(
"appli_simple_ankle_admittance.py"
)
11
12
sleep(1.0)
13
14
RightPitchJoint = 10
15
LeftPitchJoint = 4
16
RightRollJoint = 11
17
LeftRollJoint = 5
18
19
c =
ask_for_confirmation
(
"Do you want to use the current torques values as reference?"
)
20
if
c:
21
runCommandClient
(
22
"robot.rightPitchAnkleController.tauDes.value = "
23
"robot.device.ptorque.value[RightPitchJoint]"
24
)
25
runCommandClient
(
26
"robot.leftPitchAnkleController.tauDes.value = "
27
"robot.device.ptorque.value[LeftPitchJoint]"
28
)
29
runCommandClient
(
30
"robot.rightRollAnkleController.tauDes.value = "
31
"robot.device.ptorque.value[RightRollJoint]"
32
)
33
runCommandClient
(
34
"robot.leftRollAnkleController.tauDes.value = "
35
"robot.device.ptorque.value[LeftRollJoint]"
36
)
37
38
print(
"Setting desired torques with current values"
)
39
else
:
40
c2 =
ask_for_confirmation
(
"Do you want to use nul torques values as reference?"
)
41
if
c2:
42
runCommandClient
(
"robot.rightPitchAnkleController.tauDes.value = [0.0]"
)
43
runCommandClient
(
"robot.leftPitchAnkleController.tauDes.value = [0.0]"
)
44
runCommandClient
(
"robot.rightRollAnkleController.tauDes.value = [0.0]"
)
45
runCommandClient
(
"robot.leftRollAnkleController.tauDes.value = [0.0]"
)
46
47
print(
"Setting desired torques with nul values"
)
48
else
:
49
runCommandClient
(
50
"robot.rightPitchAnkleController.tauDes.value = [-2.5164434873140853]"
51
)
52
runCommandClient
(
53
"robot.leftPitchAnkleController.tauDes.value = [-2.5164434873140853]"
54
)
55
runCommandClient
(
"robot.rightRollAnkleController.tauDes.value = [0.0]"
)
56
runCommandClient
(
"robot.leftRollAnkleController.tauDes.value = [0.0]"
)
57
58
print(
"Setting desired torques with implemented values"
)
59
60
print(
"Pushing the ankle tasks..."
)
61
62
runCommandClient
(
"robot.sot.push(robot.rightAnklePitchTask.task.name)"
)
63
runCommandClient
(
"robot.sot.push(robot.leftAnklePitchTask.task.name)"
)
64
runCommandClient
(
"robot.sot.push(robot.rightAnkleRollTask.task.name)"
)
65
runCommandClient
(
"robot.sot.push(robot.leftAnkleRollTask.task.name)"
)
66
67
sleep(5.0)
68
tauRP =
evalCommandClient
(
"robot.device.ptorque.value[RightPitchJoint]"
)
69
tauLP =
evalCommandClient
(
"robot.device.ptorque.value[LeftPitchJoint]"
)
70
tauRR =
evalCommandClient
(
"robot.device.ptorque.value[RightRollJoint]"
)
71
tauLR =
evalCommandClient
(
"robot.device.ptorque.value[LeftRollJoint]"
)
72
73
tauDesRP =
evalCommandClient
(
"robot.rightPitchAnkleController.tauDes.value"
)
74
tauDesLP =
evalCommandClient
(
"robot.leftPitchAnkleController.tauDes.value"
)
75
tauDesRR =
evalCommandClient
(
"robot.rightRollAnkleController.tauDes.value"
)
76
tauDesLR =
evalCommandClient
(
"robot.leftRollAnkleController.tauDes.value"
)
77
78
print(
79
"Desired torques: %f, %f, %f, %f"
80
% (tauDesRP[0], tauDesLP[0], tauDesRR[0], tauDesLR[0])
81
)
82
print(
"Current torques: %f, %f, %f, %f"
% (tauRP, tauLP, tauRR, tauLR))
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.evalCommandClient
def evalCommandClient(code)
Definition:
run_test_utils.py:49
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_simple_ankle_admittance.py
Generated by
1.8.17