get_desired_posj
This function returns the desired angle of each robot joint.
Definition
DRFLEx.h within class CDRFLEx, public section
LPROBOT_POSE get_desired_posj() {
return _get_desired_posj(_rbtCtrl);
};
Parameter
None
Return
Value |
Description |
|---|---|
Refer to the Definition of Structure |
Example
// Retrieve the desired joint positions (target values commanded by controller)
LPROBOT_POSE lpDesired = drfl.get_desired_posj();
LPROBOT_POSE lpCurrent = drfl.get_current_posj();
if (lpDesired && lpCurrent) {
printf("Comparing Desired vs Current Joint Angles:\n");
for (int i = 0; i < NUMBER_OF_JOINT; ++i) {
float error = std::fabs(lpDesired->_fPosition[i] - lpCurrent->_fPosition[i]);
printf(" Joint %d | Desired: %.1f | Current: %.1f | Error: %.1f\n", (i + 1), lpDesired->_fPosition[i], lpCurrent->_fPosition[i], error);
}
} else {
printf("Failed to retrieve joint position data.\n");
}
This example retrieves both the desired joint angles (commanded by the motion controller) and the current joint angles (actual feedback from encoders), then compares them. The difference between these values represents the motion tracking error during movement. This function is particularly useful for real-time monitoring, trajectory debugging, or fine-tuning controller response accuracy in dynamic applications.