Skip to main content

Boomy DDS SDK Development Guide IV

I. About​

This document guides readers to write audio control code with MediaController, enabling manual wake-up and sleep of the robot, starting internal microphone audio capture, sending user speech to the large model, and playing the large model's voice response through the robot speaker to reproduce the relevant audio demonstration effect.

This document consists of four sections: Section 2 covers preliminary preparation; Section 3 sequentially explains code cloning, code annotation, deployment path and compilation operations to help you implement manual wake-up and sleep of the robot, start internal microphone audio capture, send user speech to the large model, and play the large model's voice response through the robot speaker; Section 4 is for final effect verification and demonstration.

Automation function objectives: Use MediaController to implement manual wake-up and sleep of the robot, start internal microphone audio capture, send user speech to the large model, and play the large model's voice response through the robot speaker. Developers do not need to redesign the robot's audio transmission and other functions; they only need to call the existing audio interfaces of the SDK and combine multiple interfaces to form a complete audio operation workflow.

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​

1.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 "MediaController.h"
#include <unistd.h>
#include <cstdlib>
#include <atomic>
#include <iostream>
#include <string>

using namespace noetix;

// Subscribe to system (dialogue) status
static void subscribe_chat_status(MediaController *ctrl)
{
ctrl->subscribe_system_status(
[](const media::SystemStatus &status) {
printf("[CHAT] System status: %d, reason: %d\n",
(int)status.value, (int)status.reason);
}
);
}

// Subscribe to large model replies.
// Subscribe to the internal playback audio stream to perceive the voice response from the large model.
// One chunk every 10 ms. Printing each entry will flood the screen, so summaries are generated every 100 chunks (approximately 1 second).
static void subscribe_chat_subtitle(MediaController *ctrl)
{
static std::atomic<uint32_t> chunk_count(0);

ctrl->subscribe_internal_audio_playback(
[](const media::AudioStream stream) {
uint32_t n = ++chunk_count;
// Print once every 100 chunks (approximately 1 second).
if (n % 100 == 1) {
printf("[LLM] agent audio playing... (%u chunks received)\n", n);
}
}
);
}

// Manual wake-up
static void cmd_wakeup(MediaController *ctrl)
{
ctrl->set_system_control(
media::SystemControlType::TO_WAKEUP, true
);

printf("[INFO] Robot wakeup command sent\n");
}

// Manual sleep
static void cmd_sleep(MediaController *ctrl)
{
ctrl->set_system_control(
media::SystemControlType::TO_SLEEP, true
);

printf("[INFO] Robot sleep command sent\n");
}

// Robot voice dialogue
static void cmd_voice_chat(MediaController *ctrl)
{
printf("\n========== Voice Chat Demo ==========\n");

// 1. Subscribe to dialogue status
subscribe_chat_status(ctrl);

// 2. Subscribe to large model replies
subscribe_chat_subtitle(ctrl);

// 3. Enable the internal microphone audio input Agent
ctrl->set_internal_capture_audio_data_to_agent_enable(true);

// 4. Enable Agent audio output to the internal speaker
ctrl->set_internal_agent_audio_data_to_playback_enable(true);

printf("[INFO] Voice interaction initialized\n");

printf("\n========== Keyboard Control ==========\n");
printf("W - Wakeup robot\n");
printf("S - Sleep robot\n");
printf("Q - Exit program\n");
printf("======================================\n");

std::string input;

while (true)
{
printf("\nCommand> ");

if (!std::getline(std::cin, input))
break;

if (input == "w" || input == "W")
{
cmd_wakeup(ctrl);
}
else if (input == "s" || input == "S")
{
cmd_sleep(ctrl);
}
else if (input == "q" || input == "Q")
{
cmd_sleep(ctrl);
break;
}
else
{
printf("[WARN] Unknown command\n");
}
}

// 5. Disable audio input and output
ctrl->set_internal_capture_audio_data_to_agent_enable(false);
ctrl->set_internal_agent_audio_data_to_playback_enable(false);

printf("[INFO] Voice chat exited\n");
}

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("cur path is %s\n", path.c_str());

