get_current_posj
This function returns the current angle of each robot joint.
Definition
DRFLEx.h within class CDRFLEx, public section
LPROBOT_POSE get_current_posj() {
return _get_current_posj(_rbtCtrl);
};
Parameter
None
Return
Value |
Description |
|---|---|
Refer to the Definition of Structure |
Note
Returns the most recent monitoring value. All fields are 0 until monitoring data has been received: after open_connection, after setup_monitoring_version, and after a reconnect. The returned pointer is never NULL. Before using the value, wait for the first monitoring callback after connecting.
Example
// Retrieve the current joint positions [deg]
LPROBOT_POSE lpPose = drfl.get_current_posj();
printf("Current Joint Angles [deg]:\n");
for (int i = 0; i < NUMBER_OF_JOINT; ++i) {
printf(" Joint %d: %.1f\n", (i + 1), lpPose->_fPosition[i]);
}
This example retrieves the current joint angles of all robot axes from the controller and prints them to the console. Each element in the returned ROBOT_POSE structure represents the current position of a joint in degrees [deg]. This function is commonly used in motion monitoring, calibration routines, or when synchronizing the robot’s state with external systems.