feet_follower.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
4 import os
5 
6 from dynamic_graph.sot.dynamic_pinocchio.feet_follower import FeetFollowerFromFile
7 from dynamic_graph.sot.dynamic_pinocchio.tools import (
8  checkFinalConfiguration,
9  clt,
10  plug,
11  robot,
12  solver,
13  timeStep,
14 )
15 
16 print(os.environ)
17 
18 feetFollower = FeetFollowerFromFile("feet-follower")
19 
20 feetFollower.feetToAnkleLeft = robot.dynamic.getAnklePositionInFootFrame()
21 feetFollower.feetToAnkleRight = robot.dynamic.getAnklePositionInFootFrame()
22 
23 plug(feetFollower.signal("com"), robot.featureComDes.signal("errorIN"))
24 plug(feetFollower.signal("left-ankle"), robot.features["left-ankle"].reference)
25 plug(feetFollower.signal("right-ankle"), robot.features["right-ankle"].reference)
26 
27 robot.comTask.signal("controlGain").value = 50.0
28 robot.tasks["left-ankle"].signal("controlGain").value = 50.0
29 robot.tasks["right-ankle"].signal("controlGain").value = 50.0
30 
31 # Push tasks
32 # Operational points tasks
33 solver.sot.push(robot.name + ".task.right-ankle")
34 solver.sot.push(robot.name + ".task.left-ankle")
35 
36 # Center of mass
37 solver.sot.push(robot.name + ".task.com")
38 
39 # Main.
40 # Main loop
41 for i in range(500):
42  robot.device.increment(timeStep)
43 
44  if clt:
45  clt.updateElementConfig("hrp", robot.smallToFull(robot.device.state.value))
46 
47 finalPosition = (
48  -0.015361,
49  -0.0049075500000000001,
50  -0.00047065200000000001,
51  -0.0172946,
52  -0.020661800000000001,
53  0.0374547,
54  -0.037641599999999997,
55  0.025434399999999999,
56  -0.45398100000000002,
57  0.86741800000000002,
58  -0.39213799999999999,
59  -0.0089269499999999995,
60  -0.037646100000000002,
61  0.025648199999999999,
62  -0.46715499999999999,
63  0.87717599999999996,
64  -0.38872200000000001,
65  -0.0091408199999999992,
66  0.080488199999999996,
67  -0.18355399999999999,
68  -0.00036695100000000002,
69  -0.0056776600000000002,
70  -0.12173299999999999,
71  -0.23972599999999999,
72  -0.00637303,
73  -0.56908000000000003,
74  0.00296262,
75  0.19108900000000001,
76  0.100088,
77  0.23896800000000001,
78  0.21485599999999999,
79  -0.18973400000000001,
80  -0.49457699999999999,
81  0.040646799999999997,
82  0.16970299999999999,
83  0.100067,
84 )
85 
86 checkFinalConfiguration(robot.device.state.value, finalPosition)
87 print("Exiting.")
dynamic_pinocchio.tools.checkFinalConfiguration
def checkFinalConfiguration(position, finalPosition)
Definition: tools.py:117


sot-dynamic-pinocchio
Author(s): Olivier Stasse
autogenerated on Fri Jul 28 2023 02:10:01