HAPTIX API

Data Structures | Macros | Enumerations | Functions
haptix_sim.h File Reference

This file defines data structures and API functions available only in simulation. More...

#include "haptix.h"
Include dependency graph for haptix_sim.h:

Go to the source code of this file.

Data Structures

struct  hxsColor
 A 4-tuple representing a color in RGBA space. More...
 
struct  hxsContactPoint
 Information about a contact point. More...
 
struct  hxsContactPoints
 Information about contacts. More...
 
struct  hxsJoint
 Information about a joint. A joint is a component of a model. More...
 
struct  hxsLink
 Information about a link. A link is a component of a model. More...
 
struct  hxsModel
 Information about a model. More...
 
struct  hxsQuaternion
 A quaternion. More...
 
struct  hxsSimInfo
 Simulation information. More...
 
struct  hxsTransform
 A translation and orientation constructed of a hxVector3 and hxQuaternion. More...
 
struct  hxsVector3
 A three-tuple vector. More...
 
struct  hxsWrench
 

Macros

#define hxsMAXCONTACT   200
 Maximum number of contacts. More...
 
#define hxsMAXJOINTS   50
 Maximum number of joints per model. More...
 
#define hxsMAXLINKS   100
 Maximum number of links per model. More...
 
#define hxsMAXMODELS   50
 Maximum number of models per simulation. More...
 
#define hxsMAXNAMESIZE   100
 Maximum number of characters allowed per name. More...
 

Enumerations

enum  hxsCollideMode { hxsNOCOLLIDE, hxsDETECTIONONLY, hxsCOLLIDE }
 

Functions

hxResult hxs_add_constraint (const char *_sdf, const char *_model)
 Dynamically add constraint between two links during runtime. More...
 
hxResult hxs_add_model (const char *_sdf, const char *_name, float _x, float _y, float _z, float _roll, float _pitch, float _yaw, int _gravity_mode, hxsModel *_model)
 Add model during runtime. More...
 
hxResult hxs_angular_velocity (const char *_name, hxsVector3 *_ang_vel)
 Get the angular velocity of a model. More...
 
hxResult hxs_apply_force (const char *_modelName, const char *_linkName, const hxsVector3 *_force, const float _duration)
 Apply force to a link. More...
 
hxResult hxs_apply_torque (const char *_modelName, const char *_linkName, const hxsVector3 *_torque, const float _duration)
 Apply torque to a link. More...
 
hxResult hxs_apply_wrench (const char *_modelName, const char *_linkName, const hxsWrench *_wrench, const float _duration)
 Apply a wrench to a link. More...
 
hxResult hxs_camera_transform (hxsTransform *_transform)
 Get information about the simulation camera. More...
 
hxResult hxs_contacts (const char *_model, hxsContactPoints *_contact)
 Get information about active contacts for a model. More...
 
hxResult hxs_is_logging (int *_result)
 Determine if logging is running. More...
 
hxResult hxs_linear_velocity (const char *_name, hxsVector3 *_velocity)
 Get the linear velocity of a model. More...
 
hxResult hxs_model_collide_mode (const char *_model, hxsCollideMode *_collide_mode)
 Get the collide mode of the object. More...
 
hxResult hxs_model_color (const char *_model, hxsColor *_color)
 Get the color of the model. More...
 
hxResult hxs_model_gravity_mode (const char *_name, int *_gravity_mode)
 Get whether or not this model is affected by gravity. More...
 
hxResult hxs_model_joint_state (const char *_model, hxsModel *_state)
 Get simulation state (position and velocity) of joint named "_joint" in model "_model". More...
 
hxResult hxs_model_transform (const char *_name, hxsTransform *_transform)
 Get model transform (position and orientation in the global coordinate frame). More...
 
hxResult hxs_remove_constraint (const char *_name, const char *_model)
 Remove constraint. More...
 
hxResult hxs_remove_model (const char *_name)
 Remove model. More...
 
hxResult hxs_reset (int _resetLimbPose)
 Send world reset command/Carry over limb pose between world reset. More...
 
hxResult hxs_set_angular_velocity (const char *_name, const hxsVector3 *_ang_vel)
 Set the angular velocity of a model. More...
 
hxResult hxs_set_camera_transform (const hxsTransform *_transform)
 Set camera transform. More...
 
hxResult hxs_set_linear_velocity (const char *_name, const hxsVector3 *_velocity)
 Set the linear velocity of a model. More...
 
hxResult hxs_set_model_collide_mode (const char *_model, const hxsCollideMode *_collide_mode)
 Set the collide mode of the object. More...
 
