DRD-API 3.2.2 documentation
 

drdc.h File Reference

DRD header file. More...

Functions

int __API drdOpen ()
int __API drdOpenID (int index)
int __API drdSetDevice (char ID)
int __API drdGetDeviceID ()
int __API drdClose (char ID=-1)
bool __API drdIsRunning (char ID=-1)
bool __API drdIsMoving (char ID=-1)
bool __API drdIsFiltering (char ID=-1)
double __API drdGetTime ()
void __API drdSleep (double sec)
void __API drdWaitForTick (char ID=-1)
bool __API drdIsInitialized (char ID=-1)
int __API drdAutoInit (char ID=-1)
int __API drdGetPos (double *px, double *py, double *pz, char ID=-1)
double __API drdGetCtrlFreq (char ID=-1)
int __API drdStart (char ID=-1)
int __API drdEnableFilter (bool on, char ID=-1)
int __API drdMoveToPos (double px, double py, double pz, bool block=true, char ID=-1)
int __API drdMoveToEnc (int enc0, int enc1, int enc2, bool block=true, char ID=-1)
int __API drdTrackPos (double px, double py, double pz, char ID=-1)
int __API drdTrackEnc (int enc0, int enc1, int enc2, char ID=-1)
int __API drdHold (char ID=-1)
int __API drdStop (char ID=-1)
int __API drdSetPriorities (int prio, int ctrlprio, char ID=-1)
void __API drdSetEncPGain (double gain, char ID=-1)
double __API drdGetEncPGain (char ID=-1)
int __API drdSetEncMoveParam (double amax, double vmax, double jerk, char ID=-1)
int __API drdSetEncTrackParam (double amax, double vmax, double jerk, char ID=-1)
int __API drdSetPosMoveParam (double amax, double vmax, double jerk, char ID=-1)
int __API drdSetPosTrackParam (double amax, double vmax, double jerk, char ID=-1)
int __API drdGetEncMoveParam (double *amax, double *vmax, double *jerk, char ID=-1)
int __API drdGetEncTrackParam (double *amax, double *vmax, double *jerk, char ID=-1)
int __API drdGetPosMoveParam (double *amax, double *vmax, double *jerk, char ID=-1)
int __API drdGetPosTrackParam (double *amax, double *vmax, double *jerk, char ID=-1)

Detailed Description

DRD header file.


Function Documentation

int __API drdAutoInit ( char  ID  ) 

Performs automatic initialization of that particular robot by robotically moving to a known position and reseting encoder counters to their correct values.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdClose ( char  ID  ) 

Close the connection to a particular device.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdEnableFilter ( bool  on,
char  ID 
)

Enable or disable motion filtering for subsequent calls to drdTrackPos() or drdTrackEnc().

Parameters:
on true to enable motion filtering, false to disable it
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
double __API drdGetCtrlFreq ( char  ID  ) 

This function returns the average refresh rate of the control loop (in kHz) since the function was last called.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdGetDeviceID (  ) 

Return the ID of the current default device.

Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdGetEncMoveParam ( double *  amax,
double *  vmax,
double *  jerk,
char  ID 
)

Retrieve encoder positioning trajectory generation parameters.

Parameters:
amax [out]max acceleration (m/s2)
vmax [out]max velocity (m/s)
jerk [out]jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
double __API drdGetEncPGain ( char  ID  ) 

Retrieve the P term of the PID controller that regulates joint positions.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
The P gain of the PID regulator.
int __API drdGetEncTrackParam ( double *  amax,
double *  vmax,
double *  jerk,
char  ID 
)

Retrieve encoder tracking trajectory generation parameters.

Parameters:
amax [out]max acceleration (m/s2)
vmax [out]max velocity (m/s)
jerk [out]jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdGetPos ( double *  px,
double *  py,
double *  pz,
char  ID 
)

Retrieve the position of the end-effector in cartesian coordinates. Please refer to your device user manual for more information on your device coordinate system.

Parameters:
px [out] device position on the X axis in [m]
py [out] device position on the Y axis in [m]
pz [out] device position on the Z axis in [m]
ID [default=-1] device ID (see multiple devices section for details)
Note:
This function differs from dhdGetPosition() in that it is synchronized with the robotic control loop. As a result, it does not impact control performance and returns faster than dhdGetPosition().
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdGetPosMoveParam ( double *  amax,
double *  vmax,
double *  jerk,
char  ID 
)

Retrieve cartesian positioning trajectory generation parameters.

Parameters:
amax [out]max acceleration (m/s2)
vmax [out]max velocity (m/s)
jerk [out]jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdGetPosTrackParam ( double *  amax,
double *  vmax,
double *  jerk,
char  ID 
)

Retrieve cartesian tracking trajectory generation parameters.

Parameters:
amax [out]max acceleration (m/s2)
vmax [out]max velocity (m/s)
jerk [out]jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
double __API drdGetTime (  ) 

Returns the current value from the high-resolution system counter in [s]. The resolution of the system counter may be machine-dependant, as it usually derived from one of the CPU clocks signals. The time returned is guaranteed to be monotonous.

Returns:
The current time in [s].
int __API drdHold ( char  ID  ) 

Immediately make the robot hold its current position. All motion commands are abandoned.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
bool __API drdIsFiltering ( char  ID  ) 

Checks whether the particular robot control thread is applying a motion filter while tracking a target using drdTrackPos() or drdTrackEnc().

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
true if the motion filter is enabled, false otherwise.
bool __API drdIsInitialized ( char  ID  ) 

Checks the initialization status of a particular robot. The initialization status reflects the status of the controller RESET LED. The robot can be (re)initialized by calling drdAutoInit().

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
true if the robot is initialized, false otherwise.
bool __API drdIsMoving ( char  ID  ) 

Checks whether the particular robot is moving (following a call to drdMoveToPos(), drdMoveToEnc(), drdTrackPos() or drdTrackEnc()), as opposed to holding the target position after successfully reaching it.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
true if the robot is moving, false otherwise.
bool __API drdIsRunning ( char  ID  ) 

Checks the state of the robotic control thread for a particular device.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
true if the control thread is running, false otherwise.
int __API drdMoveToEnc ( int  enc0,
int  enc1,
int  enc2,
bool  block,
char  ID 
)

Send the robot end-effector to a desired encoder position. The motion follows a straight line in the encoder space, with smooth acceleration/deceleration. The acceleration and velocity profiles can be controlled by adjusting the trajectory generation parameters.

Parameters:
enc0 target encoder position on axis 0 []
enc1 target encoder position on axis 1 []
enc2 target encoder position on axis 2 []
block if true, the call blocks until the destination is reached. If false, the call returns immediately.
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdMoveToPos ( double  px,
double  py,
double  pz,
bool  block,
char  ID 
)

Send the robot end-effector to a desired cartesian position. The motion follows a straight line, with smooth acceleration/deceleration. The acceleration and velocity profiles can be controlled by adjusting the trajectory generation parameters.

Parameters:
px target position on the X axis in [m]
py target position on the Y axis in [m]
pz target position on the Z axis in [m]
block if true, the call blocks until the destination is reached. If false, the call returns immediately.
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdOpen (  ) 

Open a connection to the first compatible device connected to the system. If more than one device is connected, USB devices will always be opened before PCI devices. To open connections to multiple devices, use the drdOpenID() call.

Note:
If this call is successful, the default device ID is set to the newly opened device. See the multiple device section for more information on using multiple devices on the same computer.
Returns:
The device ID on success, -1 otherwise.
See error management for details.
See also:
drdOpenID
int __API drdOpenID ( int  ID  ) 

Open a connection to one particular compatible device connected to the system. PCI-connected devices are opened first, followed by USB-connected devices. The order in which devices are opened is predictable and remains the same until system configuration changes.

Parameters:
ID the device ID (must be between 0 and the number of devices connected to the system)
Note:
If this call is successful, the default device ID is set to the newly opened device. See the multiple device section for more information on using multiple devices on the same computer.
Returns:
The device ID on success, -1 otherwise.
See error management for details.
See also:
drdOpen
int __API drdSetDevice ( char  ID  ) 

Select the default device that will receive the API commands. The API supports multiple devices. This routine allows the programmer to decide which device the API single_device_call single-device calls will address. Any subsequent API call that does not specifically mention the device ID in its parameter list will be sent to that device.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdSetEncMoveParam ( double  amax,
double  vmax,
double  jerk,
char  ID 
)

Set encoder positioning trajectory generation parameters.

Parameters:
amax max acceleration (m/s2)
vmax max velocity (m/s)
jerk jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
void __API drdSetEncPGain ( double  gain,
char  ID 
)

Set the P term of the PID controller that regulates joint positions. In practice, this affects the stiffness of the regulation.

Parameters:
gain P parameter of the PID regulator
ID [default=-1] device ID (see multiple devices section for details)
int __API drdSetEncTrackParam ( double  amax,
double  vmax,
double  jerk,
char  ID 
)

Set encoder tracking trajectory generation parameters.

Parameters:
amax max acceleration (m/s2)
vmax max velocity (m/s)
jerk jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdSetPosMoveParam ( double  amax,
double  vmax,
double  jerk,
char  ID 
)

Set cartesian positioning trajectory generation parameters.

Parameters:
amax max acceleration (m/s2)
vmax max velocity (m/s)
jerk jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdSetPosTrackParam ( double  amax,
double  vmax,
double  jerk,
char  ID 
)

Set cartesian tracking trajectory generation parameters.

Parameters:
amax max acceleration (m/s2)
vmax max velocity (m/s)
jerk jerk (m/s3)
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdSetPriorities ( int  prio,
int  ctrlprio,
char  ID 
)

This function makes it possible to adjust the priority of the control thread and the calling thread. Thread priority is system dependent, as described in thread priorities.

Parameters:
prio calling thread priority level
ctrlprio control thread priority level
ID [default=-1] device ID (see multiple devices section for details)
Note:
Please keep in mind that administrator/superuser access is required on many platforms in order to increase thread priority.
Returns:
0 on success, -1 otherwise.
See error management for details.
void __API drdSleep ( double  sec  ) 

Suspend the calling thread for a given duration specified in [s]. The sleep resolution is machine and OS dependent.

Parameters:
sec sleep duration in [s]
int __API drdStart ( char  ID  ) 

Start the robotic control loop for the given robot. The robot must be initialized (either manually or with drdAutoInit()) before drdStart() can be called successfully.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Note:
In order to make regulation as stable as possible, drdStart() automatically increases the priority level of the regulation thread and the calling thread to equal values above the normal system process priority. The priority is set to THREAD_PRIORITY_HIGH.
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdStop ( char  ID  ) 

Stop the robotic control loop for the given robot.

Parameters:
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdTrackEnc ( int  enc0,
int  enc1,
int  enc2,
char  ID 
)

Send the robot end-effector to a desired encoder position. If motion filters are enabled, the motion follows a smooth acceleration/deceleration constraint on each encoder axis. The acceleration and velocity profiles can be controlled by adjusting the trajectory generation parameters.

Note:
WARNING - If motion filters are disabled, the target position is immediately applied as the new regulation target, leading to potential discontinuities.
Parameters:
enc0 target encoder position on axis 0 []
enc1 target encoder position on axis 1 []
enc2 target encoder position on axis 2 []
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
int __API drdTrackPos ( double  px,
double  py,
double  pz,
char  ID 
)

Send the robot end-effector to a desired cartesian position. If motion filters are enabled, the motion follows a smooth acceleration/deceleration constraint on each cartesian axis. The acceleration and velocity profiles can be controlled by adjusting the trajectory generation parameters.

Note:
WARNING - If motion filters are disabled, the target position is immediately applied as the new regulation target, leading to potential discontinuities.
Parameters:
px target position on the X axis in [m]
py target position on the Y axis in [m]
pz target position on the Z axis in [m]
ID [default=-1] device ID (see multiple devices section for details)
Returns:
0 on success, -1 otherwise.
See error management for details.
void __API drdWaitForTick ( char  ID  ) 

Synchronization function: calling this function will block until the next iteration of the control loop begins.



DRD-API 3.2.2 documentation
Please address any questions to support@forcedimension.com
(C) 2001-2010 - Force Dimension
All Rights Reserved.