Skip to content

rbq_example_level_0

Sample C++ application under rbq_examples that demonstrates low-level (LV0-style) communication with the RBQ stack: subscribe to IMU, joystick, and leg joint topics, publish leg motion references and joint-ownership commands, and optionally run a learned walking policy (ONNX) passed on the command line.

Before building or running this example, build and install RBQ SDK. Without the SDK (or if CMake cannot find it), the rbq_examples build will fail.

Behavior summary

  • A control loop thread exchanges DDS messages with the running RBQ motion stack (hardware or simulation started with scripts/sim.bash).
  • Idle: tracks the stack’s final leg reference and publishes a compatible MotionRef.
  • Motion (sit / stand keys): uses JointControl to interpolate poses, then publishes references and ownership as needed.
  • Walk / Control: loads policy from -p, runs ONNX inference with IMU + joint + command observations, publishes MotionRef with policy gains.

Build (rbq_examples/)

  1. Install dependencies per repository scripts (for ONNX, see rbq_examples/scripts/install/apt.bash, etc.).

  2. Ensure rbq_sdk is installed; if not in the default prefix, add the install prefix to CMAKE_PREFIX_PATH.

  3. From rbq_examples:

    bash
    bash scripts/setup.bash    # system dependencies, etc. (do not run setup.bash with sudo)
    bash scripts/build.bash

    Per the build script, outputs are placed under the project’s bin/, etc.

Policy bundle (-p)

Walking mode needs a policy directory containing info.json and the ONNX expected by rbq_sdk::Policy / PolicyParams.

Example:

bash
./bin/rbq_example_level_0 -p ./../resources/policy/rbq10_trot/

The application requires -p.

Run with simulation

  1. From the RBQ repository root, start the stack (sim Motion + MuJoCo + GUI) per the Developers guide:

    bash
    bash scripts/sim.bash
  2. In the GUI, follow the manual for simulator connect, then control start. For the stack to be controllable, Auto Start (or equivalent) must bring the motion/control path up; skipping steps can prevent the example from receiving topics.

  3. After building, from rbq_examples, run:

    bash
    ./bin/rbq_example_level_0 -p ./../resources/policy/rbq10_trot/

Use sudo if you need the real-time control thread path; without root, a normal thread is used.

Keyboard and controls

A help screen is printed at startup. Typical bindings (exact list: source printHelp()):

KeyAction
qQuit
zMotion sit / ground sequence
xMotion stand / ready sequence
cControl / walk mode (uses policy from -p)

In control mode, gamepad axes provide velocity-style commands (see on-screen help).

DDS topics

The example uses string topics such as:

  • Subscribe: rt/rbq/cmd/joy/final, rt/rbq/info/imu, rt/rbq/info/leg_joint, rt/rbq/ref/leg_joint/final, etc.
  • Publish: rt/rbq/ref/leg_joint/owner_20, rt/rbq/cmd/motion/joint_owner/20, etc.

Exact names and semantics must match the robot software version you run.

Troubleshooting

  • No motion / no topics: Check that sim.bash (or the hardware stack) is running and DDS uses the correct network interface.
  • Policy errors: Check -p is valid, ONNX matches the installed onnxruntime, and info.json type (rbq10, rbq10_trot, etc.) matches.
  • apt authentication errors, etc.: fix host GPG/sources separately; not specific to this example.

See also

This user manual is intended for RBQ users.