我想让 NAO 从站立位置转到半蹲位置,在该位置机器人不是完全蹲下而是在中间,通过定义一个距离(例如 0.01 米)在 z 轴上执行所描述的运动(参数必须是仅 z 轴上的值(不是角度))
我尝试过以下方法:
motionProxy = ALProxy("ALMotion", "127.0.0.1", 9559)
axisMask = almath.AXIS_MASK_ALL # full control
useSensorValues = False
# Lower the Torso and move to the side
effector = "Torso"
initTf = almath.Transform(
motionProxy.getTransform(effector, 2, useSensorValues))
deltaTf = almath.Transform(0.0, -0.000, -0.006) # x, y, z
targetTf = initTf * deltaTf
path = list(targetTf.toVector())
times = 2.0 # seconds
motionProxy.transformInterpolations(effector, 2, path, axisMask, times)
或者也可以通过此代码:
postureProxy.goToPosture("StandInit", 0.5)
# Example showing how to set LArm Position, using a fraction of max speed
chainName = "Torso"
useSensor = False
# Get the current position of the chainName in the same frame
current = motionProxy.getPosition(chainName, 0, useSensor)
target = [
current[0] + 0.00,
current[1] + 0.00,
current[2] - 0.015,
current[3] + 0.0,
current[4] + 0.0,
current[5] + 0.0]
fractionMaxSpeed = 0.001
axisMask = 7 # just control position
motionProxy.setPositions(chainName, 0, target, fractionMaxSpeed, axisMask)
但 NAO 一直在跌倒,没有做任何所需的动作。 如何做到这一点?
您应该定义自己的姿势。 您可以使用 Choregraphe 对其进行编辑,或者通过读取处于所需位置的机器人的关节来捕获它。 然后你就可以设置那个姿势了。