Airbot SDK 5.1.6
This project is designed for airbot C++SDK
Loading...
Searching...
No Matches
move_control.cpp

This example demonstrates how to switch robot modes and execute planned motion commands.

This example demonstrates how to switch robot modes and execute planned motion commands.The robotic arm's default mode is RobotMode::PLANNING_POS. To execute different types of motion commands, the robot mode must be switched accordingly before sending commands.

This example covers:

Note:

Example usage:

#include "airbot_sdk.hpp"
#include <array>
#include <cmath> // for M_PI_4
using namespace airbot;
int main() {
auto sdk = std::make_shared<AirbotSdk>("192.168.0.xxx", 50051);
// Switch mode to planning position for planned movements
sdk->SwitchMode({"arm"}, {RobotMode::PLANNING_POS});
// Define target joint positions (radians) for joints 1 to 6
std::array<double, 6> initial_pos = {0.0, -M_PI_4, M_PI_4, 0.0, 0.0, 0.0};
if (sdk->MoveToJointPos(initial_pos)) {
sdk->GetLogger()->info("Movement to joint position initiated successfully.");
} else {
sdk->GetLogger()->warn("Movement to joint position failed.");
}
// Define target Cartesian pose: position (meters) and orientation quaternion (xyzw)
const std::pair<std::array<double, 3>, std::array<double, 4>> &target_pose{
{0.45, 0.20, 0.45}, {0.0, 0.0, 0.0, 1.0}};
if (sdk->MoveToCartPos(target_pose)) {
sdk->GetLogger()->info("Movement to Cartesian position initiated successfully.");
} else {
sdk->GetLogger()->warn("Movement to Cartesian position failed.");
}
return 0;
}
Main SDK interface for controlling Airbot robotic arm.
Namespace containing all Airbot SDK related definitions.