Пример #1
0
ps = ProblemSolver(robot)
ps.addPartialCom('hrp2_14', ['root_joint'])
robot.createSlidingStabilityConstraint("balance/", 'hrp2_14', robot.leftAnkle,
                                       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,
Пример #2
0
wcl.problem.addStaticStabilityConstraints ("balance", q0, robot.leftAnkle, 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
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]