sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
test_dcmCoupledAnkleControl.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_dcmCoupledAnkleControl.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("Set controller")
25 runCommandClient("plug(robot.zmp_estimator.emergencyStop,robot.cm.emergencyStop_zmp)")
27  "plug(robot.distribute.emergencyStop,robot.cm.emergencyStop_distribute)"
28 )
29 runCommandClient("robot.pitchController.kSum.value = [0.0]")
30 runCommandClient("robot.pitchController.kDiff.value = [0.0]")
31 runCommandClient("robot.rollController.kSum.value = [0.0]")
32 runCommandClient("robot.rollController.kDiff.value = [0.0]")
33 runCommandClient("robot.dcm_control.resetDcmIntegralError()")
34 runCommandClient("robot.dcm_control.Ki.value = Ki_dcm")
35 
36 c = ask_for_confirmation("Execute a sinusoid?")
37 if c:
38  print("Putting the robot in position...")
39  runCommandClient("robot.comTrajGen.move(1,-0.025,1.0)")
40  sleep(1.0)
41  print("Robot is in position!")
42 
43  c2 = ask_for_confirmation("Confirm executing the sinusoid?")
44  if c2:
45  print("Executing the sinusoid...")
46  runCommandClient("robot.comTrajGen.startSinusoid(1,0.025,2.0)")
47  print("Sinusoid started!")
48  else:
49  print("Not executing the sinusoid")
50 
51  c3 = ask_for_confirmation("Put the robot back?")
52  if c3:
53  print("Stopping the robot...")
54  runCommandClient("robot.comTrajGen.stop(1)")
55  sleep(5.0)
56  print("Putting the robot back...")
57  runCommandClient("robot.comTrajGen.move(1,0.0,1.0)")
58  sleep(1.0)
59  print("The robot is back in position!")
60  else:
61  print("Not putting the robot back")
62 else:
63  print("Not executing the sinusoid")
64 
65 input("Wait before ending the test")
def run_ft_calibration(sensor_name, force=False)
def run_test(appli, verbosity=1, interactive=True)