// ========== 2. Obtain and initialize the MediaController singleton ==========
MediaController *ctrl = MediaController::Instance();
ctrl->init();

// ========== 3. Wait for DDS data synchronization ==========
sleep_ms(1000);

// ========== 4. Run robot voice dialogue ==========
cmd_voice_chat(ctrl);

return 0;
}



All audio-related interfaces used in the code establish communication links with the motion control board voice module via DDS Topics to control Boomy audio peripherals (speakers, microphones, etc.), and also provide voice interaction Agent configuration and data stream management capabilities. The specific interfaces are as follows:

MediaController Interface
Interface NameInterface Descriptionreturn type
InstanceObtain the singleton pointer of MediaControllerObject pointer
initMediaController Object Initializationbool
set_system_controlSet the control status of the voice interaction systemNone
subscribe_system_status

Subscribe to status information of the audio-visual interactive system

None
subscribe_system_error

Subscribe to error status information of audio-visual interaction system

None
get_volume

Get the current volume of the audio-visual interaction system Range: 0–200

int
set_volume

Set the volume of the current audio-visual interaction system Range: 0–200

None
get_timeoutGet the inactivity timeout before entering sleep modeint
set_timeoutSet the inactivity timeout before entering sleep modeNone
get_audio_cue_enable

get the enabled status of the prompt tone of the audio-visual interaction system

bool
set_audio_cue_enable

Set whether the prompt sound of the audio-visual interaction system is enabled

None
get_internal_capture_audio_data_to_agent_enableGet the internal microphone audio input status for the Agentbool
set_internal_capture_audio_data_to_agent_enableSet the internal microphone audio input status for the AgentNone
get_external_custom_audio_data_to_agent_enable

Get the enabled status of external audio stream input for the agent

bool
set_external_custom_audio_data_to_agent_enable

Get the enabled status of external audio stream input for the agent

None
get_internal_agent_audio_data_to_playback_enable

Get the enabled status of agent audio stream output to the internal speaker.

bool
set_internal_agent_audio_data_to_playback_enable

Set the enabled status of agent audio stream output to the internal speaker.

None
get_external_custom_audio_data_to_playback_enable

Get the enabled status of external audio stream output to the internal speaker.

bool
set_external_custom_audio_data_to_playback_enable

Get the enabled status of external audio stream output to the internal speaker.

None
get_internal_capture_video_data_to_agent_enable

Get the enabled status of internal video stream input to the agent.

bool
set_internal_capture_video_data_to_agent_enable

Set the enabled status of internal video stream input to the agent.

None
get_external_custom_video_data_to_agent_enable

Get the enabled status of external video stream input to the agent.

bool
set_external_custom_video_data_to_agent_enable

Set the enabled status of external video stream input to the agent.

None
get_external_custom_audio_data_to_agent_use_internal_3a

Get the enabled status of using the internal 3A algorithm for external audio stream input to the agent.

bool
set_external_custom_audio_data_to_agent_use_internal_3a

Set the enabled status of using the internal 3A algorithm for external audio stream input to the agent.

None
get_wakeup_response_wordsGet wake-up response wordsstring
set_wakeup_response_wordsSet wake-up response wordsNone
get_sleep_response_wordsGet dormant response wordsstring
set_sleep_response_wordsSet sleep response wordsNone
get_wakeup_wordsGet all wake wordsstring
add_wakeup_wordsAdd wake-up wordsbool
reset_wakeup_wordsReset factory default wake-up wordNone
subscribe_internal_audio_captureSubscribe to the audio stream captured by the internal microphoneNone
subscribe_internal_audio_playback

Subscribe to the audio stream played by the robot's internal speaker

None
subscribe_internal_video_capture

Subscribe to the video stream collected by the camera inside the robot (only available for Boomy without computing power board)

VideoStream struct
subscribe_internal_video_desensed

Subscribe to the audio-visual interaction system. The processed desensitized video stream (the Boomy equipped with a computing power board needs to continuously publish the availability of the external video stream)

VideoStream struct
pause_video_capture

Pause the internal camera Data Acquisition of the robot (only available for Boomy without computing power board)