hxResult hxs_set_model_color (const char *_model, const hxsColor *_color)
 Set the color of the model. More...
 
hxResult hxs_set_model_gravity_mode (const char *_name, const int _gravity_mode)
 Set whether or not this model is affected by gravity. More...
 
hxResult hxs_set_model_joint_state (const char *_model, const char *_joint, float _pos, float _vel)
 Set simulation state (position and velocity) of joint named "_joint" in model "_model" to the desired position and velocity. More...
 
hxResult hxs_set_model_transform (const char *_name, const hxsTransform *_transform)
 Set model transform (position and orientation in the global coordinate frame). More...
 
hxResult hxs_sim_info (hxsSimInfo *_siminfo)
 Get simulation information. More...
 
hxResult hxs_start_logging (const char *_dirname)
 Start recording log file. More...
 
hxResult hxs_stop_logging ()
 Stop recording log file. More...
 

Detailed Description

This file defines data structures and API functions available only in simulation.

Macro Definition Documentation

#define hxsMAXCONTACT   200

Maximum number of contacts.

#define hxsMAXJOINTS   50

Maximum number of joints per model.

#define hxsMAXLINKS   100

Maximum number of links per model.

#define hxsMAXMODELS   50

Maximum number of models per simulation.

#define hxsMAXNAMESIZE   100

Maximum number of characters allowed per name.

Function Documentation

hxResult hxs_add_constraint ( const char *  _sdf,
const char *  _model 
)

Dynamically add constraint between two links during runtime.

Parameters
[in]_sdfSDF of the joint to be created.
[in]_modelName of parent model of the joint constraint.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_add_model ( const char *  _sdf,
const char *  _name,
float  _x,
float  _y,
float  _z,
float  _roll,
float  _pitch,
float  _yaw,
int  _gravity_mode,
hxsModel *  _model 
)

Add model during runtime.

Parameters
[in]_sdfSDF xml description of the model.
[in]_nameModel name.
[in]_xX position in global frame (m).
[in]_yY position in global frame (m).
[in]_zZ position in global frame (m).
[in]_rollRoll in global frame (radians).
[in]_pitchPitch in global frame (radians).
[in]_yawYaw in global frame (radians).
[in]_gravity_mode1 if the model is affected by gravity, 0 otherwise.
[out]_modelPointer to the new model.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_angular_velocity ( const char *  _name,
hxsVector3 *  _ang_vel 
)

Get the angular velocity of a model.

In the case of a model with multiple links, one of the link is designated as the canonical link of the model. We are returning the angular velocity of the canonical link's center of mass in the world frame.

Parameters
[in]_nameName of the model.
[out]_ang_velVelocity (rad/s).
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_apply_force ( const char *  _modelName,
const char *  _linkName,
const hxsVector3 *  _force,
const float  _duration 
)

Apply force to a link.

Parameters
[in]_modelNameName of the model containing the link.
[in]_linkNameName of the link.
[in]_forceForce (N).
[in]_durationDuration of the force application in seconds. Set to 0 for persistent duration.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_apply_torque ( const char *  _modelName,
const char *  _linkName,
const hxsVector3 *  _torque,
const float  _duration 
)

Apply torque to a link.

Parameters
[in]_modelNameName of the model containing the link.
[in]_linkNameName of the link.
[in]_torqueTorque (N-m).
[in]_durationDuration of the torque application in seconds. Set to 0 for persistent duration.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_apply_wrench ( const char *  _modelName,
const char *  _linkName,
const hxsWrench *  _wrench,
const float  _duration 
)

Apply a wrench to a link.

Parameters
[in]_modelNameName of the model containing the link.
[in]_linkNameName of the link.
[in]_wrenchWrench to apply.
[in]_durationDuration of the torque application in seconds. Set to 0 for persistent duration.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_camera_transform ( hxsTransform *  _transform)

Get information about the simulation camera.

Parameters
[out]_cameraInformation about the simulation camera.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_contacts ( const char *  _model,
hxsContactPoints *  _contact 
)

Get information about active contacts for a model.

Parameters
[in]_modelThe name of the model to query.
[out]_contactThe latest contact information.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_is_logging ( int *  _result)

Determine if logging is running.

Parameters
[out]_result1 if logging is running.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_linear_velocity ( const char *  _name,
hxsVector3 *  _velocity 
)

Get the linear velocity of a model.

In the case of a model with multiple links, one of the link is designated as the canonical link of the model. We are returning the linear velocity of the canonical link's center of mass in the world frame.

