Shared library for use by V-REP (from Coppelia Robotics). More...
Classes | |
| struct | State |
| Data structure that contains an object state. More... | |
| struct | Device |
| Data structure that contains a haptic device handle and related state information. More... | |
| class | Object |
| Data structure that contains an object of type ObjectType used to generate haptic feedback. More... | |
Macros | |
| #define | CONCAT(x, y, z) x y z |
| #define | strConCat(x, y, z) CONCAT(x,y,z) |
| #define | LUA_START_COMMAND "simExtCHAI3D_start" |
| #define | LUA_RESET_COMMAND "simExtCHAI3D_reset" |
| #define | LUA_ADD_SHAPE_COMMAND "simExtCHAI3D_addShape" |
| #define | LUA_ADD_CONSTRAINT_POINT_COMMAND "simExtCHAI3D_addConstraintPoint" |
| #define | LUA_ADD_CONSTRAINT_SEGMENT_COMMAND "simExtCHAI3D_addConstraintSegment" |
| #define | LUA_ADD_CONSTRAINT_PLANE_COMMAND "simExtCHAI3D_addConstraintPlane" |
| #define | LUA_UPDATE_SHAPE_COMMAND "simExtCHAI3D_updateShape" |
| #define | LUA_UPDATE_CONSTRAINT_COMMAND "simExtCHAI3D_updateConstraint" |
| #define | LUA_REMOVE_OBJECT_COMMAND "simExtCHAI3D_removeObject" |
| #define | LUA_READ_POSITION_COMMAND "simExtCHAI3D_readPosition" |
| #define | LUA_READ_FORCE_COMMAND "simExtCHAI3D_readForce" |
| #define | LUA_READ_BUTTONS_COMMAND "simExtCHAI3D_readButtons" |
Enumerations | |
| enum | ObjectType { SHAPE, CONSTRAINT_POINT, CONSTRAINT_SEGMENT, CONSTRAINT_PLANE } |
| Types of haptic objects. More... | |
Functions | |
| int | addObject (Object *object) |
| Add generic object to the scene. More... | |
| bool | updateShape (int objectID, float pos[3], float rot[3], float stiffnessFactor) |
| Update the parameters of a SHAPE haptic object. More... | |
| bool | updateConstraint (int objectID, float pos[3], float dir[3], float Kp, float Kv, float Fmax) |
| Update the parameters of a constraint haptic object. More... | |
| bool | removeObject (int objectID) |
| Safely remove an object from the object list. More... | |
| bool | removeObject (Object *object) |
| Safely remove an object from the object list. More... | |
| void | hapticLoop () |
| Main haptic loop. More... | |
| void | hapticStart () |
| Start the haptic loop. More... | |
| void | hapticStop () |
| Stop the haptic loop. More... | |
| bool | hapticConnect (int deviceIndex, float toolRadius, float workspaceRadius) |
| bool | hapticDisconnect (int index) |
| Disconnect from haptic device. More... | |
| void | hapticReset () |
| Clean up the scene. More... | |
| void | LUA_START_CALLBACK (SLuaCallBack *p) |
| Connect to a haptic device. More... | |
| void | LUA_RESET_CALLBACK (SLuaCallBack *p) |
| Disconnect from a haptic device and reset the scene. More... | |
| void | LUA_ADD_SHAPE_CALLBACK (SLuaCallBack *p) |
| Add a SHAPE object to the scene. More... | |
| void | LUA_ADD_CONSTRAINT_POINT_CALLBACK (SLuaCallBack *p) |
| Add a CONSTRAINT_POINT object to the scene. More... | |
| void | LUA_ADD_CONSTRAINT_SEGMENT_CALLBACK (SLuaCallBack *p) |
| Add a CONSTRAINT_SEGMENT object to the scene. More... | |
| void | LUA_ADD_CONSTRAINT_PLANE_CALLBACK (SLuaCallBack *p) |
| Add a CONSTRAINT_PLANE object to the scene. More... | |
| void | LUA_UPDATE_SHAPE_CALLBACK (SLuaCallBack *p) |
| Update the parameters of a SHAPE haptic object. More... | |
| void | LUA_UPDATE_CONSTRAINT_CALLBACK (SLuaCallBack *p) |
| Update the parameters of a constraint haptic object. More... | |
| void | LUA_REMOVE_OBJECT_CALLBACK (SLuaCallBack *p) |
| Safely remove an object from the object list. More... | |
| void | LUA_READ_POSITION_CALLBACK (SLuaCallBack *p) |
Retrieve the current position of a haptic device (identified by its deviceIndex) in the scene. More... | |
| void | LUA_READ_FORCE_CALLBACK (SLuaCallBack *p) |
Retrieve the force currently displayed by a haptic device (identified by its deviceIndex). More... | |
| void | LUA_READ_BUTTONS_CALLBACK (SLuaCallBack *p) |
Retrieve a haptic device (identified by its deviceIndex) end-effector buttons status. More... | |
| VREP_DLLEXPORT unsigned char | v_repStart (void *reservedPointer, int reservedInt) |
| V-REP shared library initialization. More... | |
| VREP_DLLEXPORT void | v_repEnd () |
| V-REP shared library disconnect. More... | |
| VREP_DLLEXPORT void * | v_repMessage (int message, int *auxiliaryData, void *customData, int *replyData) |
| V-REP shared library message processing callback. More... | |
Please refer to the introduction for more information on how to use the CHAI3D plugin for V-REP.
| #define CONCAT | ( | x, | |
| y, | |||
| z | |||
| ) | x y z |
| #define strConCat | ( | x, | |
| y, | |||
| z | |||
| ) | CONCAT(x,y,z) |
| #define LUA_START_COMMAND "simExtCHAI3D_start" |
| #define LUA_RESET_COMMAND "simExtCHAI3D_reset" |
| #define LUA_ADD_SHAPE_COMMAND "simExtCHAI3D_addShape" |
| #define LUA_ADD_CONSTRAINT_POINT_COMMAND "simExtCHAI3D_addConstraintPoint" |
| #define LUA_ADD_CONSTRAINT_SEGMENT_COMMAND "simExtCHAI3D_addConstraintSegment" |
| #define LUA_ADD_CONSTRAINT_PLANE_COMMAND "simExtCHAI3D_addConstraintPlane" |
| #define LUA_UPDATE_SHAPE_COMMAND "simExtCHAI3D_updateShape" |
| #define LUA_UPDATE_CONSTRAINT_COMMAND "simExtCHAI3D_updateConstraint" |
| #define LUA_REMOVE_OBJECT_COMMAND "simExtCHAI3D_removeObject" |
| #define LUA_READ_POSITION_COMMAND "simExtCHAI3D_readPosition" |
| #define LUA_READ_FORCE_COMMAND "simExtCHAI3D_readForce" |
| #define LUA_READ_BUTTONS_COMMAND "simExtCHAI3D_readButtons" |
| enum ObjectType |
Each Object in the scene must be assigned one of the following types.
| Enumerator | |
|---|---|
| SHAPE |
Arbitrary 3D mesh object. |
| CONSTRAINT_POINT |
Constraint that holds the haptic device at a given point. The point is defined by State::Pos. |
| CONSTRAINT_SEGMENT |
Constraint that holds the haptic device on a given segment. The segment is defined by a point (State::Pos) and a vector (State::Dir). |
| CONSTRAINT_PLANE |
Constraint that holds the haptic device on a given plane. The plane is defined by a point (State::Pos) and a normal direction (State::Dir). |
| int addObject | ( | Object * | object | ) |
| bool updateShape | ( | int | objectID, |
| float | pos[3], | ||
| float | rot[3], | ||
| float | stiffnessFactor | ||
| ) |
| objectID | object identifier (returned by addObject). |
| pos | new target SHAPE target position, expressed in m. |
| rot | new target SHAPE orientation in the scene, expressed as ZYX extrinsic Euler angles. |
| stiffnessFactor | new target object stiffness factor (between 0.0 and 1.0). |
| bool updateConstraint | ( | int | objectID, |
| float | pos[3], | ||
| float | dir[3], | ||
| float | Kp, | ||
| float | Kv, | ||
| float | Fmax | ||
| ) |
| objectID | object identifier (returned by addObject). |
| pos | new constraint position in the scene, expressed in m. |
| dir | new constraint direction, as defined in ObjectType. |
| Kp | new constraint stiffness factor (between 0.0 and 1.0). |
| Kv | new constraint viscosity factor (between 0.0 and 1.0). |
| Fmax | new constraint max force for Kp, expressed in N. |
| bool removeObject | ( | int | objectID | ) |
| objectID | object identifier (returned by addObject). |
| bool removeObject | ( | Object * | object | ) |
| object | pointer to object to remove. |
| void hapticLoop | ( | ) |
The haptic loop runs in the background (with high priority) and renders all Objects haptically to all devices in the scene. Use hapticStart() to start the haptic loop, and hapticReset() to stop it.
| void hapticStart | ( | ) |
| void hapticStop | ( | ) |
| bool hapticConnect | ( | int | deviceIndex, |
| float | toolRadius, | ||
| float | workspaceRadius | ||
| ) |
\brief Connect to a haptic device and add it to the scene.
If successful, the device is added to the device list and will be controlled by the hapticLoop().
| deviceIndex | index of the device to open in the list of devices detected by the operating system. This is guaranteed to be the same between executions as long as no hardware changes occur. |
| toolRadius | radius of the haptic device proxy (tool) in the simulated scene, expressed in m. |
| workspaceRadius | radius of the simulated workspace that the physical device workspace must be scaled to, expressed in m. |
| bool hapticDisconnect | ( | int | index | ) |
This will remove all objects associated with this particular device, and will remove the device from the scene.
| index | index of the device to disconnect. This should be the same as the index given to hapticConnect(). |
| void hapticReset | ( | ) |
This function disconnects all devices and removes all objects from the scene.
| void LUA_START_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for hapticConnect().
The arguments parsed from the p buffer are passed on to hapticConnect(int deviceIndex, float toolRadius, float workspaceRadius).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_RESET_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for hapticReset().
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_ADD_SHAPE_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for addObject() and Object::Object().
The arguments parsed from the p buffer are passed on to Object::Object(float pos[3], float rot[3], vector<float>vertices, vector<int> indices, float stiffnessFactor).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_ADD_CONSTRAINT_POINT_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for addObject() and Object::Object().
The arguments parsed from the p buffer are passed on to Object::Object(ObjectType constraintType, int device, float pos[3], float dir[3], float Kp, float Kv, float Fmax).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_ADD_CONSTRAINT_SEGMENT_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for addObject() and Object::Object().
The arguments parsed from the p buffer are passed on to Object::Object(ObjectType constraintType, int device, float pos[3], float dir[3], float Kp, float Kv, float Fmax).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_ADD_CONSTRAINT_PLANE_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for addObject() and Object::Object().
The arguments parsed from the p buffer are passed on to Object::Object(ObjectType constraintType, int device, float pos[3], float dir[3], float Kp, float Kv, float Fmax).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_UPDATE_SHAPE_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for updateShape().
The arguments parsed from the p buffer are passed on to updateShape(int objectID, float pos[3], float rot[3], float stiffnessFactor).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_UPDATE_CONSTRAINT_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for updateShape().
The arguments parsed from the p buffer are passed on to updateConstraint(int objectID, float pos[3], float dir[3], float Kp, float Kv, float Fmax).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_REMOVE_OBJECT_CALLBACK | ( | SLuaCallBack * | p | ) |
This LUA callback is a wrapper for removeObject().
The arguments parsed from the p buffer are passed on to removeObject(int objectID).
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_READ_POSITION_CALLBACK | ( | SLuaCallBack * | p | ) |
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| void LUA_READ_FORCE_CALLBACK | ( | SLuaCallBack * | p | ) |
| void LUA_READ_BUTTONS_CALLBACK | ( | SLuaCallBack * | p | ) |
The buttons are returned in the form of an array of bit. A bit state of 1 indicates that the button at the given bit array index is pressed, 0 means it is not.
| p | SLuaCallBack I/O buffer. |
The corresponding LUA function is:
| VREP_DLLEXPORT unsigned char v_repStart | ( | void * | reservedPointer, |
| int | reservedInt | ||
| ) |
| VREP_DLLEXPORT void v_repEnd | ( | ) |
| VREP_DLLEXPORT void* v_repMessage | ( | int | message, |
| int * | auxiliaryData, | ||
| void * | customData, | ||
| int * | replyData | ||
| ) |
| bool SimulationRunning |
| cThread* HapticThread |
| cMutex* SimulationLock |
| cMutex* SceneLock |
| cMutex* ObjectLock |
| vector<Object*> Objects |
| cHapticDeviceHandler* DeviceHandler |
| cWorld* World |
| map<int,cGenericHapticDevicePtr> Devices |
| map<int,Device*> Cursors |
| cPrecisionClock Clock |
| double BiggestRadius = 0.0 |
| double LowestStiffness = -1.0 |
| LIBRARY vrepLib |
| const int inArgs_START[] |
| const int inArgs_RESET[] |
| const int inArgs_ADD_SHAPE[] |
| const int inArgs_ADD_CONSTRAINT_POINT[] |
| const int inArgs_ADD_CONSTRAINT_SEGMENT[] |
| const int inArgs_ADD_CONSTRAINT_PLANE[] |
| const int inArgs_UPDATE_SHAPE[] |
| const int inArgs_UPDATE_CONSTRAINT[] |
| const int inArgs_REMOVE_OBJECT[] |
| const int inArgs_READ_POSITION[] |
| const int inArgs_READ_FORCE[] |
| const int inArgs_READ_BUTTONS[] |