Skip to content

JM020117/ocs2_ros2

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OCS2_ROS2 Toolbox

1. Summary

OCS2_ROS2 is developed based on OCS2, it was refactored to be compatible with ROS2 and modern cmake.

What's New (2025.08)

Pinocchio 3 Dependency Optimization

  • Upgraded to Pinocchio 3 version for better performance and stability
  • Support for installing Pinocchio from ROS sources, avoiding complex third-party package management

Dual-Arm Mobile Manipulator Support

  • Added Dual-Arm Mobile Manipulator functionality
  • Enhanced interactive markers for better user operation experience

The IDE I used is CLion, you can follow the guide to set up the IDE.

Tested Platform

  • Intel Nuc X15 (i7-11800H):
    • Ubuntu 22.04 ROS2 Humble (WSL2 included)
    • Ubuntu 24.04 ROS2 Jazzy (WSL2 included)
  • Lenovo P16v (i7-13800H):
    • Ubuntu 24.04 ROS2 Jazzy
  • Jetson Orin Nano
    • Ubuntu 22.04 ROS2 Humble (JetPack 6.1)

2. Installation

2.1 Prerequisites

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 24.04 ROS2 Jazzy
  • Ubuntu 22.04 ROS2 Humble

2.2 Dependencies

  • C++ compiler with C++17 support
  • Eigen (v3.4)
  • Boost C++ (v1.74)

Note: Latest version used pinocchio from ros source to simplified install steps. If you install pinocchio from robot-pkgs, you can uninstall it by

sudo apt remove robotpkg-*

2.3 Clone Repositories

  • 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 -y

3. Basic Examples

This section contains basic examples for the OCS2 library.

🎯 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.py
double_interger.webm
πŸ›’ 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.py
cart.pole.webm
πŸ€ 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.py
ballbot.webm
🚁 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.py
quadrotor.webm
🦾 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.py
mabi-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.py
franka.webm
  • run Willow Garage PR2
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros pr2.launch.py
pr2.webm
  • run Clearpath Ridgeback with UR-5
source ~/ros2_ws/install/setup.bash
ros2 launch ocs2_mobile_manipulator_ros manipulator_ridgeback_ur5.launch.py 
πŸ• 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.py
trot.webm

4. Advanced Examples

perceptive_side

perceptive_hurdles

raisim

raisim_rviz

5. Related Projects

About

ROS2 version of OCS2, refactor with modern-cmake

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.9%
  • Python 3.8%
  • CMake 1.9%
  • C 0.4%