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