sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_dcmZmpControl_estimator.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_dcmZmpControl_estimator.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("Connect ZMP reference")
25 runCommandClient("plug(robot.zmp_estimator.emergencyStop,robot.cm.emergencyStop_zmp)")
26 runCommandClient("plug(robot.dcm_control.zmpRef,robot.com_admittance_control.zmpDes)")
28  "robot.com_admittance_control.setState(robot.wp.comDes.value,[0.0,0.0,0.0])"
29 )
30 runCommandClient("robot.com_admittance_control.Kp.value = Kp_adm")
31 runCommandClient("robot.dcm_control.resetDcmIntegralError()")
32 runCommandClient("robot.dcm_control.Ki.value = Ki_dcm")
33 
34 c = ask_for_confirmation("Execute a sinusoid?")
35 if c:
36  print("Putting the robot in position...")
37  runCommandClient("robot.comTrajGen.move(1,-0.025,1.0)")
38  sleep(1.0)
39  print("Robot is in position!")
40 
41  c2 = ask_for_confirmation("Confirm executing the sinusoid?")
42  if c2:
43  print("Executing the sinusoid...")
44  runCommandClient("robot.comTrajGen.startSinusoid(1,0.025,2.0)")
45  print("Sinusoid started!")
46  else:
47  print("Not executing the sinusoid")
48 
49  c3 = ask_for_confirmation("Put the robot back?")
50  if c3:
51  print("Stopping the robot...")
52  runCommandClient("robot.comTrajGen.stop(1)")
53  sleep(5.0)
54  print("Putting the robot back...")
55  runCommandClient("robot.comTrajGen.move(1,0.0,1.0)")
56  sleep(1.0)
57  print("The robot is back in position!")
58  else:
59  print("Not putting the robot back")
60 else:
61  print("Not executing the sinusoid")
62 
63 c = ask_for_confirmation("Raise the foot?")
64 if c:
65  print("Putting the robot in position...")
66  runCommandClient("robot.comTrajGen.move(1,-0.08,10.0)")
67  sleep(10.0)
68  print("Robot is in position!")
69 
70  c2 = ask_for_confirmation("Confirm raising the foot?")
71  if c2:
72  print("Raising the foot...")
73  runCommandClient("h = robot.dynamic.LF.value[2][3]")
74  runCommandClient("robot.lfTrajGen.move(2,h+0.05,10.0)")
75  sleep(10.0)
76  print("Foot has been raised!")
77  c3 = ask_for_confirmation("Put the foot back?")
78  else:
79  print("Not raising the foot")
80  c3 = False
81 
82  if c3:
83  print("Putting the foot back...")
84  runCommandClient("robot.lfTrajGen.move(2,h,10.0)")
85  sleep(10.0)
86  print("The foot is back in position!")
87  c4 = ask_for_confirmation("Put the robot back?")
88  else:
89  print("Not putting the foot back")
90  c4 = False
91 
92  if c4:
93  print("Putting the robot back...")
94  runCommandClient("robot.comTrajGen.move(1,0.0,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)