OCS2_ROS2 is developed based on OCS2, it was refactored to be compatible with ROS2 and modern cmake.
Omni-Wheel Mobile Manipulator Support
- Add
OmniWheelBasedMobileManipulatorkinematics for planar holonomic bases (omni-wheel / mecanum). - Mobile manipulator MPC previously covered differential-drive bases; this model adds body-frame
(vx, vy, omega)inputs so the planner can command true omnidirectional motion. - Wired through factory dimensions, Pinocchio mapping, and the mobile manipulator interface (
modelType: omniWheelBasedMobileManipulatorin the task.infofile).
ROS 2 Lyrical Support
- Add support for ROS 2 Lyrical on Ubuntu 26.04.
- Modernize launch files for newer
robot_state_publisher: URDF files are now parsed and passed through therobot_descriptionparameter instead of the removed positional URDF path argument. - Replace deprecated
tf2/tf2_ros.hincludes with.hppheaders for Jazzy and Lyrical compatibility. - Remove dependency on the removed
urdf::exportURDFAPI by keeping the original URDF XML inside the Pinocchio interface. - Make RViz plugins select the matching Qt major version automatically (
Qt5on Jazzy,Qt6on Lyrical). - Avoid OctoMap ABI conflicts by letting the collision backend own its native OctoMap linkage.
- Default launch terminal prefix is now
xterm -e, which works better in WSL and container environments such as distrobox. Override it withOCS2_TERMINAL_PREFIXif needed.
Environment Collision for Mobile Manipulator
- Add basic geometry environment collision support.
- See the Franka demo for more details.
- Intel Nuc X15 (i7-11800H):
- Ubuntu 22.04 ROS2 Humble (WSL2 included)
- Ubuntu 24.04 ROS2 Jazzy (WSL2 included)
- Ubuntu 26.04 ROS2 Lyrical (distrobox)
- Lenovo P16v (i7-13800H):
- Ubuntu 24.04 ROS2 Jazzy
- Jetson Orin Nano
- Ubuntu 22.04 ROS2 Humble (JetPack 6.1)
The OCS2 library is written in C++17. It is tested under Ubuntu with library versions as provided in the package sources.
Tested system and ROS2 version:
- Ubuntu 26.04 ROS2 Lyrical
- Ubuntu 24.04 ROS2 Jazzy
- Ubuntu 22.04 ROS2 Humble
Note: Some demos open auxiliary nodes in a new terminal. The default terminal prefix is
xterm -efor better compatibility with WSL and distrobox. Install it if necessary:sudo apt install xtermYou can override the terminal prefix, for example:
export OCS2_TERMINAL_PREFIX="gnome-terminal --"
- C++ compiler with C++17 support
- Eigen (v3.4)
- Boost C++ (v1.74)
Note: The latest version uses Pinocchio from the ROS distribution to simplify installation. If you previously installed Pinocchio from
robotpkg, uninstall it with:sudo apt remove robotpkg-*
Prebuilt .deb packages bundle the OCS2 core stack and all basic examples listed in Section 3. This is the fastest way to run the demos if you do not need to modify the source code.
| ROS 2 distro | Ubuntu | Debian package | Install prefix |
|---|---|---|---|
| Jazzy | 24.04 (Noble) | ros-jazzy-ocs2 |
/opt/ros/jazzy |
| Lyrical | 26.04 (Resolute) | ros-lyrical-ocs2 |
/opt/ros/lyrical |
Prerequisites
- Install the matching ROS 2 base from docs.ros.org (e.g.
ros-jazzy-ros-baseorros-lyrical-ros-base). - Install
xterm(used by several example launch files to open MPC / dummy nodes in separate terminals):sudo apt install xterm
Download and install
Pick the asset that matches your distro and CPU architecture (amd64 or arm64) from the GitHub Releases page.
| Trigger | GitHub Release | Notes |
|---|---|---|
PR merged into ros2 |
rolling pre-release |
Overwrites assets each merge; deb Version is latest.patch+N~main.<sha> |
Push v* tag / manual dispatch |
formal vX.Y.Z |
Stable installs |
Example for pre-release (Jazzy amd64):
gh release download pre-release --repo legubiao/ocs2_ros2 --pattern 'ros-jazzy-ocs2_*_amd64.deb'
sudo dpkg -i ros-jazzy-ocs2_*_amd64.deb
sudo apt-get install -fExample for ROS 2 Jazzy on amd64 (replace VERSION with the release tag, e.g. 1.0.0):
wget https://github.com/legubiao/ocs2_ros2/releases/download/vVERSION/ros-jazzy-ocs2_VERSION_amd64.deb
sudo dpkg -i ros-jazzy-ocs2_VERSION_amd64.deb
sudo apt-get install -f # if apt reports missing dependenciesExample for ROS 2 Lyrical on amd64:
wget https://github.com/legubiao/ocs2_ros2/releases/download/vVERSION/ros-lyrical-ocs2_VERSION_amd64.deb
sudo dpkg -i ros-lyrical-ocs2_VERSION_amd64.deb
sudo apt-get install -fUse the installed packages
# Jazzy:
source /opt/ros/jazzy/setup.bash
# Lyrical:
# source /opt/ros/lyrical/setup.bashThen follow the run steps in Section 3 (skip the build steps). For example:
ros2 launch ocs2_double_integrator_ros double_integrator.launch.pyTo confirm the install:
ros2 pkg list | grep ocs2_
dpkg -L ros-jazzy-ocs2 # or ros-lyrical-ocs2Note: The deb installs into the same prefix as your system ROS packages. You only need to
source /opt/ros/<distro>/setup.bashonce per shell. Advanced examples underadvance examples/are not included in the deb; build those from source if needed (Section 2.4).
- Create a new workspace or clone the project to your workspace
cd ~
mkdir -p ros2_ws/src- Clone the repository
cd ~/ros2_ws/src
git clone https://github.com/legubiao/ocs2_ros2
cd ocs2_ros2
git submodule update --init --recursive- rosdep
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -yThis section contains basic examples for the OCS2 library.
If you installed the prebuilt deb (Section 2.3), skip the build steps in each example: source /opt/ros/<distro>/setup.bash and run the ros2 launch command directly. To build from source instead, use Section 2.4 and the build commands below.
π― Click to expand Double Integrator example
- build
cd ~/ros2_ws
colcon build --packages-up-to ocs2_double_integrator_ros --symlink-install- run
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_double_integrator_ros double_integrator.launch.pydouble_interger.webm
3.2 Cartpole
π Click to expand Cartpole example
- build
cd ~/ros2_ws
colcon build --packages-up-to ocs2_cartpole_ros --symlink-install- run
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_cartpole_ros cartpole.launch.pycart.pole.webm
3.3 Ballbot
π Click to expand Ballbot example
- build
cd ~/ros2_ws
colcon build --packages-up-to ocs2_ballbot_ros --symlink-install- run
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_ballbot_ros ballbot_ddp.launch.pyballbot.webm
3.4 Quadrotor
π Click to expand Quadrotor example
- build
cd ~/ros2_ws
colcon build --packages-up-to ocs2_quadrotor_ros --symlink-install- run
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_quadrotor_ros quadrotor.launch.pyquadrotor.webm
Supported base model types include fixed-base / floating-arm manipulators, differential-drive (wheelBasedMobileManipulator), and omni-wheel / mecanum (omniWheelBasedMobileManipulator). Set modelType in the task .info file accordingly.
π¦Ύ Click to expand Mobile Manipulator example
- build
cd ~/ros2_ws
colcon build --packages-up-to ocs2_mobile_manipulator_ros --symlink-install- run Mabi-Mobile
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros manipulator_mabi_mobile.launch.pymabi-mobile.webm
- run Kinova Jaco2
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros manipulator_kinova_j2n6.launch.py- run Franka Panda
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros franka.launch.pysource ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros franka_sqp.launch.pyfranka.webm
- run Willow Garage PR2
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros pr2.launch.pypr2.webm
- run Clearpath Ridgeback with UR-5
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros manipulator_ridgeback_ur5.launch.py 3.6 Legged Robot
π Click to expand Legged Robot example
- build
cd ~/ros2_ws
colcon build --packages-up-to ocs2_legged_robot_ros --symlink-install- run
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_legged_robot_ros legged_robot_ddp.launch.pytrot.webm
4.3 MPC-Net
- quadruped_ros2_control: Quadruped controller based on OCS2 ROS2
- arms_ros2_control: Mobile manipulator controller based on OCS2 ROS2
- robot_descriptions: Additional robot configs for OCS2 ROS2




