Aldebaran documentation What's new in NAOqi 2.4.3?

ALRobotPosture

Overview | API


What it does

ALRobotPosture module allows you to make the robot go to different predefined postures.

You can choose between ALRobotPostureProxy::goToPosture and ALRobotPostureProxy::applyPosture.

How it works

The robot detects in which posture it is, computes a path from its current posture to its target posture, and applies it.

It is possible to choose the speed for the posture to be applied.

Definitions

Posture

A posture for a robot is a (unique) configuration of its joints and of inertial sensor.

As a posture is defined by a list of real numbers (i.e. floats) there is an infinite number of postures.

Predefined postures

Here is the list of the Predefined Postures names:

  • Crouch,
  • LyingBack,
  • LyingBelly,
  • Sit,
  • SitRelax,
  • Stand,
  • StandInit,
  • StandZero.

Some postures, like Sit or Lying, are not available for all types of Aldebaran robots.

To retrieve the list of predefined postures available on your Aldebaran robot, use: ALRobotPostureProxy::getPostureList .

To visualize the different predefined postures, see:

Posture family

As the number of possible postures is infinite, postures are grouped in Posture families in order to ease the interpretation of the current posture.

For example, the posture family Sitting contains the postures SitRelax and Sit as well as all the approaching postures.

Here is the list of posture families:

Using ALRobotPostureProxy::getPostureFamilyList you can find out what are the available posture families on your robot. It is a subset of the set bellow.

Posture Family Description
“Standing” the weight is supported by the feet, the torso is upright and the legs are straight.
“Crouching” the weight is supported by the feet, the torso is upright and the legs are bent.
“Sitting” the buttock is in contact with the ground and the torso is upright.
“SittingOnChair” the buttock is in contact with a chair (10cm high) and the torso is upright.
“LyingBelly” stretched and facing down.
“LyingBack” stretched and facing up.
“LyingLeft” stretched and facing to its right side.
“LyingRight” stretched and facing to its left side.
“Belly” facing down with the trunk lifted.
“Back” facing back with the trunk lifted.
“Left” leaning toward the left and touching the ground with its hand.
“Right” leaning toward the right and touching the ground with its hand.

Getting started

Python example

alrobotposture.py

#! /usr/bin/env python
# -*- encoding: UTF-8 -*-

"""Example: Use goToPosture Method"""

import qi
import argparse
import sys


def main(session):
    """
    This example uses the goToPosture method.
    """
    # Get the service ALRobotPosture.

    posture_service = session.service("ALRobotPosture")

    posture_service.goToPosture("StandInit", 1.0)
    posture_service.goToPosture("SitRelax", 1.0)
    posture_service.goToPosture("StandZero", 1.0)
    posture_service.goToPosture("LyingBelly", 1.0)
    posture_service.goToPosture("LyingBack", 1.0)
    posture_service.goToPosture("Stand", 1.0)
    posture_service.goToPosture("Crouch", 1.0)
    posture_service.goToPosture("Sit", 1.0)

    print posture_service.getPostureFamily()


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--ip", type=str, default="127.0.0.1",
                        help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
    parser.add_argument("--port", type=int, default=9559,
                        help="Naoqi port number")

    args = parser.parse_args()
    session = qi.Session()
    try:
        session.connect("tcp://" + args.ip + ":" + str(args.port))
    except RuntimeError:
        print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
               "Please check your script arguments. Run with -h option for help.")
        sys.exit(1)
    main(session)