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 
3 from time import sleep
4 
5 from dynamic_graph.sot_talos_balance.utils.run_test_utils import (
6  ask_for_confirmation,
7  run_ft_calibration,
8  run_test,
9  runCommandClient,
10 )
11 
12 try:
13  # Python 2
14  input = raw_input # noqa
15 except NameError:
16  pass
17 
18 run_test("appli_waistControl.py")
19 
20 run_ft_calibration("robot.ftc")
21 input("Wait before running the test")
22 
23 # Connect ZMP reference and reset controllers
24 print("Running the test")
25 # runCommandClient('plug(robot.baseselec.sout, robot.dynamic.ffposition)')
26 
27 c = ask_for_confirmation("Execute a sinusoid?")
28 if c:
29  print("Putting the robot in position...")
30  runCommandClient("robot.comTrajGen.move(1,-0.025,1.0)")
31  sleep(1.0)
32  print("Robot is in position!")
33 
34  c2 = ask_for_confirmation("Confirm executing the sinusoid?")
35  if c2:
36  print("Executing the sinusoid...")
37  runCommandClient("robot.comTrajGen.startSinusoid(1,0.025,2.0)")
38  print("Sinusoid started!")
39  else:
40  print("Not executing the sinusoid")
41 
42  c3 = ask_for_confirmation("Put the robot back?")
43  if c3:
44  print("Stopping the robot...")
45  runCommandClient("robot.comTrajGen.stop(1)")
46  sleep(5.0)
47  print("Putting the robot back...")
48  runCommandClient("robot.comTrajGen.move(1,0.0,1.0)")
49  sleep(1.0)
50  print("The robot is back in position!")
51  else:
52  print("Not putting the robot back")
53 else:
54  print("Not executing the sinusoid")
55 
56 c = ask_for_confirmation("Raise the foot?")
57 if c:
58  print("Putting the robot in position...")
59  runCommandClient("robot.comTrajGen.move(1,-0.08,10.0)")
60  runCommandClient("robot.rhoTrajGen.move(0,0.4,10.0)")
61  sleep(10.0)
62  print("Robot is in position!")
63 
64  c2 = ask_for_confirmation("Confirm raising the foot?")
65  if c2:
66  print("Raising the foot...")
67  runCommandClient("robot.distribute.phase.value = -1")
68  runCommandClient("h = robot.dynamic.LF.value[2][3]")
69  runCommandClient("robot.lfTrajGen.move(2,h+0.05,10.0)")
70  sleep(10.0)
71  print("Foot has been raised!")
72  c3 = ask_for_confirmation("Put the foot back?")
73  else:
74  print("Not raising the foot")
75  c3 = False
76 
77  if c3:
78  print("Putting the foot back...")
79  runCommandClient("robot.lfTrajGen.move(2,h,10.0)")
80  sleep(10.0)
81  runCommandClient("robot.distribute.phase.value = 0")
82  print("The foot is back in position!")
83  else:
84  print("Not putting the foot back")
85 
86  if c3 or not c2:
87  c4 = ask_for_confirmation("Put the robot back?")
88  else:
89  c4 = False
90 
91  if c4:
92  print("Putting the robot back...")
93  runCommandClient("robot.comTrajGen.move(1,0.0,10.0)")
94  runCommandClient("robot.rhoTrajGen.move(0,0.5,10.0)")
95  sleep(10.0)
96  print("The robot is back in position!")
97 else:
98  print("Not raising the foot")
99 
100 # input("Wait before dumping the data")
101 
102 # runCommandClient('dump_tracer(robot.tracer)')
def run_ft_calibration(sensor_name, force=False)
def run_test(appli, verbosity=1, interactive=True)