Skip to content

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

  1. Reads interface and optional x y theta gait mode from the command line.
  2. Initializes the DDS ChannelFactory on the given interface and creates a Publisher<TargetGo_> on rt/rbq/cmd/target_go.
  3. Waits ~500 ms for DDS discovery, fills the TargetGo fields, 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
bash scripts/setup.bash
bash scripts/build.bash

Binary: bin/rbq_target_go

Run

bash
./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 0

Use 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):

ArgMeaningDefault
interfaceCycloneDDS interface (lo sim / NIC real)required
xtarget X (m), relative to start1.0
ytarget Y (m), relative to start0.0
theta_degtarget heading0.0
gait0=wave / 1=stairs / 2=RL0
mode0=rot→straight→rot / 1=rot→diag / 2=diag→rot / 3=rot+diag0

Example output

[rbq_target_go] published: gait=0 mode=0 x=1 y=0 theta=0

The 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.

This user manual is intended for RBQ users.