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
JointControlto interpolate poses, then publishes references and ownership as needed. - Walk / Control: loads policy from
-p, runs ONNX inference with IMU + joint + command observations, publishesMotionRefwith policy gains.
Build (rbq_examples/)
Install dependencies per repository scripts (for ONNX, see
rbq_examples/scripts/install/apt.bash, etc.).Ensure
rbq_sdkis installed; if not in the default prefix, add the install prefix toCMAKE_PREFIX_PATH.From
rbq_examples:bashbash scripts/setup.bash # system dependencies, etc. (do not run setup.bash with sudo) bash scripts/build.bashPer 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:
./bin/rbq_example_level_0 -p ./../resources/policy/rbq10_trot/The application requires -p.
Run with simulation
From the RBQ repository root, start the stack (sim Motion + MuJoCo + GUI) per the Developers guide:
bashbash scripts/sim.bashIn 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.
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()):
| Key | Action |
|---|---|
q | Quit |
z | Motion sit / ground sequence |
x | Motion stand / ready sequence |
c | Control / 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
-pis valid, ONNX matches the installed onnxruntime, andinfo.jsontype (rbq10,rbq10_trot, etc.) matches. - apt authentication errors, etc.: fix host GPG/sources separately; not specific to this example.
