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_cppon domain 0, withCYCLONEDDS_URIselecting 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
cd RBQ/rbq_sdk/ros2
rosdep install --from-paths src -y --ignore-src
colcon build --symlink-install
source install/setup.bashRun
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 0Positional args come after -- (ROS 2 strips its own flags first):
| Arg | Meaning | Default |
|---|---|---|
x | target X (m), relative to robot start | 1.0 |
y | target Y (m), relative to robot start | 0.0 |
theta | target heading (rad) | 0.0 |
gait | 0=wave / 1=stairs / 2=RL | 0 |
mode | 0=rot→straight→rot / 1=rot→diag / 2=diag→rot / 3=rot+diag simultaneous | 0 |
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).
| Field | Type | Description |
|---|---|---|
gait | int32 | Locomotion gait: 0=wave, 1=stairs, 2=RL |
mode | int32 | Approach mode: 0=rot→straight→rot, 1=rot→diag, 2=diag→rot, 3=rot+diag simultaneous |
x | float32 | Target X (m), relative to robot start |
y | float32 | Target Y (m), relative to robot start |
theta | float32 | Target heading (rad) |
offset_x | float32 | Approach offset X (m) — the example sends 0 |
offset_y | float32 | Approach offset Y (m) — the example sends 0 |
slow | bool | Slow approach — the example sends false |
wide | bool | Wide-stance approach — the example sends false |
vision | bool | Use 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.000Verified 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).
