# ALRobotPosture API¶

Overview | API

Namespace : AL


#include <alproxies/alrobotpostureproxy.h>



## Method list ¶

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class ALRobotPostureProxy

## Methods ¶

std::vector<std::string> ALRobotPostureProxy::getPostureList()

Returns a vector with all predefined postures.

Returns: A vector with all predefined postures.
std::string ALRobotPostureProxy::getPosture()

Returns the name of the current predefined postures. If the current posture is not in the predefined postures, it returns “Unknown”.

Returns: A string with the name of the current posture.
bool ALRobotPostureProxy::goToPosture(const std::string postureName, const float speed)

Makes the robot go to the predefined posture asked in parameter. It is possible to modify the speed of the move. The move is “intelligent”: it will start from beginning posture of the robot, and choose all the steps to reach the asked posture.

This is a blocking call. Use a post if you want to make it non-blocking.

Parameters: postureName – Name of the predefined posture to be reached. See: Predefined postures. speed – Relative speed between 0.0 and 1.0. Returns if the predefined posture was reached.
bool ALRobotPostureProxy::applyPosture(const std::string& postureName, const float& speed)

Set all the joints of the robot in the configuration of the asked predefined posture.

Use applyPosture for animation purposes when manipulating the robot. Consider it has a shortcut, in case you want to reach quickly a posture. The robot will need user’s help to reach the posture.

The effect is immediate and there is no intelligence in it so be careful when using set posture. For example if the robot is sitting and you ask for setPosture(“StandInit”, 1.0) it can be dangerous for the robot, it will fall if you do not help it to stand up.

If you want the robot to stand up alone, use ALRobotPostureProxy::goToPosture().

This is a blocking call. Please use a post if you want to make it non-blocking.

Parameters: postureName – Name of the predefined posture to be reached. See: Predefined postures. speed – Relative speed between 0.0 and 1.0. Returns if the predefined posture was reached.
void ALRobotPostureProxy::stopMove()

Stop the current posture interpolation.

std::string ALRobotPostureProxy::getPostureFamily()

Returns the Posture family. For further details, see: Posture family.

Returns: Returns the name of the current posture family.
std::vector<std::string> ALRobotPostureProxy::getPostureFamilyList()

Returns a vector with all predefined postures families.

Returns: A vector with all predefined postures families.
void ALRobotPostureProxy::setMaxTryNumber(const int& maxTryNumber)

Sets the maximum number of tries performed by ALRobotPostureProxy::goToPosture() before returning a fail.

Parameters: maxTryNumber – number of tries, default value: 3.

## Events ¶

Event: "PostureFamilyChanged"
callback(std::string eventName, std::string PostureFamily, std::string subscriberIdentifier)

Raises the name of the Posture family when it changes.

The update frequency of the event is about 1 second.

Event: "PostureChanged"
callback(std::string eventName, std::string Posture, std::string subscriberIdentifier)

Raises the name of the Posture when it changes.

The update frequency of the event is about 1 second.