AI and LUI Interfaces
AI and LUI capabilities are exposed through high-level RPC clients and subtitle/ASR stream topics.
Source headers:
include/booster/robot/ai/client.hppinclude/booster/robot/ai/api.hppinclude/booster/robot/ai/const.hpp
Clients
Client | Methods | Description | Minimum firmware |
|---|---|---|---|
|
| AI chat and direct speech. |
|
|
| Enable or disable face tracking. |
|
|
| Enable or disable ASR. |
|
|
| Configure TTS, stop TTS, and send text. |
|
|
| Synthesize text-file content read by the application into audio that can be saved as PCM or WAV. |
|
|
| Recognize WAV/MP3 files or base64 PCM data; the application can save the returned text to a file. |
|
|
| Isolate ASR/TTS session ownership and stop operations by client and session. |
|
C++ Example
#include <booster/robot/ai/client.hpp>
#include <booster/robot/channel/channel_factory.hpp>
booster::robot::ChannelFactory::Instance()->Init(0, "<network_ip>");
booster::robot::AiClient ai;
ai.Init();
ai.Speak(booster::robot::SpeakParameter("Hello from Booster robot."));
booster::robot::LuiClient lui;
lui.Init();
lui.StartAsr();
lui.StartTts(
booster::robot::LuiTtsConfig(
"zh_male_wennuanahu_moon_bigtts"));
lui.SendTtsText(booster::robot::LuiTtsParameter("Hello."));
AI and LUI Topics
Topic | C++ constant | C++ message type | Minimum firmware |
|---|---|---|---|
|
|
|
|
|
|
|
|
Subscribe with ChannelSubscriber<booster_interface::msg::Subtitle> or ChannelSubscriber<booster_interface::msg::AsrChunk>. See Low-Level Topics for the subscriber template.
Complete Public Interfaces
Public AiClient methods:
Method | Business meaning | Minimum firmware |
|---|---|---|
| Initialize the AI RPC channel for the default or named robot. |
|
| Create an AI chat session with TTS, LLM, ASR, and interruption settings. |
|
| Stop the current AI chat; an idle session is normally treated as success. |
|
| Synthesize and play a non-empty message in the active chat. |
|
| Request standalone face tracking; requires an NVIDIA perception board and may only be acknowledged by the current RTC service. |
|
Public LuiClient methods:
Method | Business meaning | Notes |
|---|---|---|
| Initialize the LUI RPC channel. | Required first |
| Start/stop this client’s microphone ASR; results are published on | 16 kHz mono 16 bit |
| Create/stop this client’s TTS session. With firmware | Requires audio/network services |
| Queue text in the active TTS session; non-empty text and service rate limits apply. |
|
| Pass text-file content read by the application to the active TTS session and receive base64 PCM and its format; save the PCM directly or wrap it as WAV using the sample rate, channel count, and bit depth. Start the TTS session before calling this method. |
|
| Recognize one WAV/MP3 file or base64 PCM payload. File paths must be readable by the robot-side LUI service; the application can save response |
|
| Create/stop this client’s reusable recognizer session. |
|
| Submit a file or PCM recognition request in the reusable session. File paths must be readable by the robot-side LUI service; the application can save response |
|
| Return the current |
|
| Return the reusable recognizer session ID. |
|
| Return the current standalone TTS session ID. |
|
| Return the LUI client instance ID used to distinguish clients in one process. |
|
| Check whether an ASR session is still owned by a client. |
|
AI and LUI enums
AiApiId values:
Enumerator | Value | Meaning |
|---|---|---|
|
| Create an AI chat session. |
|
| Stop the AI chat session. |
|
| Speak text in the active chat. |
|
| Request standalone face tracking; the current service may only acknowledge it. |
|
| Request standalone face-tracking stop; the current service may only acknowledge it. |
LuiApiId values:
Enumerator | Value | Meaning |
|---|---|---|
|
| Start / stop standalone ASR. |
|
| Create / stop the standalone TTS session. |
|
| Queue text in the TTS session. |
|
| Return one synthesized audio payload. |
|
| Recognize one file or PCM payload. |
|
| Start / stop the reusable recognizer session. |
|
| Recognize one payload in the reusable session. |
Public payloads and responses
TtsConfigcontains backend voice IDvoice_type_andignore_bracket_text_categories: 1 full-width parentheses, 2 ASCII parentheses, 3 full-width square brackets, 4 ASCII square brackets, and 5 ASCII curly braces.LlmConfigcontainssystem_prompt_(system prompt),welcome_msg_(greeting), andprompt_name_(deployed named prompt).AsrConfigcontainsinterrupt_speech_duration_in milliseconds andinterrupt_keywords_.StartAiChatParametercontainsinterrupt_mode_,tts_config_,llm_config_,asr_config_, andenable_face_tracking_. Assign uninitialized scalars after default construction.SpeakParametercontains non-empty textmsg_.LuiTtsConfigcontains voice IDvoice_type_;LuiTtsParametercontains non-empty queued texttext_.LuiSynthesizeSpeechRequestcontainstext_,voice_type_(defaultdefault),speed_(0.5 to 2.0, default 1.0), andplayback_. The response containsaudio_base64_,sample_rate_hz_,channels_,bits_per_sample_, andformat_(defaultpcm_s16le).LuiRecognizeAudioRequestusesinput_type_fileorpcm. File requests usefile_path_; PCM requests useaudio_base64_,sample_rate_hz_,channels_,bits_per_sample_, andformat_. PreferFromFileandFromPcmBase64constructors.LuiRecognizeAudioResponse::text_contains recognized text.kLuiMaxSynthesizeTextCodePointsis 1000,kLuiMaxRecognizeAudioDurationMsis 120000, andkLuiMaxRecognizeAudioBytesis 6291456. Limits count Unicode code points, duration, and decoded bytes respectively.
Calling constraints
C++ methods wait synchronously for an RPC response, but success only means that the service accepted the request; check every return value. Python bindings use PascalCase names and commonly raise RuntimeError for high-level failures. rt/lui_asr_chunk broadcasts shared microphone recognition results, and its session_id and client_id fields are currently empty. C++ subscribers can call LuiClient::IsAsrSessionActive with their saved session and client IDs to consume messages only while their local session is active. In Python, use LuiAsrChunkSubscriber.InitChannelForClient after StartAsr succeeds. This session isolation requires firmware >= v1.8.0.9. Use kBoosterRobotUserId to identify robot-generated AI subtitle text.
Complete Payload, Request, and Response Types
All types below are public declarations in api.hpp. They can be used to build high-level requests or to call the same RPC through SendApiRequest. Each FromJson reads the fields listed in the table and ToJson serializes the same fields. Assign every uninitialized field after default construction.
Type | Fields | Description |
|---|---|---|
|
| AI-chat TTS voice and bracket categories to filter; values 1–5 are listed above. |
|
| LLM system prompt, session greeting, and backend named prompt. |
|
| Continuous-speech interruption threshold in milliseconds and immediate interruption keywords. |
|
| Combined AI-chat configuration; interruption and face-tracking intent are booleans. |
|
| Non-empty text to synthesize in an active AI chat. |
Type | Fields/constructor | Description |
|---|---|---|
|
| Low-level request to start an ASR session; both identifiers isolate clients. |
|
| Stops the specified ASR session and only succeeds for its owning client. |
|
| Backend voice identifier for a standalone TTS session. |
|
| Stops the specified standalone TTS session. |
|
| Non-empty text appended to the current TTS session. |
Type | Fields | Constraints/return value |
|---|---|---|
|
| Text is limited to |
|
| Base64 audio and format; defaults are 16 kHz, mono, 16 bit, |
|
|
|
|
| Recognized text returned by the service. |
Helpers and limits
CountUtf8CodePoints(text)counts non-continuation UTF-8 bytes and returns the Unicode code-point count. It is a local pre-check; the service remains authoritative.EstimateBase64DecodedBytes(base64_data)estimates decoded byte count from base64 length and trailing padding for comparison withkLuiMaxRecognizeAudioBytes; pass valid base64.kLuiMaxSynthesizeTextCodePoints,kLuiMaxRecognizeAudioDurationMs, andkLuiMaxRecognizeAudioBytesare1000,120000, and6291456respectively.
Generic RPC overloads
In addition to business convenience methods, both clients expose these operations for protocol diagnostics or new IDs not yet wrapped by the SDK. param is the JSON string produced by ToJson().dump() on one of the payload types above.
Interface | Description |
|---|---|
| Send an AI request synchronously and return its status; pass an empty string for no-body operations. |
| Send an AI request and write the complete |
| Send a LUI request synchronously and return its status. |
| Send a LUI request and return the complete |
Call these functions only after the corresponding Init. A success code means that the service accepted the request; it does not mean asynchronous speech or cloud-session work has completed.