This repository provides a Dockerized environment for working with the ROS 2 Kortex package. The workspace is set up to include the ros2_kortex repository as a Git submodule inside a ROS 2 workspace (colcon_ws), which is then built and run within a Docker container.
- Docker: Ensure Docker is installed on your system. You can download it from here.
Clone this repository along with its submodules to your local machine (make sure you're cloning from the right branch):
git clone --recurse-submodules https://github.com/Abhishek8857/kinova-ros2.git
cd /kinova-ros2
If you’ve already cloned the repository without submodules, you can initialize and update the submodules like this:
git submodule update --init --recursive
Build the Docker image using the provided Dockerfile. This command must be run from the root of the repository where the Dockerfile is located:
bash docker_build.sh
This will create a Docker image named ros2-kortex:latest, which includes the ROS 2 environment and the ros2_kortex package.
The build process may take some time. On systems with an RTX 3050, the process may freeze when building Gazebo dependencies. Grabbing a coffee is recommended if the process stalls.
Once the Docker image is built, you can run the container interactively using:
cd docker_run/
bash docker_vision.sh
This will start a new container from the ros2-kortex:latest image, allowing you to interact with the ROS 2 environment.
After entering the container, you can source the ROS 2 and workspace setup files and run ROS 2 nodes or launch files:
# Source ROS 2 environment
source /opt/ros/humble/setup.bash
# Source the workspace overlay
source /colcon_ws/install/setup.bash
To launch and view any of the robot's URDF run:
ros2 launch kortex_description view_robot.launch.py
The accepted arguments are:
-
robot_type
: Your robot model. Possible values are eithergen3
orgen3_lite
, the default isgen3
. -
gripper
: Gripper to use. Possible values for the Gen3 are eitherrobotiq_2f_85
orrobotiq_2f_140
. For the Gen3 Lite, the only option isgen3_lite_2f
. Default value is an empty string, which will display the arm without a gripper. -
dof
: Degrees of freedom of the arm. Possible values for the Gen3 are either6
or7
. For the Gen3 Lite, the only option is6
. Default value is7
.
The gen3.launch.py
launch file is designed to be used for Gen3 arms. The typical use case to bringup and visualize the 7 DoF Kinova Gen3 robot arm (default) with mock hardware on Rviz:
ros2 launch kortex_bringup gen3.launch.py \
robot_ip:=yyy.yyy.yyy.yyy \
use_fake_hardware:=true
Alternatively, for a physical robot:
ros2 launch kortex_bringup gen3.launch.py \
robot_ip:=192.168.1.10 \
You can specify additional arguments if you wish to change your arm configuration: see details at the section of same name ROS 2 Kortex
The kortex_sim_control.launch.py
launch file is designed to simulate all of our arm models, you just need to specify your configuration through the arguments. By default, the Gen3 7 dof configuration is used :
ros2 launch kortex_bringup kortex_sim_control.launch.py \
use_sim_time:=true \
launch_rviz:=false
For arguments, see details at the section of same name ROS 2 Kortex
- Remember to open a new terminal and:
Then repeat step 4 Running ROS 2 Nodes
cd /kinova-ros2/docker_run/ bash docker_exec.sh
To generate motion plans and execute them with a simulated 7 DoF Kinova Gen3 arm with mock hardware:
ros2 launch kinova_gen3_7dof_robotiq_2f_85_moveit_config robot.launch.py \
robot_ip:=yyy.yyy.yyy.yyy \
use_fake_hardware:=true
To generate motion plans and execute them with an ignition simulated 7 DoF Kinova Gen3 arm (previously launched with the command at the simulation section):
ros2 launch kinova_gen3_7dof_robotiq_2f_85_moveit_config sim.launch.py \
use_sim_time:=true
To work with a physical robot and generate/execute paths with MoveIt run the following:
For Gen3:
ros2 launch kinova_gen3_7dof_robotiq_2f_85_moveit_config robot.launch.py \
robot_ip:=192.168.1.10
For Gen3-Lite:
ros2 launch kinova_gen3_lite_moveit_config robot.launch.py \
robot_ip:=192.168.1.10
To exit the container, simply type exit and press Enter.
This setup is based on the ROS 2 Humble distribution. If you need to use a different ROS 2 distribution, modify the Dockerfile and the setup commands accordingly.
The Docker container is configured to use CycloneDDS as the default RMW (ROS Middleware). This can be changed by modifying the Dockerfile and related configuration files.