Commit b534422c authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Update script/test_rrt.py.

parent 13722bf4
#/usr/bin/env python
from hpp_ros import ScenePublisher
from hpp.tools import PathPlayer
from hpp_ros import ScenePublisher, PathPlayer
from hpp.corbaserver.hrp2 import Robot
from hpp.corbaserver import ProblemSolver
from hpp.corbaserver.wholebody_step.client import Client as WsClient
......@@ -22,8 +21,8 @@ wcl = WsClient ()
wcl.problem.addStaticStabilityConstraints ("balance", q0, robot.leftAnkle,
robot.rightAnkle)
p = ProblemSolver (robot)
p.setNumericalConstraints ("balance", ["balance/relative-com",
ps = ProblemSolver (robot)
ps.setNumericalConstraints ("balance", ["balance/relative-com",
"balance/relative-orientation",
"balance/relative-position",
"balance/orientation-left-foot",
......@@ -32,16 +31,16 @@ p.setNumericalConstraints ("balance", ["balance/relative-com",
# lock hands in closed position
lockedDofs = robot.leftHandClosed ()
for name, value in lockedDofs.iteritems ():
p.lockDof (name, value, 0, 0)
ps.lockDof (name, value, 0, 0)
lockedDofs = robot.rightHandClosed ()
for name, value in lockedDofs.iteritems ():
p.lockDof (name, value, 0, 0)
ps.lockDof (name, value, 0, 0)
q1 = [0.0, 0.0, 0.705, 1.0, 0., 0., 0.0, 0.0, 0.0, 0.0, 0.0, -0.4, 0, -1.2, -1.0, 0.0, 0.0, 0.174532, -0.174532, 0.174532, -0.174532, 0.174532, -0.174532, 0.261799, -0.17453, 0.0, -0.523599, 0.0, 0.0, 0.174532, -0.174532, 0.174532, -0.174532, 0.174532, -0.174532, 0.0, 0.0, -0.453786, 0.872665, -0.418879, 0.0, 0.0, 0.0, -0.453786, 0.872665, -0.418879, 0.0]
res = p.applyConstraints (q1)
res = ps.applyConstraints (q1)
if res [0]:
q1proj = res [1]
else:
......@@ -50,15 +49,15 @@ else:
q2 = [0.0, 0.0, 0.705, 1, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 1.0, 0, -1.4, -1.0, 0.0, 0.0, 0.174532, -0.174532, 0.174532, -0.174532, 0.174532, -0.174532, 0.261799, -0.17453, 0.0, -0.523599, 0.0, 0.0, 0.174532, -0.174532, 0.174532, -0.174532, 0.174532, -0.174532, 0.0, 0.0, -0.453786, 0.872665, -0.418879, 0.0, 0.0, 0.0, -0.453786, 0.872665, -0.418879, 0.0]
res = p.applyConstraints (q2)
res = ps.applyConstraints (q2)
if res [0]:
q2proj = res [1]
else:
raise RuntimeError ("Failed to apply constraint.")
p.setInitialConfig (q1proj)
p.addGoalConfig (q2proj)
p.solve ()
ps.setInitialConfig (q1proj)
ps.addGoalConfig (q2proj)
ps.solve ()
p = PathPlayer (cl, r)
p (1)
pp = PathPlayer (cl, r)
pp (1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment