set_ref_coord
This function sets the reference coordinate system of the controller. API motion and jog functions use their own eMoveReference argument, which set_ref_coord does not change (motion functions default to MOVE_REFERENCE_BASE; jog and multi_jog require it); pass the user coordinate ID there to move relative to that coordinate system.
If not explicitly changed, the reference coordinate defaults to the base coordinate system.
Definition
DRFLEx.h within class CDRFLEx, public section
bool set_ref_coord(COORDINATE_SYSTEM eTargetCoordSystem) {
return _set_ref_coord(_rbtCtrl, eTargetCoordSystem);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
eTargetCoordSystem |
The reference coordinate system to set. |
Return
Value |
Description |
|---|---|
0 |
Failed to set the reference coordinate system |
1 |
Successfully set the reference coordinate system |
Example
// Move to a joint position
float p1[6] = {0.f, 0.f, 90.f, 0.f, 90.f, 0.f};
drfl.movej(p1, 60, 30);
// Create a custom user coordinate system
float vec[2][3] = {{-1.f, 1.f, 1.f}, {1.f, 1.f, 0.f}};
float org[3] = {370.9f, -419.7f, 651.5f};
int user_id = drfl.set_user_cart_coord(vec, org);
// Change reference coordinate to the user frame
if (user_id >= 101 && user_id <= 200) {
drfl.set_ref_coord((COORDINATE_SYSTEM)user_id);
}
This example defines a user coordinate system and sets it as the controller reference coordinate system. To move relative to it, pass the ID as eMoveReference to movel.