sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_base_estimator.py
Go to the documentation of this file.
1 """Test CoM admittance control as described in paper, with pre-loaded movements"""
2 
3 from sys import argv
4 from time import sleep
5 
6 from dynamic_graph.sot_talos_balance.utils.run_test_utils import (
7  ask_for_confirmation,
8  get_file_folder,
9  run_test,
10  runCommandClient,
11 )
12 
13 try:
14  # Python 2
15  input = raw_input # noqa
16 except NameError:
17  pass
18 
19 test_folder, sot_talos_balance_folder = get_file_folder(argv)
20 
21 run_test("appli_base_estimator.py")
22 
23 if test_folder is not None:
24  c = ask_for_confirmation("Execute trajectory?")
25  if c:
26  print("Executing the trajectory")
27  runCommandClient("robot.triggerTrajGen.sin.value = 1")
28  else:
29  print("Not executing the trajectory")
30 else:
31  c = ask_for_confirmation("Execute a sinusoid?")
32  if c:
33  print("Putting the robot in position...")
34  runCommandClient("robot.comTrajGen.move(1,-0.025,1.0)")
35  sleep(1.0)
36  print("Robot is in position!")
37 
38  c2 = ask_for_confirmation("Confirm executing the sinusoid?")
39  if c2:
40  print("Executing the sinusoid...")
41  runCommandClient("robot.comTrajGen.startSinusoid(1,0.025,2.0)")
42  print("Sinusoid started!")
43  else:
44  print("Not executing the sinusoid")
45 
46  c3 = ask_for_confirmation("Put the robot back?")
47  if c3:
48  print("Stopping the robot...")
49  runCommandClient("robot.comTrajGen.stop(1)")
50  sleep(5.0)
51  print("Putting the robot back...")
52  runCommandClient("robot.comTrajGen.move(1,0.0,1.0)")
53  sleep(1.0)
54  print("The robot is back in position!")
55  else:
56  print("Not putting the robot back")
57  else:
58  print("Not executing the sinusoid")
59 
60  c = ask_for_confirmation("Raise the foot?")
61  if c:
62  print("Putting the robot in position...")
63  runCommandClient("robot.comTrajGen.move(1,-0.08,10.0)")
64  sleep(10.0)
65  print("Robot is in position!")
66 
67  foot_on_ground = True
68 
69  c2 = ask_for_confirmation("Confirm raising the foot?")
70  if c2:
71  print("Raising the foot...")
72  runCommandClient("h = robot.dynamic.LF.value[2][3]")
73  runCommandClient("robot.lfTrajGen.move(2,h+0.05,10.0)")
74  sleep(10.0)
75  print("Foot has been raised!")
76  foot_on_ground = False
77  c3 = ask_for_confirmation("Put the foot back?")
78  if c3:
79  print("Putting the foot back...")
80  runCommandClient("robot.lfTrajGen.move(2,h,10.0)")
81  sleep(10.0)
82  print("The foot is back in position!")
83  foot_on_ground = True
84  else:
85  print("Not putting the foot back")
86  else:
87  print("Not raising the foot")
88 
89  if foot_on_ground:
90  c4 = ask_for_confirmation("Put the robot back?")
91  if c4:
92  print("Putting the robot back...")
93  runCommandClient("robot.comTrajGen.move(1,0.0,10.0)")
94  sleep(10.0)
95  print("The robot is back in position!")
96  else:
97  print("Not putting the robot back")
98  else:
99  print("Not raising the foot")
100 
101 input("Wait before dumping the data")
def run_test(appli, verbosity=1, interactive=True)