Roban2 Docs
Development InterfacesRoban2 C++ SDK Interfaces

Roban2 C++ SDK Introduction

This chapter is intended for users who develop secondary applications for Roban2 using the Lejulab_ARM development package. The currently public interface is a C++17 API that communicates over Cyclone DDS underneath; it does not use the legacy Python SDK, ROS1, or WebSocket.

SDK Components

SDKPublic headerPurpose
lejusdk-lowlevel<lejusdk-lowlevel/leju_sdk.h>Robot information, joints, IMU, standard gamepad, and hardware status, as well as low-level joint, dual-hand, pose height, and stop commands
lejusdk-vr<lejusdk-vr/lejusdk_vr.h>Arm, head, waist, and locomotion control, Quest data, controller, runtime, and motion services

The SDK is installed together with the development package under installed/, and includes headers, shared libraries, runtime programs, and example programs. Users do not need to rebuild the SDK; they only need to compile their own application programs.

Documentation Scope

This set of documents only records functionality that can be verified from the public headers of the current development package and the examples in the repository. It currently does not cover unpublished interfaces such as lidar, camera, legacy speech synthesis, or arm FK/IK.

Directory Structure

<Lejulab_ARM> denotes the root directory of the development package; the online tutorials are not tied to the absolute path of any particular device.

<Lejulab_ARM>/
├── installed/
│   ├── setup.bash              # 运行环境
│   ├── include/                # SDK 公开头文件
│   ├── lib/                    # SDK 及 DDS 动态库
│   └── bin/                    # 节点、工具和已编译示例
└── src/
    ├── lejusdk/examples/        # C++ 示例源码
    └── leju_launch/             # 启动脚本和 DDS 配置

Before Development

Roban2.2 uses version number 17. Set the version first, then load the environment shipped with the package:

cd <Lejulab_ARM>
export ROBOT_VERSION=17
source installed/setup.bash

setup.bash adds installed/bin, the SDK shared libraries, and the header paths, and configures the DDS environment. If your terminal has already loaded another ROS/DDS environment, it is recommended to open a new terminal and then run the commands above.

Roban VR API Initialization

1. Function Description

Create RobanVRAPI and initialize DDS communication. The examples for arm, head, waist, locomotion, controller, and motion services all start from this.

2. SDK and Header

  • SDK: lejusdk-vr
  • Header: <lejusdk-vr/lejusdk_vr.h>
  • Class: leju::vr::RobanVRAPI

3. Request or Message Types

bool initialize();
void shutdown();
bool isInitialized() const;

4. Field Description

This interface has no message fields. Pass the version read by leju::RobotVersion::from_env() to the constructor so that the program stays consistent with ROBOT_VERSION.

5. Return Values

  • initialize(): returns true on successful initialization, false on failure.
  • isInitialized(): returns true if initialized.
  • shutdown(): no return value.

6. Prerequisites

  • ROBOT_VERSION=17 has been set and installed/setup.bash has been loaded.
  • To call RPCs or publish control commands, the corresponding real-robot or simulation control link must be running.
  • A RobanVRAPI object stays alive for the duration of use, and shutdown() is called before exiting.

7. C++ Example

#include <iostream>
#include <lejusdk-vr/lejusdk_vr.h>

int main() {
  const auto version = leju::RobotVersion::from_env();
  leju::vr::RobanVRAPI vr(version);

  if (!vr.initialize()) {
    std::cerr << "VR SDK 初始化失败\n";
    return 1;
  }

  std::cout << "VR SDK 已初始化\n";
  vr.shutdown();
  return 0;
}

8. Corresponding Repository Examples

  • General initialization flow: src/lejusdk/examples/src/lejusdk-vr/01_basic_init.cpp
  • Direct example for the Roban type: src/lejusdk/examples/src/lejusdk-vr/07_roban_arm.cpp

01_basic_init.cpp is a general VR SDK flow example; when using it with Roban2, replace KuavoVRAPI in it with RobanVRAPI as shown on this page.

Documentation Navigation

Any publish*Cmd(), mode switch, startRuntime(), startMotion(), or playTact() can cause the robot to move. Before debugging on a real robot, you must clear the active area, confirm that the emergency stop is available, and first verify with small-amplitude targets.