Skip to content

Target Go — ROS2 Example

Source: rbq_sdk/ros2/src/rbq_examples/src/rbq_target_go.cpp

ROS 2 port of Target Go. Publishes a single rbq_msgs/TargetGo to command the robot to walk to a target pose (x, y, heading). The on-robot Network process (started by sim.bash / Motion) consumes it directly over CycloneDDS — there is no separate driver node to run.

Prerequisites

  • ROS 2 Humble installed and sourced; RBQ ROS2 SDK built — see ROS2 SDK Overview.
  • RMW_IMPLEMENTATION=rmw_cyclonedds_cpp on domain 0, with CYCLONEDDS_URI selecting the same interface as the robot/sim.
  • Robot stack running and in control / standing — otherwise QuadWalk replies Can't Receive cmd: CON_START first.

Build

bash
cd RBQ/rbq_sdk/ros2
rosdep install --from-paths src -y --ignore-src
colcon build --symlink-install
source install/setup.bash

Run

bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI=file:///path/to/cyclonedds.xml    # interface matching the robot/sim
ros2 run rbq_examples rbq_target_go -- [x] [y] [theta] [gait] [mode]
# simulator, 1 m forward with wave gait:
ros2 run rbq_examples rbq_target_go -- 1.0 0.0 0.0 0 0

Positional args come after -- (ROS 2 strips its own flags first):

ArgMeaningDefault
xtarget X (m), relative to robot start1.0
ytarget Y (m), relative to robot start0.0
thetatarget heading (rad)0.0
gait0=wave / 1=stairs / 2=RL0
mode0=rot→straight→rot / 1=rot→diag / 2=diag→rot / 3=rot+diag simultaneous0

Message

The example fills and publishes one rbq_msgs/TargetGo on /rbq/cmd/target_go (the node publishes the unqualified name rbq/cmd/target_go, which resolves to /rbq/cmd/target_go; QuadWalk subscribes on the DDS name rt/rbq/cmd/target_go).

FieldTypeDescription
gaitint32Locomotion gait: 0=wave, 1=stairs, 2=RL
modeint32Approach mode: 0=rot→straight→rot, 1=rot→diag, 2=diag→rot, 3=rot+diag simultaneous
xfloat32Target X (m), relative to robot start
yfloat32Target Y (m), relative to robot start
thetafloat32Target heading (rad)
offset_xfloat32Approach offset X (m) — the example sends 0
offset_yfloat32Approach offset Y (m) — the example sends 0
slowboolSlow approach — the example sends false
wideboolWide-stance approach — the example sends false
visionboolUse vision height feedback — the example sends false

Example output

[rbq_target_go]: published: gait=0 mode=0 x=1.00 y=0.00 theta=0.000

Verified against the MuJoCo simulator with rmw_cyclonedds_cpp — the command crosses the ROS2 ↔ CycloneDDS boundary and QuadWalk receives it on rt/rbq/cmd/target_go (logs Can't Receive cmd: CON_START first until control is started).

See also

This user manual is intended for RBQ users.