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 from time import sleep
3 
4 from dynamic_graph.sot_talos_balance.utils.run_test_utils import (
5  ask_for_confirmation,
6  run_ft_calibration,
7  run_test,
8  runCommandClient,
9 )
10 
11 try:
12  # Python 2
13  input = raw_input # noqa
14 except NameError:
15  pass
16 
17 run_test("appli_dcmCoupledAnkleControl.py")
18 
19 run_ft_calibration("robot.ftc")
20 input("Wait before running the test")
21 
22 # Connect ZMP reference and reset controllers
23 print("Set controller")
24 runCommandClient("plug(robot.zmp_estimator.emergencyStop,robot.cm.emergencyStop_zmp)")
26  "plug(robot.distribute.emergencyStop,robot.cm.emergencyStop_distribute)"
27 )
28 runCommandClient("robot.pitchController.kSum.value = [0.0]")
29 runCommandClient("robot.pitchController.kDiff.value = [0.0]")
30 runCommandClient("robot.rollController.kSum.value = [0.0]")
31 runCommandClient("robot.rollController.kDiff.value = [0.0]")
32 runCommandClient("robot.dcm_control.resetDcmIntegralError()")
33 runCommandClient("robot.dcm_control.Ki.value = Ki_dcm")
34 
35 c = ask_for_confirmation("Execute a sinusoid?")
36 if c:
37  print("Putting the robot in position...")
38  runCommandClient("robot.comTrajGen.move(1,-0.025,1.0)")
39  sleep(1.0)
40  print("Robot is in position!")
41 
42  c2 = ask_for_confirmation("Confirm executing the sinusoid?")
43  if c2:
44  print("Executing the sinusoid...")
45  runCommandClient("robot.comTrajGen.startSinusoid(1,0.025,2.0)")
46  print("Sinusoid started!")
47  else:
48  print("Not executing the sinusoid")
49 
50  c3 = ask_for_confirmation("Put the robot back?")
51  if c3:
52  print("Stopping the robot...")
53  runCommandClient("robot.comTrajGen.stop(1)")
54  sleep(5.0)
55  print("Putting the robot back...")
56  runCommandClient("robot.comTrajGen.move(1,0.0,1.0)")
57  sleep(1.0)
58  print("The robot is back in position!")
59  else:
60  print("Not putting the robot back")
61 else:
62  print("Not executing the sinusoid")
63 
64 input("Wait before ending the test")
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
sot_talos_balance.test.test_dcmCoupledAnkleControl.input
input
Definition: test_dcmCoupledAnkleControl.py:13