Skip to content

Latest commit

 

History

History
136 lines (98 loc) · 3.37 KB

File metadata and controls

136 lines (98 loc) · 3.37 KB

Quick Start Guide

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.

System Requirements

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.sh

Preparation

Before you start using the SDK, you need to refer to the Jueying X30 Pro Application Manual to complete the following tasks:

  1. Use the joystick to control the robot to complete the mapping work
  2. Use the joystick to create a new navigation route and synchronise it to the navigation host
  3. Rename the synchronised navigation routes to default_navigation_points.json and replace the . /examples/basic/default_navigation_points.json file in the SDK

Installing the SDK

Building from Source

  1. Clone the SDK repository:
git clone https://github.com/DeepRoboticsLab/robotserver_sdk.git
cd robotserver_sdk
  1. Create a build directory and compile:
mkdir build && cd build
cmake ..
make
  1. Install the SDK (optional):
sudo make install / sudo make uninstall

Basic Usage

Complete Example

Refer 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.

1. Include Header File

#include <robotserver_sdk.h>

2. Create SDK Instance

// Create SDK instance
robotserver_sdk::RobotServerSdk sdk;

3. Connect to the Robot Dog Control System

// Connect to the robot dog control system
if (!sdk.connect("192.168.1.106", 30000)) {
    std::cerr << "Connection failed!" << std::endl;
    return 1;
}

4. Get Real-time Status

// Get real-time status
auto status = sdk.request1002_RunTimeState();
std::cout << "Current position: (" << status.posX << ", " << status.posY << ", " << status.posZ << ")" << std::endl;

5. Send Navigation Task

// 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;
    }
});

6. Query Navigation Task Status

// Query task status
auto taskStatus = sdk.request1007_NavTaskState();
std::cout << "Task status: " << static_cast<int>(taskStatus.status) << std::endl;

7. Cancel Navigation Task

// Cancel navigation task
if (sdk.request1004_CancelNavTask()) {
    std::cout << "Navigation task cancelled" << std::endl;
} else {
    std::cerr << "Failed to cancel navigation task" << std::endl;
}

8. Disconnect

// Disconnect
sdk.disconnect();

Next Steps