Skip to content

lucasmluza/ros2_moveit_canopen_example

Repository files navigation

ROS2 MoveIt CANopen Example

This repository implements the use of different ROS2 packages to control a CANopen-based robot in a simulated environment.

Dependencies

  • Docker (tested with version 24.0.6)
  • Docker Compose (tested with version v2.21.0)

Build

Clone this repository

git clone --recurse-submodules git://github.com:lucasmluza/ros2_moveit_canopen_example.git

Build the image

docker compose build

Create, start, and execute the container

For creating and starting the container:

docker compose up 

For executing commands in the container:

docker compose exec ros2_humble [command]

A simple approach is to run bash on the container, that will start interactively since the compose.yaml set the tty and stdin_open to true.

docker compose exec ros2_humble bash

Install ROS2 dependencies

First, install de dependencies with rosdep. In ~/ws_ros:

1 - Update the apt repositories

sudo apt update

2 - Initialize rosdep

sudo rosdep init && rosdep update

3 - Install dependencies

rosdep install -i --from-paths src -y

Build workspace packages

In ~/ws_ros:

colcon build

And, do not forget to source the install/setup.bash after compiling.

In ~/ws_ros:

source install/setup.bash

Run and launch packages

panda_rviz_viewer

For visualize the robot and control the joints position with a GUI app:

ros2 launch panda_rviz_viewer view.launch.py

panda_rviz_viewer

panda_canopen

For controlling the robots joints with ROS2 services:

ros2 launch panda_canopen simulation.launch.py

Then, in a second bash instance of the container, the joints can be controlled by the exposed services. Examples:

  • Initialize a joint:
    ros2 service call /panda_joint1/init std_srvs/srv/Trigger
  • Set the operation mode to Profile Position Mode:
    ros2 service call /panda_joint1/position_mode std_srvs/srv/Trigger
  • Set a target position value:
    ros2 service call /panda_joint1/target canopen_interfaces/srv/COTargetDouble "{ target: 10.0 }"

For visualizing the robot movement with Rviz2, in a third bash instance of the container:

ros2 launch panda_canopen rviz.launch.py

panda_canopen

panda_moveit

For visualize the robot, and plan and execute trajectories using the MoveIt2 plugin in Rviz2:

ros2 launch panda_moveit simulation.launch.py

panda_moveit

References

This repository is based, and imported files from the following:

panda_description

ros2_canopen

Added as a submodule.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks