wcl.problem.addStaticStabilityConstraints("balance", q0, robot.leftAnkle,
                                          robot.rightAnkle)

ps = ProblemSolver(robot)
ps.setNumericalConstraints("balance", [
    "balance/relative-com", "balance/relative-orientation",
    "balance/relative-position", "balance/orientation-left-foot",
    "balance/position-left-foot"
])

# lock hands in closed position
lockedDofs = robot.leftHandClosed()
for name, value in lockedDofs.iteritems():
    ps.lockDof(name, value, 0, 0)

lockedDofs = robot.rightHandClosed()
for name, value in lockedDofs.iteritems():
    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 = ps.applyConstraints(q1)
if res[0]:
    q1proj = res[1]
else:
示例#2
0
                                       robot.rightAnkle, q0)
ps.setNumericalConstraints("balance", [
    "balance/relative-com",
    "balance/relative-pose",
    "balance/pose-left-foot",
])

# lock hands in closed position
lockedjointDict = robot.leftHandClosed()
lockedJoints = list()
for name, value in lockedjointDict.iteritems():
    ljName = "locked_" + name
    ps.createLockedJoint(ljName, name, value)
    lockedJoints.append(ljName)

lockedjointDict = robot.rightHandClosed()
for name, value in lockedjointDict.iteritems():
    ljName = "locked_" + name
    ps.createLockedJoint(ljName, name, value)
    lockedJoints.append(ljName)

ps.setLockedJointConstraints("locked-hands", lockedJoints)

q1 = [
    0.0, 0.0, 0.705, 0., 0., 0., 1.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
]
                                           robot.rightAnkle, "",
                                           Problem.SLIDING)

ps = ProblemSolver (robot)
ps.setNumericalConstraints ("balance", ["balance/relative-com",
                                                "balance/relative-orientation",
                                                "balance/relative-position",
                                                "balance/orientation-left-foot",
                                                "balance/position-left-foot"])

# lock hands in closed position
lockedjoints = robot.leftHandClosed ()
for name, value in lockedjoints.iteritems ():
    ps.lockJoint (name, value)

lockedjoints = robot.rightHandClosed ()
for name, value in lockedjoints.iteritems ():
    ps.lockJoint (name, value)


q1 = [0.0, 0.0, 0.705, 0., 0., 0.0, 1.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 = ps.applyConstraints (q1)
if res [0]:
    q1proj = res [1]
else:
    raise RuntimeError ("Failed to apply constraint.")


q2 = [0.0, 0.0, 0.705, 0, 0, 0, 1, 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]
示例#4
0
                                          robot.rightAnkle, "",
                                          Problem.SLIDING)

ps = ProblemSolver(robot)
ps.setNumericalConstraints("balance", [
    "balance/relative-com", "balance/relative-orientation",
    "balance/relative-position", "balance/orientation-left-foot",
    "balance/position-left-foot"
])

# lock hands in closed position
lockedjoints = robot.leftHandClosed()
for name, value in lockedjoints.iteritems():
    ps.lockJoint(name, value)

lockedjoints = robot.rightHandClosed()
for name, value in lockedjoints.iteritems():
    ps.lockJoint(name, value)

q1 = [
    0.0, 0.0, 0.705, 0., 0., 0., 1.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 = ps.applyConstraints(q1)
if res[0]:
    q1proj = res[1]
else:
wcl.problem.addStaticStabilityConstraints ("balance", q0, robot.leftAnkle,
                                           robot.rightAnkle)
cl.problem.setNumericalConstraints ("balance", ["balance/relative-com",
                                                "balance/relative-orientation",
                                                "balance/relative-position",
                                                "balance/orientation-left-foot",
                                                "balance/position-left-foot",
																								"orientation_relative",
																								"position_absolute"])

# lock hands in closed position11
lockedDofs = robot.leftHandClosed ()
for name, value in lockedDofs.iteritems ():
    cl.problem.lockDof (name, value, 0, 0)

lockedDofs = robot.rightHandClosed ()
for name, value in lockedDofs.iteritems ():
    cl.problem.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]

(ret, q1proj, residualError) = cl.problem.applyConstraints (q0)

#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]


#q2proj = cl.problem.applyConstraints (q2)
#cl.problem.setInitialConfig (q1proj)
#cl.problem.addGoalConfig (q2proj)
#cl.problem.solve ()
ps.setNumericalConstraints ("balance", ["balance/relative-com",
                                                "balance/relative-orientation",
                                                "balance/relative-position",
                                                "balance/orientation-left-foot",
                                                "balance/position-left-foot"
                                                ])

# lock hands in closed position
lockedjointDict = robot.leftHandClosed ()
lockedJoints = list ()
for name, value in lockedjointDict.iteritems ():
    ljName = "locked_" + name
    ps.createLockedJoint (ljName, name, value)
    lockedJoints.append (ljName)

lockedjointDict = robot.rightHandClosed ()
for name, value in lockedjointDict.iteritems ():
    ljName = "locked_" + name
    ps.createLockedJoint (ljName, name, value)
    lockedJoints.append (ljName)

ps.setLockedJointConstraints ("locked-hands", lockedJoints)

q1 = [0.0, 0.0, 0.705, 0., 0., 0., 1.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 = ps.applyConstraints (q1)
if res [0]:
  q1proj = res [1]
else:
  raise RuntimeError ("Failed to apply constraint.")