C++ and Python examples of using MoveIt 2 for planning motions that are executed inside Ignition Gazebo simulation environment. These examples make use of ros2_control via gz_ros2_control.
The interaction among different ROS 2, MoveIt 2 and Gazebo components is further documented in docs/README.md, alongside suggestions for implementing a similar setup on your custom robot.
For legacy approach using
JointTrajectoryController
Ignition plugin, please see legacy_jtc_ign_plugin branch.
Follow Target | Throw Object |
At the time of writing these examples, there were no official Python bindings for MoveIt 2. Therefore, pymoveit2 module is employed as the MoveIt 2 interface in all Python examples.
These are the primary dependencies required to use this project.
All additional dependencies are either pulled via vcstool (ign_moveit2_examples.repos) or installed via rosdep during the building process below.
Clone this repository, import dependencies, install dependencies and build with colcon.
# Clone this repository into your favourite ROS 2 workspace
git clone https://github.com/AndrejOrsula/ign_moveit2_examples.git
# Import dependencies
vcs import < ign_moveit2_examples/ign_moveit2_examples.repos
# Install dependencies
IGNITION_VERSION=fortress rosdep install -y -r -i --rosdistro ${ROS_DISTRO} --from-paths .
# Build
colcon build --merge-install --symlink-install --cmake-args "-DCMAKE_BUILD_TYPE=Release"
Before utilising this package, remember to source the ROS 2 workspace.
source install/local_setup.bash
This enables:
- Execution of binaries, scripts and examples via
ros2 run ign_moveit2_examples <executable>
- Launching of setup scripts via
ros2 launch ign_moveit2_examples <launch_script>
- Discoverability of shared resources
In order to run any of the included examples, just launch the corresponding script.
# C++
ros2 launch ign_moveit2_examples ex_cpp_follow_target.launch.py
# Python
ros2 launch ign_moveit2_examples ex_py_follow_target.launch.py
# Python
ros2 launch ign_moveit2_examples ex_py_throw_object.launch.py
.
├── examples/ # [dir] Nodes used for examples
├── cpp/ # [dir] C++ nodes
└── py/ # [dir] Python nodes
├── launch/ # [dir] Launch scripts for examples
├── robots/ # [dir] Launch scripts that spawn robots into environment
├── worlds/ # [dir] Launch scripts that setup the environment
├── default.launch.py # Default launch script used by all edxamples
├── ex_cpp_*.launch.py # C++ launch scripts
└── ex_py_*.launch.py # Python launch scripts
├── rviz/ign_moveit2_examples.rviz # RViz2 config for motion planning with MoveIt 2
├── worlds/ # [dir] World descriptors
├── CMakeLists.txt # Colcon-enabled CMake recipe
└── package.xml # ROS 2 package metadata