You're reading the documentation for an older, but still supported version
(GL013300).
For information on the latest version, please have a look at GL013301.
For information on the latest version, please have a look at GL013301.
get_current_posj
This is a function for checking information on the current joint angle by axis of the robot in the robot controller.
Definition
DRFLEx.h within class CDRFLEx, public section (line 715)
LPROBOT_POSE get_current_posj() {
return _get_current_posj(_rbtCtrl);
};
Parameter
None
Return
Value |
Description |
|---|---|
Refer to the Definition of Structure |
Example
#include "DRFLEx.h"
#include <iostream>
using namespace DRAFramework;
int main() {
CDRFLEx drfl;
// Retrieve the current joint positions (in radians)
LPROBOT_POSE lpPose = drfl.get_current_posj();
if (lpPose != nullptr) {
std::cout << "Current Joint Angles (rad):" << std::endl;
for (int i = 0; i < NUMBER_OF_JOINT; ++i) {
std::cout << " Joint " << (i + 1) << ": " << lpPose->_fPos[i] << std::endl;
}
} else {
std::cerr << "Failed to retrieve joint positions." << std::endl;
}
return 0;
}
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 radians (or degrees, depending on the system configuration). This function is commonly used in motion monitoring, calibration routines, or when synchronizing the robot’s state with external systems.