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