Skip to main content

Boomy DDS SDK Development Guide III

I. About​

This document guides readers to write control code via LowController, send commands to the robot, drive it to perform corresponding motions, and reproduce the demonstration effect.

This document consists of four sections. Section 2 covers preliminary preparation. Section 3 explains code cloning, code annotation, deployment path and compilation operations in sequence, guiding you to make the left shoulder joint perform sinusoidal reciprocating motion centered on its initial position. Section 4 covers final effect verification and demonstration.

Automation function objective: Use LowController to control the left shoulder joint to perform sinusoidal reciprocating motion centered on its initial position.

II. Prerequisites​

caution

Environment Specifications

Operating System: Ubuntu 22.04

Note: ROS environment is not required for SDK compilation

Supported Architectures: x86_64 / ARM

(I) Connect to the Robot​

1.Wired Connection​

  1. Prepare a standard household RJ45 Ethernet cable.

  2. Set the IP address of your PC’s wired network interface to 192.168.55.100 (values from 103 to 110 are also acceptable) , and the subnet mask to 255.255.255.0.

  3. With this configuration, connect your PC directly to the Boomy robot via the Ethernet cable. Run the ping 192.168.55.102 command. A successful ping indicates that the communication link works properly.

  1. Connect to the robot computing board via SSH service
ssh noetix@192.168.55.101 #Connect to the compute board, Password: Boomy

2.Wireless Connection​

  1. Obtain the wireless IP: Check the robot Wi‑Fi IP from the Wi‑Fi connection status on the mobile App. (The compute board uses the motion control board’s Wi‑Fi module.)

  1. Run the connection command: Connect using the command with port parameters.
ssh -p 2222 noetix@[Robot WIFI-IP]

(II) SDK Source Code Acquisition, Build and Compilation​

Obtain the SDK Source Code​

Official URL:GitHub - Noetix-Robotics/noetix_sdk_boomy: This is SDK for Noetix robot Boomy with DDS interface.

III. Start​

(I) Clone the SDK​

git clone git@github.com:Noetix-Robotics/noetix_sdk_boomy.git
cd noetix_sdk_boomy

(II) Start of C++ Code​

1.Create the src folder​

mkdir src

2.Write the main.cpp file under the src folder.​

vim src/main.cpp
#include "lowcontroller.h"
#include <unistd.h>

#include <array>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <mutex>
#include <chrono>
#include <thread>

using namespace noetix;

std::mutex status_mutex;
RobotHardwareStatus latest_status;
bool status_received = false;

// Ctrl+C Exit flag
static volatile sig_atomic_t g_running = 1;
static void sigint_handler(int) { g_running = 0; }

// Receive robot hardware status
void hardware_status_callback(const RobotHardwareStatus &status)
{
{
std::lock_guard<std::mutex> lock(status_mutex);
latest_status = status;
status_received = true;
}
}

