#include "CCallback.h"
Functions | |
int | OpenPhantom (int num) |
void | PhantomAccess (int access_type) |
void | ClosePhantoms () |
int | ResetPhantomEncoders (int num) |
int | StartCommunicationPhantom (int num) |
int | StopCommunicationPhantom (int num) |
int | ReadPositionPhantom (int num, double &iPosX, double &iPosY, double &iPosZ) |
int | ReadVelocityPhantom (int num, double &iVelX, double &iVelY, double &iVelZ) |
int | ReadNormalizedPositionPhantom (int num, double &iPosX, double &iPosY, double &iPosZ) |
int | SetForcePhantom (int num, const double &iForceX, const double &iForceY, const double &iForceZ) |
int | SetForceTorquePhantom (int num, const double &iForceX, const double &iForceY, const double &iForceZ, const double &iTorqueX, const double &iTorqueY, const double &iTorqueZ) |
int | ReadOrientMat3DOFPhantom (int num, double *m) |
int | ReadSwitchPhantom (int num) |
double | GetMaxForcePhantom (int num) |
double GetMaxForcePhantom(int num), reads what the max force is for Phantom num | |
int | GetWorkspaceScalePhantom (const int &num, double &scale) |
int | SetCallbackPhantom (void(*callbackFunc)(void *), void *a_data) |
Set up a callback for this device. Only supported by the HD library right now. |
void ClosePhantoms | ( | ) |
Last function to be called: closes all the phantoms. In case no phantom currently exists the value returned is negative, 1 in case of success.
double GetMaxForcePhantom | ( | int | num | ) |
double GetMaxForcePhantom(int num), reads what the max force is for Phantom num
double GetMaxForcePhantom(int num), reads what the max force is for Phantom num
num | Which Phantom should we be reading? |
int GetWorkspaceScalePhantom | ( | const int & | num, | |
double & | scale | |||
) |
Reads the scale factor from mm to normalized coordinates for Phantom num. Multiply normalized coordinates by this value to get back to mm.
num | handle to the phantom | |
scale | Returns the scale factor associated with this Phantom |
int OpenPhantom | ( | int | num | ) |
This function opens a Phantom device port. The phantom is specified by an integer (n>0) that represents the nth phantom in the the Phantom Control Panel list. If the phantom is opened successfully the function returns a handle (non-negative integer) for the phantom. If something goes wrong a negative value is returned.
num | Which Phantom should we be opening? |
void PhantomAccess | ( | int | access_type | ) |
Set the access mode for this Phantom. Only meaningful when using Ghost, which no one should be doing.
access_type | Should we be using deviceio or gstforceeffect to talk to this Phantom? |
int ReadNormalizedPositionPhantom | ( | int | num, | |
double & | iPosX, | |||
double & | iPosY, | |||
double & | iPosZ | |||
) |
ReadNormalizedPositionPhantom(int num,double &iPosX,double &iPosY,double &iPosZ); reads tip position for phantom num the function returns 1 if everything went ok, a negative value otherwise (check list of errors). Position values are returned in the three iPos variables. Note that positions are expressed with a value included in the interval [-1,1] for a cube centered in the device's workspace center. This is to ensure that a same demo may be used using different devices without having to change any of the code Note that positions are expressed in mm with respect to a Ghost reference frame (X: right, Y: up, Z: toward user)
num | Which Phantom should we be reading? | |
iPosX | Returned device position | |
iPosY | Returned device position | |
iPosZ | Returned device position |
int ReadOrientMat3DOFPhantom | ( | int | num, | |
double * | m | |||
) |
ReadOrientMat3DOFPhantom(int num, double *m);, reads the orientation matrix of the stylus for a 3dof wristed phantom device and returns it in a Phantom coordinate frame. The function returns 1 if everything went ok, a negative value otherwise (check list of errors).
num | Which Phantom are we reading? | |
*m | Output orientation matrix? |
int ReadPositionPhantom | ( | int | num, | |
double & | iPosX, | |||
double & | iPosY, | |||
double & | iPosZ | |||
) |
ReadPositionPhantom(int num,double &iPosX,double &iPosY,double &iPosZ); reads tip position for phantom num the function returns 1 if everything went ok, a negative value otherwise (check list of errors). Position values are returned in the three iPos variables. Note that positions are expressed in mm with respect to a Ghost reference frame (X: right, Y: up, Z: toward user)
num | Which Phantom should we read? | |
iPosX | Returned position | |
iPosY | Returned position | |
iPosZ | Returned position |
int ReadSwitchPhantom | ( | int | num | ) |
ReadSwitchPhantom(int num), reads the switch from phantom num
num | Which phantom should we be reading? |
int ReadVelocityPhantom | ( | int | num, | |
double & | iVelX, | |||
double & | iVelY, | |||
double & | iVelZ | |||
) |
ReadVelocityPhantom(int num,double &iVelX,double &iVelY,double &iVelZ); reads tip velocity for phantom num the function returns 1 if everything went ok, a negative value otherwise (check list of errors) Note that velocity is expressed in mm/sec with respect to a Ghost reference frame (X: right, Y: up, Z: toward user)
num | Which Phantom should we read? | |
iVelX | Returned velocity | |
iVelY | Returned velocity | |
iVelZ | Returned velocity |
int ResetPhantomEncoders | ( | int | num | ) |
Reset Phantom number num. Returns a negative value is operation failed, 1 in case of success.
num | Which Phantom should we be resetting? |
int SetCallbackPhantom | ( | void(*)(void *) | callbackFunc, | |
void * | a_data | |||
) |
Set up a callback for this device. Only supported by the HD library right now.
Sets up a user-defined callback function.
void(*callbackFunc)(void*) | Pointer to callback function | |
void* | a_data Pointer to be passed to callback function |
int SetForcePhantom | ( | int | num, | |
const double & | iForceX, | |||
const double & | iForceY, | |||
const double & | iForceZ | |||
) |
SetForcePhantom(int num,const double &iForceX,const double &iForceY,const double &iForceZ); writes force to phantom num the function returns 1 if everything went ok, a negative value otherwise (check list of errors) Note that forces are expressed in Newtons with respect to a Ghost reference frame (X: right, Y: up, Z: toward user) Note: no safety features are implemented other than the standard Ghost ones.
num | Which phantom should we read? | |
iForceX | Output force | |
iForceY | Output force | |
iForceZ | Output force |
int SetForceTorquePhantom | ( | int | num, | |
const double & | iForceX, | |||
const double & | iForceY, | |||
const double & | iForceZ, | |||
const double & | iTorqueX, | |||
const double & | iTorqueY, | |||
const double & | iTorqueZ | |||
) |
SetForceTorquePhantom(int num, const double &iForceX, const double &iForceY, const double &iForceZ, const double &iTorqueX, const double &iTorqueY, const double &iTorqueZ); writes Forces and Torques to phantom num. the function returns 1 if everything went ok, a negative value otherwise (check list of errors) Note that forces are expressed in Newtons and torques are expressed in Newtons Meter with respect to a Phantom reference frame (X: right, Y: up, Z: toward user) Note: no safety features are implemented other than the standard Ghost ones.
num | Which Phantom should we read? | |
iForceX | Output force | |
iForceY | Output force | |
iForceZ | Output force | |
iTorqueX | Output torque | |
iTorqueY | Output torque | |
iTorqueZ | Output torque |
int StartCommunicationPhantom | ( | int | num | ) |
This function starts the Communication with the phantom num. Returns 1 if everything went OK, a negative value otherwise.
num | Which Phantom should we talk to? |
int StopCommunicationPhantom | ( | int | num | ) |
StopCommunicationPhantom(int num), Stops the effect of phantom i, basically disabling forces and position reading for such phantom. Note that the overall servoloop will still be running since the other phantom may be not disabled.
The function returns 1 if everything went ok, a negative value otherwise (check list of errors)
num | Which Phantom should we stop talking to? |