This guide will help you quickly get started with the Robot Dog RobotServer SDK, even if you are not familiar with the C++ programming language.
Before you start using the SDK, please ensure your system meets the following requirements:
- Operating System: Linux, macOS, or Windows
- C++17 or higher compiler
- CMake 3.10 or higher
- Boost 1.66 or higher
- nlohmann/json library
- rapidxml library
chmod +x scripts/install_dependencies.sh
./scripts/install_dependencies.shBefore you start using the SDK, you need to refer to the Jueying X30 Pro Application Manual to complete the following tasks:
- Use the joystick to control the robot to complete the mapping work
- Use the joystick to create a new navigation route and synchronise it to the navigation host
- Rename the synchronised navigation routes to
default_navigation_points.jsonand replace the. /examples/basic/default_navigation_points.jsonfile in the SDK
- Clone the SDK repository:
git clone https://github.com/DeepRoboticsLab/robotserver_sdk.git
cd robotserver_sdk- Create a build directory and compile:
mkdir build && cd build
cmake ..
make- Install the SDK (optional):
sudo make install / sudo make uninstallRefer to the examples/basic/basic_example.cpp file, which implements a simple example showing how to use the SDK to connect to the robot dog and send navigation tasks.
#include <robotserver_sdk.h>// Create SDK instance
robotserver_sdk::RobotServerSdk sdk;// Connect to the robot dog control system
if (!sdk.connect("192.168.1.106", 30000)) {
std::cerr << "Connection failed!" << std::endl;
return 1;
}// Get real-time status
auto status = sdk.request1002_RunTimeState();
std::cout << "Current position: (" << status.posX << ", " << status.posY << ", " << status.posZ << ")" << std::endl;// Create navigation points
auto points = default_navigation_points;
// Send navigation task
sdk.request1003_StartNavTask(points, [](void(const NavigationResult& navigationResult)) {
if (navigationResult.errorCode == ErrorCode_Navigation::SUCCESS) {
std::cout << "Navigation task completed successfully!" << std::endl;
} else {
std::cout << "Navigation task failed, errorStatus: " << static_cast<int>(navigationResult.errorStatus) << std::endl;
}
});// Query task status
auto taskStatus = sdk.request1007_NavTaskState();
std::cout << "Task status: " << static_cast<int>(taskStatus.status) << std::endl;// Cancel navigation task
if (sdk.request1004_CancelNavTask()) {
std::cout << "Navigation task cancelled" << std::endl;
} else {
std::cerr << "Failed to cancel navigation task" << std::endl;
}// Disconnect
sdk.disconnect();- Check out the SDK Architecture Overview to understand the overall architecture and design philosophy of the SDK
- Check out the API Reference to learn more about SDK functions