Skip to content

Target Go — Python Example

Source: rbq_sdk/python/example/sport/rbq_target_go.py

Python port of the C++ Target Go. Commands the robot to walk to a target pose (x, y, heading) with a chosen gait by publishing a single TargetGo message on rt/rbq/cmd/target_go.

How it works

  1. Reads interface and optional x y theta gait mode from the command line.
  2. Calls ChannelFactoryInitialize(0, interface), then creates ChannelPublisher("rt/rbq/cmd/target_go", TargetGo_).
  3. Waits ~0.5 s for DDS discovery, fills the TargetGo_ message, publishes once, prints what it sent, and exits.

The on-robot QuadWalk locomotion engine subscribes to the topic and executes the walk.

Prerequisites

  • rbq_sdk_py importable — see Python SDK Overview.
  • Robot stack running (simulator or hardware) on the same DDS interface.
  • The robot must be powered on / in control and standing first. Otherwise QuadWalk rejects the command with Can't Receive cmd: CON_START first.

Run

bash
cd RBQ/rbq_sdk/python/example/sport
python3 rbq_target_go.py <networkInterface> [x] [y] [theta_deg] [gait] [mode]
# simulator, 1 m forward with wave gait:
python3 rbq_target_go.py lo 1.0 0.0 0.0 0 0

Arguments, gaits and modes are identical to the C++ version. Use the same interface as the running robot/sim (see the Image Echo interface note — lo is often not multicast-capable).

Example output

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

Verified against the MuJoCo simulator — QuadWalk receives the command on rt/rbq/cmd/target_go (it logs Can't Receive cmd: CON_START first until control is started, then walks).

This user manual is intended for RBQ users.