HAPTIX API

 All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
Data Structures | Macros | Enumerations | Functions
haptix.h File Reference

Structures and functions for the primary HAPTIX API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hxCommand
 Motor command data. More...
 
struct  hxRobotInfo
 Robot information. More...
 
struct  hxSensor
 Sensor data. More...
 
struct  hxTime
 A representation of time. More...
 

Macros

#define hxMAXCONTACTSENSOR   32
 Maximum number of contact sensors. More...
 
#define hxMAXIMU   32
 Maximum number of IMUs. More...
 
#define hxMAXJOINT   32
 Maximum number of joints. More...
 
#define hxMAXMOTOR   32
 Maximum number of motors. More...
 

Enumerations

enum  hxResult { hxOK = 0, hxERROR }
 API return codes. More...
 

Functions

hxResult hx_close ()
 Close connection to a robot or simulator. More...
 
hxResult hx_connect (const char *_host, int _port)
 Connect to a robot or simulator. More...
 
const char * hx_last_result ()
 Return a string that describes the last result. More...
 
hxResult hx_read_sensors (hxSensor *_sensor)
 Similar to hx_update, this function reads the latest sensor information from the robot in a non-blocking manner. More...
 
hxResult hx_robot_info (hxRobotInfo *_robotinfo)
 Get information for a specified robot or simulator. More...
 
hxResult hx_update (const hxCommand *_command, hxSensor *_sensor)
 A non-blocking function that sends a command to the robot and receives the latest sensor information. More...
 

Detailed Description

Structures and functions for the primary HAPTIX API.

Macro Definition Documentation

#define hxMAXCONTACTSENSOR   32

Maximum number of contact sensors.

Defines the maximum number of contact sensors across any particular robot. It is used when allocating an hxSensor.contact object. The number of contact sensors for a particular robot is defined in _hxRobotInfo.

#define hxMAXIMU   32

Maximum number of IMUs.

Defines the maximum number of inertial measurement units across any particular robot. It is used when allocating sensor objects related to IMUs. The number of IMUs for a particular robot is defined in _hxRobotInfo.

#define hxMAXJOINT   32

Maximum number of joints.

Defines the maximum number of joints across any particular robot. It is used when allocating sensor properties related to the joints. number of joints for a particular robot is defined in _hxRobotInfo.

#define hxMAXMOTOR   32

Maximum number of motors.

Defines the maximum number of motors across any particular robot. It is used when allocating sensor and command objects related to the motors. The number of motors for a particular robot is defined in _hxRobotInfo.

Enumeration Type Documentation

enum hxResult

API return codes.

These return codes are used to specify the outcome of a haptix-comm function (e.g. success or failure).

Enumerator
hxOK 

success

hxERROR 

failure

Function Documentation

hxResult hx_close ( )

Close connection to a robot or simulator.

Returns
'hxOK' if the disconnection succeed or an error code otherwise.
hxResult hx_connect ( const char *  _host,
int  _port 
)

Connect to a robot or simulator.

Use this function if you want to connect to a specific host and port.

Parameters
[in]_hostWhen connecting to a simulator, use _host to specify the machine that is running the simulator. Use a value of NULL to perform automatic discovery.
[in]_portWhen connecting to a simulator, use _port to specify what port the simulator is running on. If _host is NULL, then _port is ignored.
Returns
'hxOK' if the connection succeed or an error code otherwise.
const char* hx_last_result ( )

Return a string that describes the last result.

See also
hxResult.
Returns
String that describes the last result.
hxResult hx_read_sensors ( hxSensor *  _sensor)

Similar to hx_update, this function reads the latest sensor information from the robot in a non-blocking manner.

This function may be called as often as desired, but the robot is only guaranteeed to update at a minimum of 50Hz. Return sensor data.

Parameters
[out]_sensorSensor data received after the update.
Returns
'hxOK' if the operation succeed or an error code otherwise.
hxResult hx_robot_info ( hxRobotInfo *  _robotinfo)

Get information for a specified robot or simulator.

Parameters
[out]_robotInfoRobot information requested. See _hxRobotInfo for a list of available fields.
Returns
'hxOK' if the operation succeed or an error code otherwise.
hxResult hx_update ( const hxCommand *  _command,
hxSensor *  _sensor 
)

A non-blocking function that sends a command to the robot and receives the latest sensor information.

This function may be used as frequently as desired, but the robot is only guaranteed to update at a minimum of 50Hz.

Parameters
[in]_commandNew command to be sent. See _hxCommand for the full description of fields contained in a command request.
[out]_sensorSensor data received after the update. See _hxSensor for the full description of fields contained the state response.
Returns
'hxOK' if the operation succeed or an error code otherwise.