Motion-Control Interfaces
B1LocoClient is the main entry point for motion-control RPC interfaces.
Source headers:
include/booster/robot/b1/b1_loco_client.hppinclude/booster/robot/b1/b1_loco_api.hppinclude/booster/robot/b1/b1_api_const.hpp
Initialization
#include <booster/robot/b1/b1_loco_client.hpp>
#include <booster/robot/channel/channel_factory.hpp>
booster::robot::ChannelFactory::Instance()->Init(0, "<network_ip>");
booster::robot::b1::B1LocoClient client;
client.Init();
client.WaitForService(5000);
To address a named robot, call client.Init(robot_name).
Init() uses the default channel rt/LocoApiTopic. Init(robot_name) appends /<robot_name> to that channel; an empty string selects the default robot. Call Init() before any request method. WaitForService(timeout_ms, require_response_path) waits for the synchronous service: true requires both request and response endpoints, while false requires only the request endpoint; it returns false before initialization or after a timeout. WaitForOperationService(timeout_ms, require_event_path) waits for the asynchronous Operation endpoints and optionally requires the event endpoint.
Firmware Compatibility
The following versions come from the supplied interface specification. MoveHandEndEffectorV2 and MoveHandEndEffector share LocoApiId::kMoveHandEndEffector, so the table records the underlying RPC version.
C++ interface | Minimum firmware |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Robot Modes
RobotMode is defined in robot_shared.hpp:
Enum | Value | Purpose |
|---|---|---|
|
| Invalid value or error-handling placeholder. |
|
| Damping mode. |
|
| Prepare mode; the robot remains standing. |
|
| Walking mode for movement, turning, and kicking. |
|
| Custom-action mode. With firmware |
|
| Soccer mode. |
Typical sequence:
client.ChangeMode(booster::robot::RobotMode::kPrepare);
client.GetUp();
client.ChangeMode(booster::robot::RobotMode::kWalking);
GetUpVersion, used by GetUp and GetUpWithMode:
Enum | Value | Meaning |
|---|---|---|
|
| Initial/base get-up behavior and the default value. |
|
| BMM get-up behavior. |
Movement and Gait
Method | Supported models | Description |
|---|---|---|
| K1, T1, T2 | Send linear X/Y velocity in m/s and yaw velocity in rad/s, then wait for the RPC response. |
| K1, T1, T2 | Fire-and-forget variant for continuous velocity commands. |
| K1, T1, T2 | Switch the active gait; each |
| K1, T1, T2 | Reset position and heading together to |
| K1, T1, T2 | While gait control is active, reset odometry to a user-provided position and heading; |
| K1 | K1 supports entering WBC gait; missing configuration or an unavailable transition fails. |
| K1 | K1 supports exiting WBC gait to the humanlike gait; a missing target controller or unavailable transition fails. |
GaitType values:
Enum | Value | Meaning |
|---|---|---|
|
| Whole-body humanlike gait. |
|
| Half-body humanlike gait V1. |
|
| Half-body humanlike gait V2. |
|
| Whole-body humanlike gait V2. |
Head Control
Method | Supported models | Description |
|---|---|---|
| K1, T1, T2 | Set head pitch and yaw directly, in radians. |
| K1, T1, T2 | Reach the target angles within the specified time. |
| K1, T1, T2 | Rotate by direction using |
Arm End Effectors and Grippers
End-effector poses use Position, Orientation, and Posture. Position is in meters and orientation angles are in radians.
booster::robot::Posture target(
booster::robot::Position(0.25F, -0.15F, 0.10F),
booster::robot::Orientation(0.0F, 0.0F, 0.0F));
client.MoveHandEndEffectorV2(
target,
1000,
booster::robot::b1::HandIndex::kRightHand);
Method | Supported models | Description |
|---|---|---|
| K1, T1 | Recommended single-hand end-effector pose interface. |
| K1, T1 | Legacy single-hand end-effector method; deprecated, use V2. |
| K1, T1 | End-effector trajectory using an auxiliary point. |
| K1, T1 | Control both end effectors simultaneously. |
| K1, T1 | Stop end-effector control. |
| Legacy LocoApiService backend (deprecated) | Deprecated; do not use in new code. The robot-state-manager backend does not implement this ID and returns BadRequest. |
MoveHandEndEffector is deprecated. New code should use MoveHandEndEffectorV2.
HandIndex values:
Enum | Value | Meaning |
|---|---|---|
|
| Left hand. |
|
| Right hand. |
Gripper control:
booster::robot::b1::GripperMotionParameter motion(500, 300, 300);
client.ControlGripper(
motion,
booster::robot::b1::GripperControlMode::kPosition,
booster::robot::b1::HandIndex::kRightHand);
GripperControlMode values:
Enum | Value | Meaning |
|---|---|---|
|
| Position mode; stop at the target position or configured reaction force. |
|
| Force mode; continue moving with the configured force until the target position. |
Dexterous-hand control accepts a list of DexterousFingerParameter(seq, angle, force, speed) values:
std::vector<booster::robot::b1::DexterousFingerParameter> fingers;
for (int32_t i = 0; i < 6; ++i) {
fingers.emplace_back(i, 800, 300, 300);
}
client.ControlDexterousHand(
fingers,
booster::robot::b1::HandIndex::kRightHand,
booster::robot::b1::BoosterHandType::kInspireHand);
BoosterHandType values:
Enum | Value | Meaning |
|---|---|---|
|
| Unknown or invalid hand type. |
|
| Inspire dexterous hand. |
|
| Inspire dexterous hand with touch sensing. |
|
| Revo dexterous hand. |
Actions, Sound, and Special Control
Method | Supported models | Description |
|---|---|---|
| K1, T1, T2 | Start or stop waving. |
| K1, T1, T2 | Start or stop the handshake action. |
| K1, T1 | Run an upper-body dance or gesture. |
| K1, T2 | Run a full-body dance or action. |
| K1, T1, T2 | Request the firmware-configured powerful kick; current T1 provides the intended motion and unavailable transitions fail. |
| K1, T1, T2 | Request the firmware-configured visual kick using V1 or V2; missing motions return a state-transition error. |
| K1, T1, T2 | Play an audio file readable by the robot service; default models are K1, T1, and T2 and require the sound service/output hardware. |
| K1, T1, T2 | Stop the currently playing audio. |
| K1, T1 | Enable or disable zero-torque drag. |
| K1, T1, T2 | Enable or disable upper-body custom control. |
WaveHand and Handshake use HandAction:
Enum | Value | Meaning |
|---|---|---|
|
| Start/open the corresponding hand action. |
|
| Stop/close the corresponding hand action. |
DanceId values for upper-body dances and gestures:
Enum | ID | Meaning |
|---|---|---|
|
| New Year dance. |
|
| Nezha dance. |
|
| Towards the Future dance. |
|
| Dabbing gesture. |
|
| Ultraman gesture. |
|
| Respect/salute gesture. |
|
| Cheering gesture. |
|
| Lucky-cat gesture. |
|
| Stop the current upper-body dance or gesture. |
WholeBodyDanceId values for full-body dances and actions:
Enum | ID | Meaning |
|---|---|---|
|
| Arabic dance. The enum spelling follows the public SDK header. |
|
| Michael dance 1. |
|
| Michael dance 2. |
|
| Michael dance 3. |
|
| Boxing-style kick. |
|
| Roundhouse kick. |
|
| Shan He Gu Ren dance. |
|
| Gai Ge Chun Feng dance. |
|
| Combined Michael dances 1 and 2. |
|
| T2 bow-and-arrow full-body routine. |
|
| T2 Charleston full-body dance. |
ID 4 is not defined by WholeBodyDanceId; do not pass undefined integer values.
VisualKickVersion values:
Enum | Value | Meaning |
|---|---|---|
|
| Initial/base visual-kick implementation and the default. |
|
| Use the WBC path when enabled, otherwise fall back to the configured non-WBC path; no model-name gate is applied. |
Lion Dance State Machine
The public header defines strict transition rules: The current firmware supports LionDancePrepare, LionDanceMove, and LionDanceStart on K1.
LionDancePrepare(start)can enter from Walking mode and can transition toLionDanceMoveorLionDanceStart.LionDanceMove(start)can enter fromLionDancePrepareand Walk Gait.LionDanceStart(dance_id)can enter only fromLionDancePrepareorLionDanceMove.
The public header does not define a named enum for LionDanceStart. The bundled SDK example accepts these values:
| Meaning |
|---|---|
| Firmware-defined lion-dance routine 1. |
| Firmware-defined lion-dance routine 2. |
Warning
Do not call LionDanceStart directly from any other state. The header warns that doing so causes abrupt arm-joint discontinuities and creates a hardware safety risk.
Status Queries
Method | Supported models | C++ output |
|---|---|---|
| K1, T1, T2 |
|
| K1, T1, T2 | Current mode, body control, and active action list. |
| K1, T1, T2 | Query trained-trajectory status and ID. Highlight an action only when the status is |
| K1, T1, T2 | Name, nickname, version, model, serial number, edition, and region. |
| K1, T1, T2 |
|
| K1, T1, T2 | Query the static IMU catalog into |
| K1, T1, T2 | Query the hand catalog into |
| K1, T1, T2 | Query the static URDF/RBDL robot-model catalog into |
Frame values used by GetFrameTransform:
Enum | Value | Meaning |
|---|---|---|
|
| Unknown or invalid frame. |
|
| Body/torso frame. |
|
| Head frame. |
|
| Left-hand frame. |
|
| Right-hand frame. |
|
| Left-foot frame. |
|
| Right-foot frame. |
current_body_control_ returned by GetStatus uses BodyControl:
Enum | Value | Meaning |
|---|---|---|
|
| Unknown control state. |
|
| Damping control. |
|
| Prepare/standing control. |
|
| Humanlike gait control. |
|
| Prone-body control for lie-down and push-up actions. |
|
| Soccer gait control. |
|
| Custom-mode control. |
|
| Get-up control. |
|
| Whole-body dance control. |
|
| Powerful-shot control. |
|
| Historical name for visual-kick V2 control. |
|
| Goalie control. |
|
| WBC gait control. |
|
| Lion-dance prepare pose. |
|
| Visual-kick V1 control. |
Each value in current_actions_ uses Action:
Enum | Value | Meaning |
|---|---|---|
|
| Unknown action. |
|
| Handshake. |
|
| Hand wave. |
|
| Hand control. |
|
| New Year dance. |
|
| Nezha dance. |
|
| Towards the Future dance. |
|
| Dabbing gesture. |
|
| Ultraman gesture. |
|
| Respect/salute gesture. |
|
| Cheering gesture. |
|
| Lucky-cat gesture. |
|
| Boxing gesture. |
|
| Zero-torque drag. |
|
| Trajectory recording is active. |
|
| Recorded-trajectory replay is active. |
C++ example:
booster::robot::b1::GetStatusResponse status;
if (client.GetStatus(status) == booster::robot::kRpcStatusCodeSuccess) {
std::cout << static_cast<int>(status.current_mode_) << "\n";
std::cout << static_cast<int>(status.current_body_control_) << "\n";
}
booster::robot::Transform transform;
if (client.GetFrameTransform(
booster::robot::Frame::kBody,
booster::robot::Frame::kLeftHand,
transform) == booster::robot::kRpcStatusCodeSuccess) {
std::cout << transform.position_.x_ << " "
<< transform.orientation_.w_ << "\n";
}
Custom Trained Trajectories
Use the following interfaces to manage custom trained trajectories:
Method | Supported models | Purpose | Minimum firmware |
|---|---|---|---|
| K1, T2 | Load trajectory/model configuration and return the robot-generated |
|
| K1, T2 | Activate a loaded trajectory using the exact ID returned by the load call. |
|
| K1, T1, T2 | Query the current trained-trajectory status and ID; a custom trajectory uses the ID returned by the load call. |
|
| K1, T2 | Unload an unused trajectory and release robot-side resources. |
|
File Recommendations
Use ONNX for both files:
CustomTrainedTraj::traj_file_path_: trajectory ONNX path, such as<trajectory.onnx>.CustomModel::file_path_: control-model ONNX path, such as<model.onnx>.
Important
LoadCustomTrainedTraj serializes and sends file paths and model parameters; it does not upload file contents. Place both ONNX files where the robot service can access them. Paths must be valid in the robot service environment, not only on the development computer.
Parameter Reference
Field | Purpose | Requirement |
|---|---|---|
| Scale model action outputs. | The length must match the controlled-joint dimension; use values from the training/export configuration. |
| Position gain for each controlled joint. | Length and order must match model outputs. |
| Velocity gain for each controlled joint. | Length and order must match model outputs. |
| List of model parameter groups. | A common configuration passes one group, |
| Joint ordering used by the model. | Use |
JointOrder values:
Enum | Value | Meaning |
|---|---|---|
|
| Use the MuJoCo export joint order. |
|
| Use the Isaac Lab export joint order. |
Choose joint_order_ from the model’s training/export order, not from the simulator running the application. action_scale_, kp_, and kd_ must have equal lengths.
Complete C++ Example
The following program reads the communication IP address, trajectory ONNX, and model ONNX from the command line, then loads, activates, and unloads the trajectory. The joint count and gains are placeholders; replace them with the model’s training values.
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
#include <booster/robot/b1/b1_loco_client.hpp>
#include <booster/robot/channel/channel_factory.hpp>
#include <booster/robot/rpc/error.hpp>
int main(int argc, char *argv[]) {
if (argc != 4) {
std::cerr << "Usage: " << argv[0]
<< " <network_ip> <trajectory.onnx> <model.onnx>\n";
return 1;
}
const std::string trajectory_onnx = argv[2];
const std::string model_onnx = argv[3];
booster::robot::ChannelFactory::Instance()->Init(0, argv[1]);
booster::robot::b1::B1LocoClient client;
client.Init();
if (!client.WaitForService(5000)) {
std::cerr << "Loco service is unavailable\n";
return 1;
}
// Replace these dimensions and values with the training configuration.
constexpr std::size_t kModelJointCount = 12;
std::vector<double> action_scale(kModelJointCount, 1.0);
std::vector<double> kp(kModelJointCount, 40.0);
std::vector<double> kd(kModelJointCount, 1.0);
booster::robot::b1::CustomModelParams model_params(
action_scale,
kp,
kd);
booster::robot::b1::CustomModel model(
model_onnx,
{model_params},
booster::robot::b1::JointOrder::kMuJoCo);
booster::robot::b1::CustomTrainedTraj trajectory(
trajectory_onnx,
model);
std::string trajectory_id;
int32_t ret = client.LoadCustomTrainedTraj(
trajectory,
trajectory_id);
if (ret != booster::robot::kRpcStatusCodeSuccess) {
std::cerr << "LoadCustomTrainedTraj failed: " << ret << "\n";
return 1;
}
std::cout << "Loaded trajectory ID: " << trajectory_id << "\n";
ret = client.ActivateCustomTrainedTraj(trajectory_id);
if (ret != booster::robot::kRpcStatusCodeSuccess) {
std::cerr << "ActivateCustomTrainedTraj failed: " << ret << "\n";
const int32_t cleanup_ret =
client.UnloadCustomTrainedTraj(trajectory_id);
if (cleanup_ret != booster::robot::kRpcStatusCodeSuccess) {
std::cerr << "Cleanup unload failed: " << cleanup_ret << "\n";
}
return 1;
}
std::cout << "Trajectory activated. Press Enter to unload.\n";
std::cin.get();
ret = client.UnloadCustomTrainedTraj(trajectory_id);
if (ret != booster::robot::kRpcStatusCodeSuccess) {
std::cerr << "UnloadCustomTrainedTraj failed: " << ret << "\n";
return 1;
}
return 0;
}
Run it as follows:
./my_custom_trajectory <network_ip> <trajectory.onnx> <model.onnx>
If loading fails, first confirm that both paths are readable by the robot service. Then check the three parameter-array lengths, joint_order_, and the model export configuration. See RPC Error Codes for RPC status codes.
Complete LocoApiId Values
LocoApiId values are business operation identifiers in the locomotion service protocol. Typed client methods map to these IDs; the values must remain synchronized with the service. kPushUp is a protocol enum without a high-level convenience wrapper.
Enumerator | Value | Business meaning |
|---|---|---|
| 2000 | Change robot mode. |
| 2001 | Planar linear and angular velocity control. |
| 2004 | Head target orientation. |
| 2005 | Hand-wave action. |
| 2006 | Continuous directional head rotation. |
| 2007 | Model-configured lie-down trajectory. |
| 2008 | Get-up action. |
| 2009 | Single-hand end-effector control (V1/V2 share this ID). |
| 2010 | Gripper control. |
| 2011 | Frame-transform query. |
| 2012 | Legacy end-effector mode switch (deprecated). |
| 2013 | Per-finger dexterous-hand control. |
| 2015 | Handshake action. |
| 2016 | Upper-body dance or gesture. |
| 2017 | Query the current robot mode. |
| 2018 | Query mode, body control, and action status. |
| 2019 | Generic-RPC nested push-up trajectory; no high-level |
| 2020 | Play an audio file on the robot. |
| 2021 | Stop the current audio. |
| 2022 | Query robot identity. |
| 2023 | Stop end-effector motion. |
| 2024 | Powerful kick. |
| 2025 | Get up into a selected mode. |
| 2026 | Zero-torque drag. |
| 2027 | Start or stop trajectory recording. |
| 2028 | Replay a robot-side trajectory file. |
| 2029 | Execute a whole-body dance or action. |
| 2030 | Start or stop upper-body custom control. |
| 2031 | Reset odometry. |
| 2032 | Load a custom trained trajectory. |
| 2033 | Activate a loaded trained trajectory. |
| 2034 | Unload a loaded trained trajectory. |
| 2035 | Enter WBC gait. |
| 2036 | Exit WBC gait. |
| 2037 | Synchronized dual-hand end-effector control. |
| 2038 | Visual kick. |
| 2039 | Enter or leave lion-dance preparation. |
| 2040 | Start a specified lion-dance routine. |
| 2041 | Start or stop lion-dance locomotion. |
| 2042 | Switch gait implementation. |
| 2043 | Timed head rotation. |
| 2044 | Query the configured IMU catalog. |
| 2045 | Query the configured hand catalog. |
| 2046 | Query the static robot model. |
| 2047 | Query trained-trajectory status. |
| 2050 | T2 chest-greeting action. |
Additional State and Hardware Enums
Enum | Member (value) | Meaning |
|---|---|---|
|
| Unknown or unavailable prone-controller state. |
|
| Prone-body controller is inactive. |
|
| Push-up posture or activity. |
|
| Lying-down posture. |
|
| Soccer locomotion posture. |
|
| Soccer kicking posture. |
|
| RoboCup behavior execution is in progress. |
|
| RoboCup shot execution is in progress. |
|
| RoboCup pass execution is in progress. |
|
| No trained trajectory is executing. |
|
| A trained trajectory is executing. |
|
| Linux remote controller has no event. |
|
| Linux remote-controller analog-axis event. |
|
| Linux remote-controller directional-hat event. |
|
| Linux remote-controller button-press event. |
|
| Linux remote-controller button-release event. |
|
| Linux remote-controller device-removal event. |
|
| T2 bow-and-arrow full-body routine. |
|
| T2 Charleston full-body dance. |
JointIndex, JointIndexK1, and JointIndexWith7DofArm are complete low-level array layouts. Pair each layout with its robot model and matching kJointCnt constant:
Layout | Members and indices | Count |
|---|---|---|
|
| 23 |
|
| 22 |
|
| 29 |
Payload and response field index
The public payload fields in b1_loco_api.hpp are summarized below. Pose fields use the robot base/torso frame, angles are in radians, positions in metres, and JSON field names omit the trailing member underscore.
Type | Fields | Business meaning |
|---|---|---|
|
| Target head pitch/yaw angles in radians. |
|
| Target head angles and requested duration in milliseconds. |
|
| Target robot mode; |
|
| Target gait implementation; availability follows the active state graph. |
|
| Current mode. |
|
| Current mode, body control, and active action list. |
|
| Robot identity and firmware metadata. |
|
| Planar X/Y linear velocities (m/s) and yaw velocity (rad/s). |
|
| Head-joint directions; only -1, 0, and 1 are valid. |
|
| Get-up implementation; |
|
| Get-up implementation and resulting mode; T2 |
|
| Target hand and start/stop action; start is supported on K1, T1, T2 and stop on K1, T1. |
|
| Handshake start/stop action; the current T1_7DofArm configuration may refuse it. |
|
| T2 chest-greeting arm switch; lowering requires the raised pose to be active. |
|
| Single-hand target, optional auxiliary posture, duration, side, and orientation semantics. |
|
| Gripper target position, reaction force, and motion-speed scales. |
|
| Gripper motion parameters, position/force mode, and target hand. |
|
| Synchronized dual-hand targets and duration. |
|
| Source and destination frames. |
|
| Deprecated legacy hand end-effector mode switch; the state-manager backend may return BadRequest. |
|
| Finger/axis index and target angle, force, and speed scales. |
|
| Finger command list, target hand, and installed hand type; requires compatible hardware from |
|
| Upper-body dance or gesture ID; supported on K1 and T1. |
|
| Whole-body dance ID; K1 uses 0–9 and T2 uses bow-and-arrow/Charleston. |
|
| Audio path resolved by the robot service. |
|
| Trajectory path resolved by the robot service. |
|
| K1/T1 zero-torque drag switch. |
|
| K1/T1 trajectory-recording switch. |
|
| Upper-body custom-control switch; low-level commands must use the matching model layout. |
|
| Per-joint action scale, position gain, and velocity gain; lengths must match. |
|
| Control-model file, parameter sets, and joint ordering. |
|
| Complete trained-trajectory load request; supported on K1 and T2. |
|
| Service-assigned trajectory identifier; supported on K1 and T2. |
|
| Trajectory ID used by activate/unload operations; supported on K1 and T2. |
|
|
|
|
| Visual-kick switch and implementation version. |
|
| K1 lion-dance preparation-pose switch. |
|
| K1 lion-dance locomotion switch; enter from preparation or Walk Gait. |
|
| K1 service-defined lion-dance routine index; enter only from preparation or locomotion. |
Additional state enums
ProneBodyControlPosture:kUnknown=0unknown,kInactive=1inactive,kPushUp=2push-up,kLieDown=3lying down,kSoccerLocomotion=4soccer locomotion, andkSoccerKicking=5soccer kicking.RobocupBehaviorStatus:RUNNING=0running,SHOOTING=1shooting, andPASSING=2passing.TrainedTrajStatus:kIdle=0no trajectory running andkRunning=1executing.WholeBodyDanceIdalso includes T2kBowAndArrow=10andkCharlestonDance=11; ID 4 is undefined and must not be sent.
The per-member descriptions for JointIndex, JointIndexK1, JointIndexWith7DofArm, HandIndex, BoosterHandType, HandAction, and RemoteControllerEvent are in Low-Level Topics.