2015-09-17 06:09:10 +00:00
|
|
|
#ifndef SHARED_MEMORY_PUBLIC_H
|
|
|
|
#define SHARED_MEMORY_PUBLIC_H
|
|
|
|
|
|
|
|
#define SHARED_MEMORY_KEY 12347
|
|
|
|
|
|
|
|
enum EnumSharedMemoryClientCommand
|
|
|
|
{
|
2016-06-04 02:03:56 +00:00
|
|
|
CMD_LOAD_SDF,
|
|
|
|
CMD_LOAD_URDF,
|
2016-11-11 22:44:50 +00:00
|
|
|
CMD_LOAD_BULLET,
|
|
|
|
CMD_SAVE_BULLET,
|
|
|
|
CMD_LOAD_MJCF,
|
2016-10-17 20:01:04 +00:00
|
|
|
CMD_LOAD_BUNNY,
|
2016-11-12 02:07:42 +00:00
|
|
|
CMD_SEND_BULLET_DATA_STREAM,
|
|
|
|
CMD_CREATE_BOX_COLLISION_SHAPE,
|
|
|
|
CMD_CREATE_RIGID_BODY,
|
|
|
|
CMD_DELETE_RIGID_BODY,
|
|
|
|
CMD_CREATE_SENSOR,///enable or disable joint feedback for force/torque sensors
|
|
|
|
CMD_INIT_POSE,
|
|
|
|
CMD_SEND_PHYSICS_SIMULATION_PARAMETERS,
|
|
|
|
CMD_SEND_DESIRED_STATE,//todo: reconsider naming, for example SET_JOINT_CONTROL_VARIABLE?
|
|
|
|
CMD_REQUEST_ACTUAL_STATE,
|
|
|
|
CMD_REQUEST_DEBUG_LINES,
|
2016-06-15 01:41:19 +00:00
|
|
|
CMD_REQUEST_BODY_INFO,
|
2016-11-05 00:06:55 +00:00
|
|
|
CMD_REQUEST_INTERNAL_DATA,
|
2015-09-17 06:09:10 +00:00
|
|
|
CMD_STEP_FORWARD_SIMULATION,
|
|
|
|
CMD_RESET_SIMULATION,
|
2015-09-25 05:42:22 +00:00
|
|
|
CMD_PICK_BODY,
|
|
|
|
CMD_MOVE_PICKED_BODY,
|
|
|
|
CMD_REMOVE_PICKING_CONSTRAINT_BODY,
|
2016-05-18 06:57:19 +00:00
|
|
|
CMD_REQUEST_CAMERA_IMAGE_DATA,
|
2016-06-27 01:18:30 +00:00
|
|
|
CMD_APPLY_EXTERNAL_FORCE,
|
2016-08-10 01:40:12 +00:00
|
|
|
CMD_CALCULATE_INVERSE_DYNAMICS,
|
2016-08-30 21:44:11 +00:00
|
|
|
CMD_CALCULATE_INVERSE_KINEMATICS,
|
2016-09-07 23:00:38 +00:00
|
|
|
CMD_CALCULATE_JACOBIAN,
|
2016-11-14 22:08:05 +00:00
|
|
|
CMD_USER_CONSTRAINT,
|
2016-09-01 20:30:07 +00:00
|
|
|
CMD_REQUEST_CONTACT_POINT_INFORMATION,
|
2016-12-27 03:40:09 +00:00
|
|
|
CMD_REQUEST_RAY_CAST_INTERSECTIONS,
|
|
|
|
|
2016-11-10 19:22:22 +00:00
|
|
|
CMD_REQUEST_AABB_OVERLAP,
|
2016-12-27 03:40:09 +00:00
|
|
|
|
2016-10-13 06:03:36 +00:00
|
|
|
CMD_SAVE_WORLD,
|
2016-10-19 05:05:28 +00:00
|
|
|
CMD_REQUEST_VISUAL_SHAPE_INFO,
|
2016-10-20 17:56:44 +00:00
|
|
|
CMD_UPDATE_VISUAL_SHAPE,
|
2016-10-21 06:40:30 +00:00
|
|
|
CMD_LOAD_TEXTURE,
|
2016-11-29 21:19:35 +00:00
|
|
|
CMD_SET_SHADOW,
|
2016-11-14 15:39:34 +00:00
|
|
|
CMD_USER_DEBUG_DRAW,
|
2016-12-27 03:40:09 +00:00
|
|
|
CMD_REQUEST_VR_EVENTS_DATA,
|
2016-09-01 20:30:07 +00:00
|
|
|
//don't go beyond this command!
|
2016-08-23 01:14:29 +00:00
|
|
|
CMD_MAX_CLIENT_COMMANDS,
|
2016-09-01 20:30:07 +00:00
|
|
|
|
2015-09-17 06:09:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum EnumSharedMemoryServerStatus
|
|
|
|
{
|
|
|
|
CMD_SHARED_MEMORY_NOT_INITIALIZED=0,
|
|
|
|
CMD_WAITING_FOR_CLIENT_COMMAND,
|
|
|
|
//CMD_CLIENT_COMMAND_COMPLETED is a generic 'completed' status that doesn't need special handling on the client
|
|
|
|
CMD_CLIENT_COMMAND_COMPLETED,
|
|
|
|
//the server will skip unknown command and report a status 'CMD_UNKNOWN_COMMAND_FLUSHED'
|
|
|
|
CMD_UNKNOWN_COMMAND_FLUSHED,
|
2016-06-04 02:03:56 +00:00
|
|
|
CMD_SDF_LOADING_COMPLETED,
|
|
|
|
CMD_SDF_LOADING_FAILED,
|
2015-09-17 06:09:10 +00:00
|
|
|
CMD_URDF_LOADING_COMPLETED,
|
|
|
|
CMD_URDF_LOADING_FAILED,
|
2016-11-12 02:07:42 +00:00
|
|
|
CMD_BULLET_LOADING_COMPLETED,
|
|
|
|
CMD_BULLET_LOADING_FAILED,
|
|
|
|
CMD_BULLET_SAVING_COMPLETED,
|
|
|
|
CMD_BULLET_SAVING_FAILED,
|
|
|
|
CMD_MJCF_LOADING_COMPLETED,
|
|
|
|
CMD_MJCF_LOADING_FAILED,
|
2016-11-05 00:06:55 +00:00
|
|
|
CMD_REQUEST_INTERNAL_DATA_COMPLETED,
|
|
|
|
CMD_REQUEST_INTERNAL_DATA_FAILED,
|
2015-09-17 06:09:10 +00:00
|
|
|
CMD_BULLET_DATA_STREAM_RECEIVED_COMPLETED,
|
|
|
|
CMD_BULLET_DATA_STREAM_RECEIVED_FAILED,
|
|
|
|
CMD_BOX_COLLISION_SHAPE_CREATION_COMPLETED,
|
|
|
|
CMD_RIGID_BODY_CREATION_COMPLETED,
|
|
|
|
CMD_SET_JOINT_FEEDBACK_COMPLETED,
|
|
|
|
CMD_ACTUAL_STATE_UPDATE_COMPLETED,
|
|
|
|
CMD_ACTUAL_STATE_UPDATE_FAILED,
|
|
|
|
CMD_DEBUG_LINES_COMPLETED,
|
|
|
|
CMD_DEBUG_LINES_OVERFLOW_FAILED,
|
|
|
|
CMD_DESIRED_STATE_RECEIVED_COMPLETED,
|
|
|
|
CMD_STEP_FORWARD_SIMULATION_COMPLETED,
|
2016-05-20 01:37:15 +00:00
|
|
|
CMD_RESET_SIMULATION_COMPLETED,
|
|
|
|
CMD_CAMERA_IMAGE_COMPLETED,
|
|
|
|
CMD_CAMERA_IMAGE_FAILED,
|
2016-06-15 01:41:19 +00:00
|
|
|
CMD_BODY_INFO_COMPLETED,
|
|
|
|
CMD_BODY_INFO_FAILED,
|
2016-03-10 22:36:46 +00:00
|
|
|
CMD_INVALID_STATUS,
|
2016-08-10 01:40:12 +00:00
|
|
|
CMD_CALCULATED_INVERSE_DYNAMICS_COMPLETED,
|
|
|
|
CMD_CALCULATED_INVERSE_DYNAMICS_FAILED,
|
2016-09-07 23:00:38 +00:00
|
|
|
CMD_CALCULATED_JACOBIAN_COMPLETED,
|
|
|
|
CMD_CALCULATED_JACOBIAN_FAILED,
|
2016-09-01 20:30:07 +00:00
|
|
|
CMD_CONTACT_POINT_INFORMATION_COMPLETED,
|
|
|
|
CMD_CONTACT_POINT_INFORMATION_FAILED,
|
2016-11-10 19:22:22 +00:00
|
|
|
CMD_REQUEST_AABB_OVERLAP_COMPLETED,
|
|
|
|
CMD_REQUEST_AABB_OVERLAP_FAILED,
|
2016-09-08 22:15:58 +00:00
|
|
|
CMD_CALCULATE_INVERSE_KINEMATICS_COMPLETED,
|
|
|
|
CMD_CALCULATE_INVERSE_KINEMATICS_FAILED,
|
2016-10-13 06:03:36 +00:00
|
|
|
CMD_SAVE_WORLD_COMPLETED,
|
|
|
|
CMD_SAVE_WORLD_FAILED,
|
2016-10-19 05:05:28 +00:00
|
|
|
CMD_VISUAL_SHAPE_INFO_COMPLETED,
|
|
|
|
CMD_VISUAL_SHAPE_INFO_FAILED,
|
2016-10-20 17:56:44 +00:00
|
|
|
CMD_VISUAL_SHAPE_UPDATE_COMPLETED,
|
|
|
|
CMD_VISUAL_SHAPE_UPDATE_FAILED,
|
2016-10-21 06:40:30 +00:00
|
|
|
CMD_LOAD_TEXTURE_COMPLETED,
|
|
|
|
CMD_LOAD_TEXTURE_FAILED,
|
2016-11-14 15:39:34 +00:00
|
|
|
CMD_USER_DEBUG_DRAW_COMPLETED,
|
|
|
|
CMD_USER_DEBUG_DRAW_FAILED,
|
2016-11-14 22:08:05 +00:00
|
|
|
CMD_USER_CONSTRAINT_COMPLETED,
|
|
|
|
CMD_USER_CONSTRAINT_FAILED,
|
2016-12-27 03:40:09 +00:00
|
|
|
CMD_REQUEST_VR_EVENTS_DATA_COMPLETED,
|
|
|
|
CMD_REQUEST_RAY_CAST_INTERSECTIONS_COMPLETED,
|
2016-10-19 05:05:28 +00:00
|
|
|
//don't go beyond 'CMD_MAX_SERVER_COMMANDS!
|
2015-09-17 06:09:10 +00:00
|
|
|
CMD_MAX_SERVER_COMMANDS
|
|
|
|
};
|
|
|
|
|
|
|
|
enum JointInfoFlags
|
|
|
|
{
|
|
|
|
JOINT_HAS_MOTORIZED_POWER=1,
|
|
|
|
};
|
2015-10-27 21:55:46 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
COLLISION_SHAPE_TYPE_BOX=1,
|
|
|
|
COLLISION_SHAPE_TYPE_CYLINDER_X,
|
|
|
|
COLLISION_SHAPE_TYPE_CYLINDER_Y,
|
|
|
|
COLLISION_SHAPE_TYPE_CYLINDER_Z,
|
|
|
|
COLLISION_SHAPE_TYPE_CAPSULE_X,
|
|
|
|
COLLISION_SHAPE_TYPE_CAPSULE_Y,
|
|
|
|
COLLISION_SHAPE_TYPE_CAPSULE_Z,
|
|
|
|
COLLISION_SHAPE_TYPE_SPHERE
|
|
|
|
};
|
|
|
|
|
2015-11-23 04:50:32 +00:00
|
|
|
// copied from btMultiBodyLink.h
|
|
|
|
enum JointType {
|
2016-12-15 04:44:10 +00:00
|
|
|
eRevoluteType = 0,
|
|
|
|
ePrismaticType = 1,
|
|
|
|
eSphericalType = 2,
|
|
|
|
ePlanarType = 3,
|
|
|
|
eFixedType = 4,
|
|
|
|
ePoint2PointType = 5,
|
2015-11-23 04:50:32 +00:00
|
|
|
};
|
|
|
|
|
2015-09-17 06:09:10 +00:00
|
|
|
struct b3JointInfo
|
|
|
|
{
|
|
|
|
char* m_linkName;
|
|
|
|
char* m_jointName;
|
|
|
|
int m_jointType;
|
|
|
|
int m_qIndex;
|
|
|
|
int m_uIndex;
|
2015-09-25 05:42:22 +00:00
|
|
|
int m_jointIndex;
|
2015-09-17 06:09:10 +00:00
|
|
|
int m_flags;
|
2016-03-17 21:54:46 +00:00
|
|
|
double m_jointDamping;
|
|
|
|
double m_jointFriction;
|
2016-08-23 01:14:29 +00:00
|
|
|
double m_parentFrame[7]; // position and orientation (quaternion)
|
|
|
|
double m_childFrame[7]; // ^^^
|
|
|
|
double m_jointAxis[3]; // joint axis in parent local frame
|
2015-09-17 06:09:10 +00:00
|
|
|
};
|
|
|
|
|
2016-09-27 19:13:45 +00:00
|
|
|
struct b3BodyInfo
|
|
|
|
{
|
|
|
|
const char* m_baseName;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-25 05:42:22 +00:00
|
|
|
struct b3JointSensorState
|
|
|
|
{
|
|
|
|
double m_jointPosition;
|
|
|
|
double m_jointVelocity;
|
|
|
|
double m_jointForceTorque[6]; /* note to roboticists: this is NOT the motor torque/force, but the spatial reaction force vector at joint */
|
2016-04-19 19:22:38 +00:00
|
|
|
double m_jointMotorTorque;
|
2015-09-25 05:42:22 +00:00
|
|
|
};
|
|
|
|
|
2015-09-17 06:09:10 +00:00
|
|
|
struct b3DebugLines
|
|
|
|
{
|
|
|
|
int m_numDebugLines;
|
|
|
|
const float* m_linesFrom;//float x,y,z times 'm_numDebugLines'.
|
|
|
|
const float* m_linesTo;//float x,y,z times 'm_numDebugLines'.
|
|
|
|
const float* m_linesColor;//float red,green,blue times 'm_numDebugLines'.
|
|
|
|
};
|
|
|
|
|
2016-11-10 19:22:22 +00:00
|
|
|
struct b3OverlappingObject
|
|
|
|
{
|
|
|
|
int m_objectUniqueId;
|
|
|
|
int m_linkIndex;
|
|
|
|
};
|
|
|
|
|
2016-11-10 05:01:04 +00:00
|
|
|
struct b3AABBOverlapData
|
|
|
|
{
|
|
|
|
int m_numOverlappingObjects;
|
2016-11-10 19:22:22 +00:00
|
|
|
struct b3OverlappingObject* m_overlappingObjects;
|
2016-11-10 05:01:04 +00:00
|
|
|
};
|
|
|
|
|
2016-05-18 06:57:19 +00:00
|
|
|
struct b3CameraImageData
|
|
|
|
{
|
|
|
|
int m_pixelWidth;
|
|
|
|
int m_pixelHeight;
|
|
|
|
const unsigned char* m_rgbColorData;//3*m_pixelWidth*m_pixelHeight bytes
|
2016-08-12 20:55:37 +00:00
|
|
|
const float* m_depthValues;//m_pixelWidth*m_pixelHeight floats
|
2016-08-11 21:55:30 +00:00
|
|
|
const int* m_segmentationMaskValues;//m_pixelWidth*m_pixelHeight ints
|
2016-05-18 06:57:19 +00:00
|
|
|
};
|
|
|
|
|
2016-09-01 20:30:07 +00:00
|
|
|
|
2016-12-27 03:40:09 +00:00
|
|
|
enum b3VREventType
|
|
|
|
{
|
|
|
|
VR_CONTROLLER_MOVE_EVENT=1,
|
|
|
|
VR_CONTROLLER_BUTTON_EVENT
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_VR_BUTTONS 64
|
|
|
|
#define MAX_VR_CONTROLLERS 8
|
|
|
|
#define MAX_RAY_HITS 128
|
|
|
|
|
|
|
|
enum b3VRButtonInfo
|
|
|
|
{
|
|
|
|
eButtonIsDown = 1,
|
|
|
|
eButtonTriggered = 2,
|
|
|
|
eButtonReleased = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct b3VRControllerEvent
|
|
|
|
{
|
|
|
|
int m_controllerId;//valid for VR_CONTROLLER_MOVE_EVENT and VR_CONTROLLER_BUTTON_EVENT
|
|
|
|
int m_numMoveEvents;
|
|
|
|
int m_numButtonEvents;
|
|
|
|
|
|
|
|
float m_pos[4];//valid for VR_CONTROLLER_MOVE_EVENT and VR_CONTROLLER_BUTTON_EVENT
|
|
|
|
float m_orn[4];//valid for VR_CONTROLLER_MOVE_EVENT and VR_CONTROLLER_BUTTON_EVENT
|
|
|
|
|
|
|
|
float m_analogAxis;//valid if VR_CONTROLLER_MOVE_EVENT
|
|
|
|
|
|
|
|
int m_buttons[MAX_VR_BUTTONS];//valid if VR_CONTROLLER_BUTTON_EVENT, see b3VRButtonInfo
|
|
|
|
};
|
|
|
|
|
|
|
|
struct b3VREventsData
|
|
|
|
{
|
|
|
|
int m_numControllerEvents;
|
|
|
|
struct b3VRControllerEvent* m_controllerEvents;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-01 20:30:07 +00:00
|
|
|
struct b3ContactPointData
|
|
|
|
{
|
2016-09-02 01:28:39 +00:00
|
|
|
//todo: expose some contact flags, such as telling which fields below are valid
|
|
|
|
int m_contactFlags;
|
2016-09-01 20:30:07 +00:00
|
|
|
int m_bodyUniqueIdA;
|
|
|
|
int m_bodyUniqueIdB;
|
|
|
|
int m_linkIndexA;
|
|
|
|
int m_linkIndexB;
|
|
|
|
double m_positionOnAInWS[3];//contact point location on object A, in world space coordinates
|
|
|
|
double m_positionOnBInWS[3];//contact point location on object A, in world space coordinates
|
|
|
|
double m_contactNormalOnBInWS[3];//the separating contact normal, pointing from object B towards object A
|
|
|
|
double m_contactDistance;//negative number is penetration, positive is distance.
|
2016-09-02 01:28:39 +00:00
|
|
|
|
2016-09-01 20:30:07 +00:00
|
|
|
double m_normalForce;
|
2016-09-02 01:28:39 +00:00
|
|
|
|
|
|
|
//todo: expose the friction forces as well
|
|
|
|
// double m_linearFrictionDirection0[3];
|
|
|
|
// double m_linearFrictionForce0;
|
|
|
|
// double m_linearFrictionDirection1[3];
|
|
|
|
// double m_linearFrictionForce1;
|
|
|
|
// double m_angularFrictionDirection[3];
|
|
|
|
// double m_angularFrictionForce;
|
2016-09-01 20:30:07 +00:00
|
|
|
};
|
|
|
|
|
2016-11-10 05:01:04 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CONTACT_QUERY_MODE_REPORT_EXISTING_CONTACT_POINTS = 0,
|
|
|
|
CONTACT_QUERY_MODE_COMPUTE_CLOSEST_POINTS = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-02 01:28:39 +00:00
|
|
|
|
2016-09-01 20:30:07 +00:00
|
|
|
struct b3ContactInformation
|
|
|
|
{
|
|
|
|
int m_numContactPoints;
|
|
|
|
struct b3ContactPointData* m_contactPointData;
|
|
|
|
};
|
|
|
|
|
2016-12-27 03:40:09 +00:00
|
|
|
struct b3RayHitInfo
|
|
|
|
{
|
|
|
|
double m_hitFraction;
|
|
|
|
int m_hitObjectUniqueId;
|
|
|
|
int m_hitObjectLinkIndex;
|
|
|
|
double m_hitPositionWorld[3];
|
|
|
|
double m_hitNormalWorld[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct b3RaycastInformation
|
|
|
|
{
|
|
|
|
int m_numRayHits;
|
|
|
|
struct b3RayHitInfo* m_rayHits;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-10-19 05:05:28 +00:00
|
|
|
#define VISUAL_SHAPE_MAX_PATH_LEN 128
|
|
|
|
|
|
|
|
struct b3VisualShapeData
|
|
|
|
{
|
|
|
|
int m_objectUniqueId;
|
|
|
|
int m_linkIndex;
|
|
|
|
int m_visualGeometryType;//box primitive, sphere primitive, triangle mesh
|
|
|
|
double m_dimensions[3];//meaning depends on m_visualGeometryType
|
|
|
|
char m_meshAssetFileName[VISUAL_SHAPE_MAX_PATH_LEN];
|
|
|
|
double m_localInertiaFrame[7];//pos[3], orn[4]
|
|
|
|
//todo: add more data if necessary (material color etc, although material can be in asset file .obj file)
|
2016-11-14 15:39:34 +00:00
|
|
|
double m_rgbaColor[4];
|
2016-10-19 05:05:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct b3VisualShapeInformation
|
|
|
|
{
|
|
|
|
int m_numVisualShapes;
|
|
|
|
struct b3VisualShapeData* m_visualShapeData;
|
|
|
|
};
|
|
|
|
|
2016-04-29 21:45:15 +00:00
|
|
|
///b3LinkState provides extra information such as the Cartesian world coordinates
|
|
|
|
///center of mass (COM) of the link, relative to the world reference frame.
|
|
|
|
///Orientation is a quaternion x,y,z,w
|
|
|
|
///Note: to compute the URDF link frame (which equals the joint frame at joint position 0)
|
|
|
|
///use URDF link frame = link COM frame * inertiaFrame.inverse()
|
2016-04-24 00:29:46 +00:00
|
|
|
struct b3LinkState
|
|
|
|
{
|
|
|
|
double m_worldPosition[3];
|
|
|
|
double m_worldOrientation[4];
|
2016-04-29 21:45:15 +00:00
|
|
|
|
|
|
|
double m_localInertialPosition[3];
|
|
|
|
double m_localInertialOrientation[4];
|
2016-04-24 00:29:46 +00:00
|
|
|
};
|
|
|
|
|
2015-09-17 06:09:10 +00:00
|
|
|
//todo: discuss and decide about control mode and combinations
|
|
|
|
enum {
|
|
|
|
// POSITION_CONTROL=0,
|
|
|
|
CONTROL_MODE_VELOCITY=0,
|
|
|
|
CONTROL_MODE_TORQUE,
|
|
|
|
CONTROL_MODE_POSITION_VELOCITY_PD,
|
|
|
|
};
|
|
|
|
|
2016-06-27 01:18:30 +00:00
|
|
|
///flags for b3ApplyExternalTorque and b3ApplyExternalForce
|
|
|
|
enum EnumExternalForceFlags
|
|
|
|
{
|
|
|
|
EF_LINK_FRAME=1,
|
|
|
|
EF_WORLD_FRAME=2,
|
|
|
|
};
|
2016-05-18 06:57:19 +00:00
|
|
|
|
2016-07-13 01:16:13 +00:00
|
|
|
///flags to pick the renderer for synthetic camera
|
|
|
|
enum EnumRenderer
|
|
|
|
{
|
|
|
|
ER_TINY_RENDERER=(1<<16),
|
|
|
|
ER_BULLET_HARDWARE_OPENGL=(1<<17),
|
|
|
|
//ER_FIRE_RAYS=(1<<18),
|
|
|
|
};
|
|
|
|
|
2015-09-17 06:09:10 +00:00
|
|
|
#endif//SHARED_MEMORY_PUBLIC_H
|