This example shows how to get the current state of the robotic arm.
This example shows how to get the current state of the robotic arm.Retrieves the robot's joint positions (in radians) and end-effector pose, including position (in meters) and orientation (as a quaternion: xyzw).
Example usage:
int main() {
auto sdk = std::make_shared<AirbotSdk>("192.168.0.xxx", 50051);
const auto joint_positions = sdk->GetJointPos();
if (joint_positions.empty()) {
sdk->GetLogger()->warn("GetJointPositions returned empty result");
} else {
sdk->GetLogger()->info("Joint Positions:");
for (size_t i = 0; i < joint_positions.size(); ++i) {
sdk->GetLogger()->info(" Joint {}: {}", i + 1, joint_positions[i]);
}
}
const auto [position, orientation] = sdk->GetEndPose();
if (position.empty() || orientation.empty()) {
sdk->GetLogger()->warn("GetEndPose returned empty result");
} else {
sdk->GetLogger()->info("End Pose:");
sdk->GetLogger()->info(" Position: [{}, {}, {}]", position[0], position[1], position[2]);
sdk->GetLogger()->info(" Orientation: [{}, {}, {}, {}]", orientation[0], orientation[1], orientation[2],
orientation[3]);
}
return 0;
}
Main SDK interface for controlling Airbot robotic arm.
Namespace containing all Airbot SDK related definitions.