Minimal ROS 2 control package that embeds the OCS2 mobile manipulator MPC stack in a ros2_control workflow. It provides:
-
A fake hardware plugin (
RidgebackUr5Hardware) that simulates Ridgeback + UR5 mobile manipulator (differential-drive mobile robot + 6-axis arm). -
An
Ocs2Ros2Controllerwhich bridges the hardware state to the OCS2 MRT/MPC interface and streams back the optimal commands.
The package is intentionally self‑contained (urdf/xacro, task and rviz config), but it depends on the upstream OCS2 ROS 2 repositories for the solver libraries and marker/MPC nodes.
- Install ROS 2 Humble (or a newer distro with the same APIs).
- Clone and build
wei-hsuan-cheng/ocs2_ros2up toocs2_mobile_manipulator_rospkg:cd ~/ros2_ws colcon build --packages-up-to ocs2_mobile_manipulator_ros --symlink-install
- Make sure the
ocs2_ros2workspace is sourced before building this package.
- Make sure the
# Build and install
cd ~/ros2_ws
colcon build --symlink-install --packages-select ocs2_ros2_control && . install/setup.bash
# Run ridgeback_ur5 demo with an interactive marker (default)
ros2 launch ocs2_ros2_control ridgeback_ur5_bringup.launch.py commandType:=marker
# Or: constant twist target for the mobile base + end-effector
ros2 launch ocs2_ros2_control ridgeback_ur5_bringup.launch.py commandType:=twist
# Or: figure-eight end-effector trajectory target
ros2 launch ocs2_ros2_control ridgeback_ur5_bringup.launch.py commandType:=trajectoryIf you built ocs2_ros2 in another workspace, source it before running the commands above (so their messages and plugins are discoverable).
The demo launch file starts:
ros2_control_nodewith the fake Ridgeback + UR5 hardware and theOcs2Ros2Controller.- The
joint_state_broadcasterthat publsihesjoint_statesfrom hardware. - A target/command node selected via
commandType(marker,twist, ortrajectory). - OCS2 MPC and marker nodes from
ocs2_mobile_manipulator_ros. - RViz (unless
rviz:=false) with the copied visualization config.
Useful arguments:
| Argument | Default | Description |
|---|---|---|
rviz |
true |
Enable/disable RViz + interactive marker. |
taskFile |
local | Path to the OCS2 task.info file. |
libFolder |
local | Folder containing the auto-generated OCS2 libs. |
urdfFile |
local | URDF used by visualization nodes. |
commandType |
marker |
Target interface to start: marker, twist, or trajectory. |
markerPublishRate |
100.0 |
Interactive marker publish rate (Hz, commandType=marker). |
auto_generated/ -> pre-built OCS2 libraries (CppAD) for Ridgeback + UR5
config/ -> ros2_control YAML + task files
description/ -> xacro/urdf assets (ros2_control settings included)
include/ -> Header files
rviz/ -> RViz configuration copied from OCS2 examples
src/
control/ -> ros2_control controllers (OCS2 bridge)
hardware/ -> Ridgeback + UR5 fake_hardware (SystemInterface)
visualization/ -> Marker, trajectory, and pose visualizations in RViz2- The fake hardware integrates velocities directly; it is intended for controller bring-up and visualization only.
auto_generated/ridgeback_ur5is copied from the OCS2 examples for convenience. Regenerate those libraries if you modify the task model.- The OCS2 MPC core process is provided by
ocs2_mobile_manipulator_ros, make sure that package is present (from the upstream repo mentioned above).
- Author: Wei-Hsuan Cheng (johnathancheng0125@gmail.com)
- Homepage: wei-hsuan-cheng
- GitHub: wei-hsuan-cheng