![]() |
Atlas Behavior Library
1.0
|
The primary interface for the DRC version of the Atlas Robot. More...
#include <AtlasSimInterface.h>
The primary interface for the DRC version of the Atlas Robot.
Public Member Functions | |
AtlasErrorCode | process_control_input (const AtlasControlDataFromRobot &control_input, AtlasControlDataToRobot &control_output) |
Given control inputs and current behavior, calculate control outputs. | |
AtlasErrorCode | reset_control () |
Reset the behavior control. | |
AtlasErrorCode | set_desired_behavior (const std::string &behavior) |
Set the desired behavior of the sim. | |
AtlasErrorCode | get_desired_behavior (std::string &desired_behavior) |
Get the desired behavior of the sim. | |
AtlasErrorCode | get_current_behavior (std::string ¤t_behavior) |
Get the current behavior of the sim. | |
AtlasErrorCode | get_num_behaviors (int &num_behaviors) |
Get the number of available behaviors. | |
AtlasErrorCode | get_behavior_at_index (int index, std::string &behavior) |
Get the name of the behavior at a specified index. | |
AtlasErrorCode | get_behavior_joint_weights (const std::string &behavior, float joint_control_weights[NUM_JOINTS]) |
Get how much each joint is controlled by behavior calculations. | |
AtlasErrorCode | get_current_behavior_joint_weights (float joint_control_weights[NUM_JOINTS]) |
Get how much each joint is controlled by current behavior calculations. | |
std::string | get_error_code_text (AtlasErrorCode ec) |
Get string version of error code. | |
Parameter Functions | |
These functions are used to set some behavior parameters. The parameters and their meanings depend on the behavior. | |
AtlasErrorCode | set_behavior_parameter_1f (AtlasBehaviorParameterId parameter_id, float v) |
AtlasErrorCode | get_behavior_parameter_1f (AtlasBehaviorParameterId parameter_id, float &v) |
AtlasErrorCode | set_behavior_parameter_2f (AtlasBehaviorParameterId parameter_id, float v0, float v1) |
AtlasErrorCode | get_behavior_parameter_2f (AtlasBehaviorParameterId parameter_id, float &v0, float &v1) |
AtlasErrorCode | set_behavior_parameter_3f (AtlasBehaviorParameterId parameter_id, float v0, float v1, float v2) |
AtlasErrorCode | get_behavior_parameter_3f (AtlasBehaviorParameterId parameter_id, float &v0, float &v1, float &v2) |
AtlasErrorCode | set_behavior_parameter_quat (AtlasBehaviorParameterId parameter_id, const AtlasQuaternion &v) |
AtlasErrorCode | get_behavior_parameter_quat (AtlasBehaviorParameterId parameter_id, AtlasQuaternion &v) |
AtlasErrorCode AtlasSimInterface::process_control_input | ( | const AtlasControlDataFromRobot & | control_input, |
AtlasControlDataToRobot & | control_output | ||
) |
Given control inputs and current behavior, calculate control outputs.
This function will calculate control outputs that should be sent to the Atlas Robot simulation based on values passed in in the control_input object, and previously set behavior and related settings.
NOTE:* If an error is returned (e.g., the simulation is not in a behavior), the control output will not be valid!
[in] | control_input | - current state of sim |
[out] | control_output | - new desired state of sim gains and setpoints |
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::reset_control | ( | ) |
Reset the behavior control.
This function should be called if:
The next control data from the robot sim after reset will be taken as the initial conditions for a new simulation run.
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::set_desired_behavior | ( | const std::string & | behavior | ) |
Set the desired behavior of the sim.
This function will set the *desired* behavior of the Atlas Robot simulation.
There are a number of reasons the simulation may not be able to follow the desired behavior. For example, most desired behaviors will not be achievable if the robot has fallen. Also, it may take a little while for the robot to switch from its current behavior to the desired one.
Setting the desired behavior to "none" should immediately return all joint control to the performer.
Current supported behaviors should include:
All supported behaviors can be enumerated by calling get_num_behaviors() and get_behavior_at_index().
[in] | behavior | - name of desired behavior |
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::get_desired_behavior | ( | std::string & | desired_behavior | ) |
Get the desired behavior of the sim.
This function returns in the passed reference argument the desired behavior of the Atlas Robot simulation, as set by set_desired_behavior(). This might not be the actual behavior the robot is in; see set_desired_behavior() for more information.
[out] | desired_behavior | - string reference for returned desired behavior |
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::get_current_behavior | ( | std::string & | current_behavior | ) |
Get the current behavior of the sim.
This function returns in the passed reference argument the current behavior of the Atlas Robot simulation. See set_desired_behavior() for information on why the desired and current behaviors may not match.
This function should be called often to know when the Atlas Robot's current behavior has changed.
[out] | current_behavior | - string reference for returned current behavior |
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::get_num_behaviors | ( | int & | num_behaviors | ) |
Get the number of available behaviors.
Use with get_behavior_at_index() to enumberate the available behaviors.
[out] | num_behaviors | - int reference for returned number of behaviors |
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::get_behavior_at_index | ( | int | index, |
std::string & | behavior | ||
) |
Get the name of the behavior at a specified index.
Use with get_num_behaviors() to enumberate the available behaviors.
[in] | index | of behavior |
[out] | behavior | - string reference for returned behavior name |
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::get_behavior_joint_weights | ( | const std::string & | behavior, |
float | joint_control_weights[NUM_JOINTS] | ||
) |
Get how much each joint is controlled by behavior calculations.
This function returns how much each joint is controlled by behavior calculations for the specified behavior.
[in] | behavior | - name of behavior to check |
[out] | joint_control_weights | - array of weights of control by behavior |
Currently joints can be under only total control by performers (return value 0.0), or total control by the behavior (return value 1.0).
NO_ERROR on success, error code on failure
AtlasErrorCode AtlasSimInterface::get_current_behavior_joint_weights | ( | float | joint_control_weights[NUM_JOINTS] | ) |
Get how much each joint is controlled by current behavior calculations.
Similar to get_behavior_joint_weights(), but for current behavior.
std::string AtlasSimInterface::get_error_code_text | ( | AtlasErrorCode | ec | ) |
Get string version of error code.
AtlasErrorCode AtlasSimInterface::set_behavior_parameter_1f | ( | AtlasBehaviorParameterId | parameter_id, |
float | v | ||
) |
AtlasErrorCode AtlasSimInterface::get_behavior_parameter_1f | ( | AtlasBehaviorParameterId | parameter_id, |
float & | v | ||
) |
AtlasErrorCode AtlasSimInterface::set_behavior_parameter_2f | ( | AtlasBehaviorParameterId | parameter_id, |
float | v0, | ||
float | v1 | ||
) |
AtlasErrorCode AtlasSimInterface::get_behavior_parameter_2f | ( | AtlasBehaviorParameterId | parameter_id, |
float & | v0, | ||
float & | v1 | ||
) |
AtlasErrorCode AtlasSimInterface::set_behavior_parameter_3f | ( | AtlasBehaviorParameterId | parameter_id, |
float | v0, | ||
float | v1, | ||
float | v2 | ||
) |
AtlasErrorCode AtlasSimInterface::get_behavior_parameter_3f | ( | AtlasBehaviorParameterId | parameter_id, |
float & | v0, | ||
float & | v1, | ||
float & | v2 | ||
) |
AtlasErrorCode AtlasSimInterface::set_behavior_parameter_quat | ( | AtlasBehaviorParameterId | parameter_id, |
const AtlasQuaternion & | v | ||
) |
AtlasErrorCode AtlasSimInterface::get_behavior_parameter_quat | ( | AtlasBehaviorParameterId | parameter_id, |
AtlasQuaternion & | v | ||
) |
AtlasSimInterface* create_atlas_sim_interface | ( | ) | [friend] |
Create a simulation interface object.
This function creates an AtlasSimInterface object. It should not be called more than once. Multiple calls will return the same object.
The object should not be destroyed using delete, but instead by calling destroy_atlas_sim_interface().
void destroy_atlas_sim_interface | ( | ) | [friend] |
Destroy the simulation interface object created by create_atlas_sim_interface().