int main(int argc, char *argv[])
{
// 1. Configure DDS environment
char buf[256];
getcwd(buf, sizeof(buf));

std::string path = std::string(buf);
std::string ddsxml = "file://" + path + "/config/dds.xml";

setenv("CYCLONEDDS_URI", ddsxml.c_str(), 1);

printf("Current path: %s\n", path.c_str());
fflush(stdout);

// 2. Initialize LowController
LowController *ctrl = LowController::Instance();

if (!ctrl->init()) {
printf("LowController init failed!\n");
return -1;
}

// 3. After init, send a full-zero gain command immediately (consistent with the official example_low,
// to ensure the SDK internal sending thread works properly; kp/kd set to 0 will not drive any joints).
std::array<MotorCmd, 21> motorcmd{};
for (int i = 0; i < 21; i++) {
motorcmd[i].motor_id = i;
motorcmd[i].pos = 0;
motorcmd[i].vel = 0;
motorcmd[i].tau = 0;
motorcmd[i].kp = 0;
motorcmd[i].kd = 0;
}
ctrl->set_joint(motorcmd);

// 4. Subscribe to robot hardware status
ctrl->subscribe_robot_hardware_status(hardware_status_callback);

// 5. Poll and wait for joint feedback (max 5 seconds)
for (int i = 0; i < 50 && !status_received; i++)
sleep_ms(100);

if (!status_received) {
printf("Wait for hardware status timeout!\n");
return -1;
}

// 6. Get and verify the target joint index (can be specified via argv [1], default to left shoulder)
const char *joint_name = (argc > 1) ? argv[1] : "arm_l1_joint";
int joint_id = ctrl->getJointsIndex(joint_name);

if (joint_id < 0 || joint_id >= 21) {
printf("Invalid joint index %d for joint '%s'\n", joint_id, joint_name);
return -1;
}

printf("Joint '%s' -> index %d\n", joint_name, joint_id);

// 7. Get current actual position
double initial_pos;
{
std::lock_guard<std::mutex> lock(status_mutex);

if (latest_status.motor_data[joint_id].motor_id != joint_id) {
printf("Motor ID does not match array index!\n");
return -1;
}

initial_pos = latest_status.motor_data[joint_id].pos;
}

printf("Initial position: %.3f rad\n", initial_pos);
fflush(stdout);

// 8. Motion parameters
// Amplitude: Shoulder pitch travel ±2.36 rad. 0.4 rad ≈ ±23°, clearly visible to the naked eye;
// If set to 0.05 rad (±2.9°), it appears as "only stiffness without motion".
// Gain: Driving torque = kp × error, damping torque = kd × actual velocity.
// kp=100, kd=1: Driving torque 40 N·m >> damping torque (0.6 N·m at 0.6 rad/s), capable of tracking the sine wave.
// kp=5, kd=5: Driving torque 2 N·m < damping torque 3 N·m → suppressed by damping, stiff without movement.
// Reduce kp or increase kd if jitter/oscillation occurs; increase kp if the response is sluggish and fails to track.
const double amplitude = 0.4; // Motion amplitude, unit: rad
const double kp = 100.0; // Position gain
const double kd = 1.0; // Velocity damping (excessive value will offset the driving torque)
const double pi = 3.141592653589793;
const double period = 4.0; // One full cycle lasts 4 seconds.

printf("Start motion on joint '%s' (joint_id=%d), Ctrl+C to stop\n",
joint_name, joint_id);
fflush(stdout);

signal(SIGINT, sigint_handler);

// 9. Loop control
auto start_time = std::chrono::steady_clock::now();
int print_count = 0;

while (g_running) {
auto now = std::chrono::steady_clock::now();
double elapsed =
std::chrono::duration<double>(now - start_time).count();

// Perform sinusoidal reciprocating motion centered on the initial position.
double target_pos =
initial_pos + amplitude *
std::sin(2.0 * pi * elapsed / period);

motorcmd[joint_id].pos = target_pos;
motorcmd[joint_id].vel = 0;
motorcmd[joint_id].tau = 0;
motorcmd[joint_id].kp = kp;
motorcmd[joint_id].kd = kd;

ctrl->set_joint(motorcmd);

// 50 Hz control. Print target and actual position every 10 frames to verify tracking performance.
if (++print_count % 10 == 0) {
double actual_pos;
{
std::lock_guard<std::mutex> lock(status_mutex);
actual_pos = latest_status.motor_data[joint_id].pos;
}
printf("target: %+.3f rad | actual: %+.3f rad | err: %+.3f\n",
target_pos, actual_pos, target_pos - actual_pos);
fflush(stdout);
}

std::this_thread::sleep_for(std::chrono::milliseconds(20));
}

// 10. Release joints before exit (zero out gains to prevent holding the target position continuously).
motorcmd[joint_id].pos = 0;
motorcmd[joint_id].vel = 0;
motorcmd[joint_id].tau = 0;
motorcmd[joint_id].kp = 0;
motorcmd[joint_id].kd = 0;
ctrl->set_joint(motorcmd);

printf("Motion stopped, joint released\n");
fflush(stdout);

sleep_ms(100);
_exit(0);
}

For motor-related interfaces in the code, refer to the following.