None
resume_video_capture

Resume the internal camera Data Acquisition of the robot (only available for Boomy without computing power board)

None
publish_external_video_stream

Publish external video streams to the audio-visual interaction system

None
publish_external_audio_streamPublish external audio stream input to the agentNone
publish_external_audio_playback_streamPublish external audio stream output to the internal speakerNone
pause_audio_capturePause internal microphone audio stream captureNone
resume_audio_captureResume internal microphone audio stream captureNone
pause_audio_playbackPause the audio stream output of the internal speakerNone
resume_audio_playbackResume the audio stream output of the internal speakerNone

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​

import os
import sys
import threading

# Configure DDS environment
os.environ["CYCLONEDDS_URI"] = "file://config/dds.xml"

sys.path.append(os.path.abspath("./build"))
from mediacontrol_py import *

# ========== Subscribe callback ==========

def subscribe_chat_status(ctrl):
"""Subscribe to the system (dialogue) status.
Subscribe to system status, output working state (wakeup / sleep) and trigger reason.
"""
def on_system_status(status):
print(f"[CHAT] System status: {status.value}, reason: {status.reason}")

ctrl.subscribe_system_status(on_system_status)

def subscribe_chat_subtitle(ctrl):
"""Subscribe to the audio output stream of LLM replies.
Subscribe to internal playback audio stream to perceive LLM voice replies.
One chunk every 10ms. Printing each chunk will cause screen flooding. Aggregate and print once every 100 chunks (approx. 1 second).
"""
lock = threading.Lock()
counter = [0]

def on_audio_playback(stream):
with lock:
counter[0] += 1
count = counter[0]
if count % 100 == 1:
print(f"[LLM] agent audio playing... ({count} chunks received, "
f"{stream.duration_ms}ms/chunk, {stream.sample_rate}Hz)")

ctrl.subscribe_internal_audio_playback(on_audio_playback)

# ========== Control Command ==========

def cmd_wakeup(ctrl):
ctrl.set_system_control(SystemControlType.TO_WAKEUP, True)
print("[INFO] Robot wakeup command sent")

def cmd_sleep(ctrl):
ctrl.set_system_control(SystemControlType.TO_SLEEP, True)
print("[INFO] Robot sleep command sent")

# ========== **Run robot voice dialogue** ==========

def cmd_voice_chat(ctrl):
print("\n========== Voice Chat Demo ==========")

# 1. Subscribe to dialogue status
subscribe_chat_status(ctrl)

# 2. Subscribe to large model replies
subscribe_chat_subtitle(ctrl)

# 3. Enable the internal microphone audio input Agent
ctrl.set_internal_capture_audio_data_to_agent_enable(True)

# 4. Enable Agent audio output to the internal speaker
ctrl.set_internal_agent_audio_data_to_playback_enable(True)

print("[INFO] Voice interaction initialized")

print("\n========== Keyboard Control ==========")
print("W - Wakeup robot")
print("S - Sleep robot")
print("Q - Exit program")
print("======================================")

while True:
try:
user_input = input("\nCommand> ").strip().lower()
except EOFError:
cmd_sleep(ctrl)
break

if user_input == "w":
cmd_wakeup(ctrl)
elif user_input == "s":
cmd_sleep(ctrl)
elif user_input == "q":
cmd_sleep(ctrl)
break
else:
print("[WARN] Unknown command")

# 5. Disable audio input and output
ctrl.set_internal_capture_audio_data_to_agent_enable(False)
ctrl.set_internal_agent_audio_data_to_playback_enable(False)

print("[INFO] Voice chat exited")

def main():
ctrl = MediaController.instance()
ctrl.init()

try:
cmd_voice_chat(ctrl)
except KeyboardInterrupt:
ctrl.set_internal_capture_audio_data_to_agent_enable(False)
ctrl.set_internal_agent_audio_data_to_playback_enable(False)
print("\n[INFO] interrupted, exited")
return 0

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

3.Compile the Code​

Save and exit, then run the build script in the project root directory. The link files required for Python will be generated.

./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/1aT-BlQtBGrqnYBl7oGuSm69AWiWGha0n/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