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 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_ft_calibration,
9  run_test,
10  runCommandClient,
11 )
12 
13 test_folder, sot_talos_balance_folder = get_file_folder(argv)
14 
15 run_test("appli_no_admittance.py")
16 
17 run_ft_calibration("robot.ftc")
18 
19 if test_folder is not None:
20  c = ask_for_confirmation("Execute trajectory?")
21  if c:
22  print("Executing the trajectory")
23  runCommandClient("robot.triggerTrajGen.sin.value = 1")
24  else:
25  print("Not executing the trajectory")
26 else:
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  sleep(10.0)
61  print("Robot is in position!")
62 
63  foot_on_ground = True
64 
65  c2 = ask_for_confirmation("Confirm raising the foot?")
66  if c2:
67  print("Raising the foot...")
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  foot_on_ground = False
73  c3 = ask_for_confirmation("Put the foot back?")
74  if c3:
75  print("Putting the foot back...")
76  runCommandClient("robot.lfTrajGen.move(2,h,10.0)")
77  sleep(10.0)
78  print("The foot is back in position!")
79  foot_on_ground = True
80  else:
81  print("Not putting the foot back")
82  else:
83  print("Not raising the foot")
84 
85  if foot_on_ground:
86  c4 = ask_for_confirmation("Put the robot back?")
87  if c4:
88  print("Putting the robot back...")
89  runCommandClient("robot.comTrajGen.move(1,0.0,10.0)")
90  sleep(10.0)
91  print("The robot is back in position!")
92  else:
93  print("Not putting the robot back")
94  else:
95  print("Not raising the foot")
96 
97 # input("Wait before dumping the data")
98 
99 # runCommandClient('dump_tracer(robot.tracer)')
100 
101 print("Bye!")
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.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_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