Function Nameset_joint
Function Prototypevoid set_joint(std::array<MotorCmd, 21> motorcmd)
Function OverviewSet joint data
Parametersmotorcmd: motor command structure
Return ValueNone
Remarks
Function Namesubscribe_robot_hardware_status
Function Prototypevoid subscribe_robot_hardware_status(RobotHardwareStatusCallback callback);
Function OverviewSubscribe to robot hardware status information
Parameters- callback:Callback function for processing robot status data
Return ValueNone
RemarksUsage is the same as HighController. subscribe_robot_hardware_status
Parameter NameDefinition PrototypeExample ValueDescription
MotorCmd
struct MotorCmd {
double pos;
double vel;
double tau;
double kp;
double kd;
uint16_t motor_id;
};
posMotor position
velMotor speed
tauMotor torque
kpPID parameter
kdPID parameter
motor_idMotor ID
IDNameJointAngle RangeRadian Range
0arm_l1_jointLeft arm shoulder joint pitch-135135-2.362.36
1arm_l2_jointLeft arm shoulder joint roll-8111-0.141.94
2arm_l3_jointLeft arm joint yaw-9090-1.571.57
3arm_l4_jointLeft arm elbow joint pitch-1290-2.260.00
4leg_l1_jointLeft leg hip joint pitch-120120-2.092.09
5leg_l2_jointLeft leg hip joint roll-3890-0.661.57
6leg_l3_jointLeft thigh joint yaw-145145-2.532.53
7leg_l4_jointLeft leg knee joint pitch01280.002.24
8leg_l5_jointLeft leg ankle joint pitch-5525-0.960.44
9leg_l6_jointLeft leg ankle joint roll-1010-0.170.17
10arm_r1_jointRight arm shoulder joint pitch-135135-2.362.36
11arm_r2_jointRight arm shoulder joint roll-1118-1.940.14
12arm_r3_jointRight arm joint yaw-9090-1.571.57
13arm_r4_jointRight arm elbow joint pitch-1290-2.260.00
14leg_r1_jointRight leg hip joint pitch-120120-2.092.09
15leg_r2_jointRight leg hip joint roll-9038-1.570.66
16leg_r3_jointRight thigh joint yaw-145145-2.532.53
17leg_r4_jointRight leg knee joint pitch01280.002.24
18leg_r5_jointRight leg ankle joint pitch-5525-0.960.44
19leg_r6_jointRight leg ankle joint roll-1010-0.170.17
20waist_1_jointWaist joint yaw-9090-1.571.57

For more details, refer to: Boomy Comprehensive Usage Document

3.Modify CMakeLists.txt Build File​

Modify the content of the CMakeLists.txt file under this path:

  1. Add Example

Locate add_executable(example_media examples/cpp/example_media.cpp) in the file, and append the newly written code right below this line.

add_executable(main src/main.cpp)

add_executable is a CMake command, which is used to define an executable target

  1. Set Path

Similarly, locate target_include_directories in the file and add content below this line.

target_include_directories sets header search paths for the target example_standswing

target_include_directories(main
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
  1. Specify Linking

Similarly, locate target_link_libraries in the file and add content below this line.

target_link_libraries is used to specify libraries to link for the given target. It tells the linker to combine symbols and functions from these libraries into the final executable.

target_link_libraries(main
Threads::Threads
noetix_boomy_sdk
${DDS_LIB_DIR}/libddsc.so
${DDS_LIB_DIR}/libddscxx.so
)
  1. Full CMakeLists.txt File

CMakeLists.txt

4.Compile the Code​

Save and exit, then run the build script in the project root directory.

./build.sh

As shown below:

5.Run the Code​

sudo ./build/main

(III) Python Start​

1.Create main.py Python File​

Write main.py under the src folder.

vim src/main.py

2.Write Python Code​

"""
Control the left shoulder joint to perform sinusoidal reciprocating motion centered on its initial position.
The joint will be released (gains cleared) when exiting via Ctrl+C.
"""

import math
import os
import sys
import threading
from time import perf_counter, sleep

# DDS environment configuration (parse the project root directory based on the script location, independent of the runtime directory)
PROJECT_ROOT = os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
)
os.environ["CYCLONEDDS_URI"] = "file://" + os.path.join(PROJECT_ROOT, "config", "dds.xml")

sys.path.append(os.path.join(PROJECT_ROOT, "build"))