Parameters
[in]_nameName of the model.
[out]_velocityVelocity (m/s).
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_model_collide_mode ( const char *  _model,
hxsCollideMode *  _collide_mode 
)

Get the collide mode of the object.

Parameters
[in]_modelName of the model.
[out]_collide_modeThe collide mode of the object.
See also
hxsCollideMode
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_model_color ( const char *  _model,
hxsColor *  _color 
)

Get the color of the model.

Parameters
[in]_modelName of the model.
[out]_colorThe color of the model.
See also
hxColor
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_model_gravity_mode ( const char *  _name,
int *  _gravity_mode 
)

Get whether or not this model is affected by gravity.

Parameters
[in]_nameName of the model.
[in]_gravityIf 1, the model is affected by gravity. If 0, the model is free-floating.
hxResult hxs_model_joint_state ( const char *  _model,
hxsModel *  _state 
)

Get simulation state (position and velocity) of joint named "_joint" in model "_model".

Where state is defined by position and velocity.

Parameters
[in]_modelName of the model to set.
[out]_statea hxsModel data structure containing joints states.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_model_transform ( const char *  _name,
hxsTransform *  _transform 
)

Get model transform (position and orientation in the global coordinate frame).

Parameters
[in]_nameName of the model.
[out]_transformCurrent model transform.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_remove_constraint ( const char *  _name,
const char *  _model 
)

Remove constraint.

Parameters
[in]_nameName of the joint/constraint to be removed.
[in]_modelName of parent model of the joint constraint.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_remove_model ( const char *  _name)

Remove model.

Parameters
[in]_nameName of the model.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_reset ( int  _resetLimbPose)

Send world reset command/Carry over limb pose between world reset.

Parameters
[in]_resetLimbPoseNon-zero to reset the pose of the limb.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_angular_velocity ( const char *  _name,
const hxsVector3 *  _ang_vel 
)

Set the angular velocity of a model.

This function does not support models with multiple links, unexpected behavior will result from using this function with a multi-link model. For a model with single link, this function call sets the angular velocity of the link at its center of mass in the world frame.

Parameters
[in]_nameName of the model.
[in]_ang_velVelocity (rad/s).
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_camera_transform ( const hxsTransform *  _transform)

Set camera transform.

Parameters
[in]_transformNew camera transform.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_linear_velocity ( const char *  _name,
const hxsVector3 *  _velocity 
)

Set the linear velocity of a model.

In the case of a model with multiple links, we are setting the linear velocity of all links center of mass in the world frame.

Parameters
[in]_nameName of the model.
[in]_velocityVelocity (m/s).
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_model_collide_mode ( const char *  _model,
const hxsCollideMode *  _collide_mode 
)

Set the collide mode of the object.

Parameters
[in]_modelName of the model.
[in]_collide_modeThe collide mode of the object.
See also
hxCollideMode
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_model_color ( const char *  _model,
const hxsColor *  _color 
)

Set the color of the model.

Parameters
[in]_modelName of the model.
[in]_colorThe color to set.
See also
hxsColor
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_model_gravity_mode ( const char *  _name,
const int  _gravity_mode 
)

Set whether or not this model is affected by gravity.

Parameters
[in]_nameName of the model.
[in]_gravityIf 1, the model is affected by gravity. If 0, the model is free-floating.
hxResult hxs_set_model_joint_state ( const char *  _model,
const char *  _joint,
float  _pos,
float  _vel 
)

Set simulation state (position and velocity) of joint named "_joint" in model "_model" to the desired position and velocity.

The acceleration, torque, and reaction wrench of the joint may change based on the constraints of model's dynamic system.

Parameters
[in]_modelName of the model to set.
[in]_jointName of the joint to set.
[in]_posDesired position of the joint.
[in]_velDesired velocity of the joint.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_set_model_transform ( const char *  _name,
const hxsTransform *  _transform 
)

Set model transform (position and orientation in the global coordinate frame).

Parameters
[in]_nameName of the model.
[in]_transformNew model transform.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_sim_info ( hxsSimInfo *  _siminfo)

Get simulation information.

Parameters
[out]_siminfoSimulation information requested.
See also
_hxsSimInfo
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_start_logging ( const char *  _dirname)

Start recording log file.

Only one log file may be recorded at a time.

Parameters
[in]_dirnamePath to the directory where the log file is created.
Returns
'hxOK' if the function succeed or an error code otherwise.
hxResult hxs_stop_logging ( )

Stop recording log file.

Returns
'hxOK' if the function succeed or an error code otherwise.