nao-robot

How to control NAO crouching movement?


I want to make NAO go from a standing position to a semi-crouch position where the robot is not fully crouched but in-between by defining a distance say 0.01 meter to go on the z-axis to perform the described movement (the parameter must be a value on the z-axis only (not angles))

What I have tried is the following:

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)

or also through this code:

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)

but NAO keeps falling without doing any of the desired movements. How to do that?


Solution

  • You should define your own pose. You can edit it with Choregraphe using either the Animation Mode or directly by moving joints in the 3D view. Then you can save the Pose in the Pose Library panel and select it. If you want to go to that pose programmatically, you can create an animation going to that pose, and export it to C++ or Python.

    You could also capture the joint position by yourself by reading the joints when the robot is in the desired position, and call ALMotion.setAngles to get there.