HAPTIX API

 All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
haptix.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
20 
21 #ifndef __HAPTIX_API_HAPTIX_H__
22 #define __HAPTIX_API_HAPTIX_H__
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 // ---------- constants ----------
29 
34 #define hxMAXMOTOR 32
35 
40 #define hxMAXJOINT 32
41 
48 #define hxMAXCONTACTSENSOR 32
49 
55 #define hxMAXIMU 32
56 
60 typedef enum
61 {
63  hxOK = 0,
66 } hxResult;
67 
68 // ---------- data structures ----------
69 
71 struct _hxTime
72 {
74  int sec;
75 
77  int nsec;
78 };
79 
82 typedef struct _hxTime hxTime;
83 
91 {
100 
109 
113 
119 
126 
133 
135  float update_rate;
136 };
137 
140 typedef struct _hxRobotInfo hxRobotInfo;
141 
147 struct _hxSensor
148 {
151  hxTime time_stamp;
152 
162 
170 
178 
185 
193 
199 
212 
225 
231 };
232 
235 typedef struct _hxSensor hxSensor;
236 
244 {
251 
256 
263 
268 
275 
280 
287 
292 };
293 
296 typedef struct _hxCommand hxCommand;
297 
298 // ---------- API functions ----------
299 
310 hxResult hx_connect(const char *_host, int _port);
311 
316 
321 hxResult hx_robot_info(hxRobotInfo *_robotinfo);
322 
332 hxResult hx_update(const hxCommand *_command, hxSensor *_sensor);
333 
341 hxResult hx_read_sensors(hxSensor *_sensor);
342 
346 const char *hx_last_result();
347 
348 #ifdef __cplusplus
349 }
350 #endif
351 #endif
Sensor data.
Definition: haptix.h:147
float gain_vel[32]
Target velocity feedback gains (Nms/rad).
Definition: haptix.h:286
float imu_angular_vel[32][3]
3D angular velocity (rad/s).
Definition: haptix.h:224
float motor_pos[32]
Motor position (rad).
Definition: haptix.h:161
float imu_orientation[32][4]
3D orientation quaternion.
Definition: haptix.h:230
hxResult hx_close()
Close connection to a robot or simulator.
A representation of time.
Definition: haptix.h:71
int gain_vel_enabled
A value <= 0 disables gain_vel, any other value enables gain_vel.
Definition: haptix.h:291
int motor_count
Number of motors.
Definition: haptix.h:99
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...
int nsec
Nanoseconds.
Definition: haptix.h:77
float joint_pos[32]
Joint position (rad).
Definition: haptix.h:184
hxTime time_stamp
Timestamp.
Definition: haptix.h:151
float joint_vel[32]
Joint velocity (rad/s).
Definition: haptix.h:192
success
Definition: haptix.h:63
Motor command data.
Definition: haptix.h:243
const char * hx_last_result()
Return a string that describes the last result.
float update_rate
Hz rate at which the robot will update.
Definition: haptix.h:135
int contact_sensor_count
Number of contact sensors.
Definition: haptix.h:112
int imu_count
Number of IMUs (inertial measurement units).
Definition: haptix.h:118
failure
Definition: haptix.h:65
int joint_count
Number of hinge joints.
Definition: haptix.h:108
int ref_pos_enabled
A value <= 0 disables ref_pos, any other value enables ref_pos.
Definition: haptix.h:255
float gain_pos[32]
Target position feedback gains (Nm/rad).
Definition: haptix.h:274
float contact[32]
Contact normal force (N).
Definition: haptix.h:198
#define hxMAXJOINT
Maximum number of joints.
Definition: haptix.h:40
float joint_limit[32][2]
Minimum and maximum joint angles (rad).
Definition: haptix.h:132
int gain_pos_enabled
A value <= 0 disables gain_pos, any other value enables gain_pos.
Definition: haptix.h:279
Robot information.
Definition: haptix.h:90
#define hxMAXIMU
Maximum number of IMUs.
Definition: haptix.h:55
float ref_pos[32]
Target reference positions (rad).
Definition: haptix.h:250
hxResult hx_robot_info(hxRobotInfo *_robotinfo)
Get information for a specified robot or simulator.
float motor_torque[32]
Torque applied by embedded controller (Nm).
Definition: haptix.h:177
float ref_vel_max[32]
Target reference velocities (rad/s).
Definition: haptix.h:262
hxResult hx_read_sensors(hxSensor *_sensor)
Similar to hx_update, this function reads the latest sensor information from the robot in a non-block...
int ref_vel_max_enabled
A value <= 0 disables ref_vel_max, any other value enables ref_vel_max.
Definition: haptix.h:267
float motor_vel[32]
Motor velocity (rad/s).
Definition: haptix.h:169
#define hxMAXMOTOR
Maximum number of motors.
Definition: haptix.h:34
hxResult
API return codes.
Definition: haptix.h:60
#define hxMAXCONTACTSENSOR
Maximum number of contact sensors.
Definition: haptix.h:48
hxResult hx_connect(const char *_host, int _port)
Connect to a robot or simulator.
int sec
Seconds.
Definition: haptix.h:74
float imu_linear_acc[32][3]
3D accelerometer output (m/s^2).
Definition: haptix.h:211
float motor_limit[32][2]
Minimum and maximum motor angles (rad).
Definition: haptix.h:125