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