Target Go — C++ Example
Source: rbq_sdk/cpp/example/src/rbq_target_go.cpp
A one-shot publisher that commands the robot to walk to a target pose (x, y, heading) with a chosen gait and approach mode. It publishes a single TargetGo message on rt/rbq/cmd/target_go and exits.
How it works
- Reads
interfaceand optionalx y theta gait modefrom the command line. - Initializes the DDS
ChannelFactoryon the given interface and creates aPublisher<TargetGo_>onrt/rbq/cmd/target_go. - Waits ~500 ms for DDS discovery, fills the
TargetGofields, publishes once, prints what it sent, and exits.
The on-robot QuadWalk locomotion engine subscribes to rt/rbq/cmd/target_go and executes the walk.
Prerequisites
- RBQ SDK built and installed — see C++ SDK Overview.
- The robot stack running (simulator or hardware) and reachable on the same DDS interface.
- The robot must be powered on / in control and standing first. If you publish a target before control is started, QuadWalk rejects it with
Can't Receive cmd: CON_START first.
Build
From rbq_sdk/cpp/example/:
bash scripts/setup.bash
bash scripts/build.bashBinary: bin/rbq_target_go
Run
./bin/rbq_target_go <interface> [x] [y] [theta_deg] [gait] [mode]
# simulator, 1 m forward with wave gait:
./bin/rbq_target_go lo 1.0 0.0 0.0 0 0Use the same interface as the running robot/sim (lo or your NIC). If discovery finds nothing, see the interface note on the Image Echo page (lo is often not multicast-capable; use a real NIC such as enp3s0).
Arguments (from the example's own usage):
| Arg | Meaning | Default |
|---|---|---|
interface | CycloneDDS interface (lo sim / NIC real) | required |
x | target X (m), relative to start | 1.0 |
y | target Y (m), relative to start | 0.0 |
theta_deg | target heading | 0.0 |
gait | 0=wave / 1=stairs / 2=RL | 0 |
mode | 0=rot→straight→rot / 1=rot→diag / 2=diag→rot / 3=rot+diag | 0 |
Example output
[rbq_target_go] published: gait=0 mode=0 x=1 y=0 theta=0The program publishes once and exits; the robot then walks to the target. Verified against the MuJoCo simulator — QuadWalk receives the command on rt/rbq/cmd/target_go; with the robot not yet in control it logs Can't Receive cmd: CON_START first, so start control (power on + stand) before sending a target.