from lowcontrol_py import *

# Motion Parameters
AMPLITUDE = 0.05 # Motion amplitude, unit: rad
KP = 2.0 # Example gains, to be verified on the real robot.
KD = 2.0 # Example gains, to be verified on the real robot.
PERIOD = 4.0 # One full cycle is 4 seconds.
JOINT_NAME = "arm_l1_joint"
NUM_JOINTS = 21
CONTROL_DT = 0.02 # Approximately 50 Hz.

# Hardware state cache
status_lock = threading.Lock()
latest_status = [None]
status_received = threading.Event()

def hardware_status_callback(status):
"""Receive robot hardware status (this callback runs in the SDK thread)."""
with status_lock:
latest_status[0] = status
status_received.set()

def make_zero_cmds():
"""Initialize control commands for 21 joints (gains set to 0, other joints not driven)."""
cmds = [MotorCmd() for _ in range(NUM_JOINTS)]
for i in range(NUM_JOINTS):
cmds[i].motor_id = i
cmds[i].pos = 0.0
cmds[i].vel = 0.0
cmds[i].tau = 0.0
cmds[i].kp = 0.0
cmds[i].kd = 0.0
return cmds

def main():
# 1. Initialize LowController
ctrl = LowController.instance()
if not ctrl.init():
print("LowController init failed!")
return -1

# 2. Subscribe to robot hardware status
ctrl.subscribe_robot_hardware_status(hardware_status_callback)

# 3. Wait for joint feedback to be received.
if not status_received.wait(timeout=5.0):
print("Wait for hardware status timeout!")
return -1

# 4. Get and verify the left shoulder joint index.
joint_id = ctrl.getJointsIndex(JOINT_NAME)
if joint_id < 0 or joint_id >= NUM_JOINTS:
print(f"Invalid joint index: {joint_id}")
return -1

# 5. Get current actual position
with status_lock:
status = latest_status[0]
if status.motor_data[joint_id].motor_id != joint_id:
print("Motor ID does not match array index!")
return -1
initial_pos = status.motor_data[joint_id].pos

print(f"Left elbow initial position: {initial_pos:.3f} rad")

# 6. Initialize control commands for 21 joints.
cmds = make_zero_cmds()

print("Start left elbow motion... (Ctrl+C to stop)")

# 7. Loop control
start_time = perf_counter()
try:
while True:
elapsed = perf_counter() - start_time
target_pos = initial_pos + AMPLITUDE * math.sin(
2.0 * math.pi * elapsed / PERIOD
)

cmds[joint_id].pos = target_pos
cmds[joint_id].vel = 0.0
cmds[joint_id].tau = 0.0
cmds[joint_id].kp = KP
cmds[joint_id].kd = KD

ctrl.set_joint(cmds)

print(f"Target position: {target_pos:.3f} rad")
sleep(CONTROL_DT)
except KeyboardInterrupt:
print("\nStopping...")

# 8. Release joints before exit (clear gains to avoid holding the target position).
cmds[joint_id].pos = 0.0
cmds[joint_id].vel = 0.0
cmds[joint_id].tau = 0.0
cmds[joint_id].kp = 0.0
cmds[joint_id].kd = 0.0
ctrl.set_joint(cmds)

print("Motion stopped, joint released")
return 0

if __name__ == "__main__":
sys.exit(main())

3.Compile the Code​

After saving and exiting, run the compilation script in the project root directory to generate link files required for Python.

./build.sh

4.Run the Code​

After compilation, run the Python code in the project root directory.

python3 src/main.py

IV. Demonstration​

The following is the actual robot running effect.

Google Drive video link:https://drive.google.com/file/d/1iLTziQSaM8r4f2BB_i3K59u65uMiZIew/view?usp=drive_link

©Beijing Noetix Robotics Technology Group Co., Ltd.
Jing ICP Bei No. 2024092119-1 | Jing Gong Wang An Bei No. 11010802045221
Internet Filing No. 110114067446901260013
Beijing-SongYanDongLiFangShengJiQiRen-20260901S0213
Beijing-SongYanDongLiRenXingJiQiRen-20260901S0214