Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ARG ROS_DISTRO="jazzy"
FROM ros:${ROS_DISTRO}

COPY . /ros2_dev/scara_tutorial_ros2
COPY . /ros2_dev/ecat_ros2_workshop
RUN apt update && apt upgrade -y
RUN cd ros2_dev && \
apt update && \
cd scara_tutorial_ros2 && \
cd ecat_ros2_workshop && \
. /opt/ros/${ROS_DISTRO}/setup.sh && \
rosdep install --ignore-src --from-paths . -y -r && \
colcon build --symlink-install
Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile_novnc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG ROS_DISTRO="jazzy"
FROM scara_tutorial_ros2:${ROS_DISTRO}
FROM ecat_ros2_workshop:${ROS_DISTRO}

RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qqy \
Expand Down
20 changes: 10 additions & 10 deletions .docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ Provides a basic preconfigured docker container for tutorial purposes.
To use it, make sure you have [Docker](https://docs.docker.com/get-docker/) installed, then build and run the image :

```shell
$ docker build --tag scara_tutorial_ros2:jazzy --file .docker/Dockerfile .
$ docker run scara_tutorial_ros2:jazzy ros2 launch scara_bringup scara.launch.py
$ docker build --tag ecat_ros2_workshop:jazzy --file .docker/Dockerfile .
$ docker run ecat_ros2_workshop:jazzy ros2 launch scara_bringup scara.launch.py
```

### Run with GUI
To run the docker image with GUI, use the [rocker tool](https://github.com/osrf/rocker):
```shell
$ sudo apt install python3-rocker
$ rocker --net=host --x11 --devices /dev/dri --user scara_tutorial_ros2:jazzy ros2 launch scara_bringup scara.launch.py
$ rocker --net=host --x11 --devices /dev/dri --user ecat_ros2_workshop:jazzy ros2 launch scara_bringup scara.launch.py
```

### Run with noVNC
To run the docker image with noVNC, make sure that `scara_tutorial_ros2:jazzy` is built then build and run the novnc docker :
To run the docker image with noVNC, make sure that `ecat_ros2_workshop:jazzy` is built then build and run the novnc docker :
```shell
$ docker build --tag scara_tutorial_ros2:jazzy_novnc --file .docker/Dockerfile_novnc .
$ docker run --rm -p 6080:6080 -it scara_tutorial_ros2:jazzy_novnc
$ docker build --tag ecat_ros2_workshop:jazzy_novnc --file .docker/Dockerfile_novnc .
$ docker run --rm -p 6080:6080 -it ecat_ros2_workshop:jazzy_novnc
```
Then open your browser and navigate to `http://localhost:6080/vnc.html` to access the desktop environment. Inside the noVNC session, you can open a terminal and run:
```shell
$ cd ros2_dev/scara_tutorial_ros2/
$ cd ros2_dev/ecat_ros2_workshop/
$ source install/setup.bash
$ ros2 launch scara_bringup scara.launch.py
```
Expand All @@ -33,12 +33,12 @@ $ ros2 launch scara_bringup scara.launch.py
### Run with bash
To interact with the environment, run docker using:
```shell
$ docker run -it scara_tutorial_ros2:jazzy
$ docker run -it ecat_ros2_workshop:jazzy
```
and inside docker run:
```shell
$ cd ros2_dev/scara_tutorial_ros2/
$ cd ros2_dev/ecat_ros2_workshop/
$ source install/setup.bash
$ ros2 launch scara_bringup scara.launch.py
```
The `scara_tutorial_ros2` nodes should now be running.
The `ecat_ros2_workshop` nodes should now be running.
2 changes: 1 addition & 1 deletion .docker/ros_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -e
# setup ros environment
# export ROS_LOCALHOST_ONLY=1
source "/opt/ros/$ROS_DISTRO/setup.bash"
source "/ros2_dev/scara_tutorial_ros2/install/setup.bash"
source "/ros2_dev/ecat_ros2_workshop/install/setup.bash"
exec "$@"
2 changes: 1 addition & 1 deletion .docker/ros_entrypoint_novnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ set -e
# setup ros environment
# export ROS_LOCALHOST_ONLY=1
source "/opt/ros/$ROS_DISTRO/setup.bash"
source "/ros2_dev/scara_tutorial_ros2/install/setup.bash"
source "/ros2_dev/ecat_ros2_workshop/install/setup.bash"
exec "$@"
59 changes: 59 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Documentation

# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the main branch
push:
branches: [ main ]

# Triggers the workflow on pull request events
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build_documentation"
build_documentation:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r docs/requirements.txt

- name: Build documentation
run: |
mkdocs build --config-file docs/mkdocs.yml

- name: Create commit
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git clone https://github.com/ICube-Robotics/ecat_ros2_workshop.git --branch gh-pages --single-branch gh-pages
cp -r docs/site/* gh-pages/
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true

- name: Push changes
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
162 changes: 112 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,112 @@
# Scara tutorial ROS2
The [ros2_control](https://control.ros.org) framework is a realtime control framework designed for general robotics applications that gains more and more attention both for research and industrial purposes. An overview of the ros2_control framework can be found [here](resources/r2c_overview.md).

This tutorial is made to understand the basic concepts of controlling a robot using ros2_control. In particular, it describes how to :
- [Write a URDF description of a simple SCARA manipulator](resources/urdf_tutorial.md)
- [Launch and interact with the SCARA robot](resources/launch_tutorial.md)
- [Write a custom hardware interface for the SCARA robot](resources/hardware_tutorial.md)
- [Write a custom controller for the SCARA robot](resources/controller_tutorial.md)
- [Set up the SCARA manipulator to run with ros2_control and Gazebo](resources/gazebo_tutorial.md)

![scara model](resources/scara_model.png)

## Getting Started
***Required setup : Ubuntu 24.04 LTS and ROS2 Jazzy***

1. Install `ros2` packages. The current development is based on `ros2 jazzy`. Installation steps are described [here](https://docs.ros.org/en/jazzy/Installation.html).
2. Source your `ros2` environment:
```shell
source /opt/ros/jazzy/setup.bash
```
**NOTE**: The ros2 environment needs to be sourced in every used terminal. If only one distribution of ros2 is used, it can be added to the `~/.bashrc` file.
3. Install `colcon` and its extensions :
```shell
sudo apt install python3-colcon-common-extensions
```
3. Create a new ros2 workspace:
```shell
mkdir ~/ros2_ws/src
```
4. Pull relevant packages, install dependencies, compile, and source the workspace by using:
```shell
cd ~/ros2_ws
git clone https://github.com/ICube-Robotics/scara_tutorial_ros2.git src/scara_tutorial_ros2
rosdep install --ignore-src --from-paths . -y -r
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install
source install/setup.bash
```

## Docker Setup (Alternative)
For a containerized setup, see the [Docker README](.docker/README.md) for instructions on building and running the tutorial in a Docker container with ROS2 Jazzy.

## Acknowledgments
This tutorial is partially inspired from [pac48](https://github.com/pac48/ros2_control_demos/tree/full-example-tutorial)'s tutorial and the official [ros2_control website](https://control.ros.org).

## Contacts ##
![icube](https://icube.unistra.fr/fileadmin/templates/DUN/icube/images/logo.png)

[ICube Laboratory](https://icube.unistra.fr), [University of Strasbourg](https://www.unistra.fr/), France

__Maciej Bednarczyk:__ [[email protected]](mailto:[email protected]), @github: [mcbed](https://github.com/mcbed)
# SCARA ROS2 EtherCAT Workshop

[![Documentation](https://img.shields.io/badge/docs-mkdocs-blue)](https://icube-robotics.github.io/ecat_ros2_workshop/)
[![ROS2](https://img.shields.io/badge/ROS2-Jazzy-blue)](https://docs.ros.org/en/jazzy/)
[![License](https://img.shields.io/github/license/ICube-Robotics/ecat_ros2_workshop)](LICENSE)

The [ros2_control](https://control.ros.org) framework is a real-time control framework designed for general robotics applications that is gaining increasing attention for both research and industrial purposes.

This comprehensive tutorial teaches the basic concepts of controlling a robot using ros2_control and EtherCAT.

## 📚 Documentation

**Full documentation is available at: [https://icube-robotics.github.io/ecat_ros2_workshop/](https://icube-robotics.github.io/ecat_ros2_workshop/)**

## 📖 Tutorial Contents

- [ros2_control Overview](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/r2c_overview/)
- [Write a URDF description of a SCARA manipulator](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/urdf_tutorial/)
- [Launch and interact with the SCARA robot](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/launch_tutorial/)
- [Write a custom hardware interface](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/hardware_tutorial/)
- [Write a custom controller](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/controller_tutorial/)
- [Set up Gazebo simulation](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/gazebo_tutorial/)
- [Control EtherCAT motor drives](https://icube-robotics.github.io/ecat_ros2_workshop/tutorials/ethercat_tutorial/)

![SCARA Model](resources/scara_model.png)


## 🚀 Quick Start

**_Required setup: Ubuntu 24.04 LTS and ROS2 Jazzy_**

### Installation

1. Install ROS2 Jazzy ([installation guide](https://icube-robotics.github.io/ecat_ros2_workshop/getting-started/installation/))

2. Source your ROS2 environment:
```bash
source /opt/ros/jazzy/setup.bash
```

3. Install colcon:
```bash
sudo apt install python3-colcon-common-extensions
```

4. Create and build workspace:
```bash
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
git clone https://github.com/ICube-Robotics/ecat_ros2_workshop.git src/ecat_ros2_workshop
rosdep install --ignore-src --from-paths . -y -r
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install
source install/setup.bash
```

### Docker Setup (Alternative)

For a containerized environment, see the [Docker setup guide](https://icube-robotics.github.io/ecat_ros2_workshop/getting-started/docker/).

```bash
docker build --tag ecat_ros2_workshop:jazzy --file .docker/Dockerfile .
docker run ecat_ros2_workshop:jazzy ros2 launch scara_bringup scara.launch.py
```

## 📦 Repository Structure

```
ecat_ros2_workshop/
├── scara_description/ # URDF and robot description files
├── scara_hardware/ # Custom hardware interface implementation
├── scara_controllers/ # Custom controller implementation
├── scara_bringup/ # Launch files and configurations
├── scara_nodes/ # Additional ROS2 nodes
├── docs/ # MkDocs documentation source
└── resources/ # Tutorial resources and images
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

For bugs and feature requests, please open an issue on [GitHub](https://github.com/ICube-Robotics/ecat_ros2_workshop/issues).

## 📄 License

This project is open source. See the [LICENSE](LICENSE) file for details.


## 👥 Contacts & Maintainers

### [ICube Laboratory](https://icube.unistra.fr)
[University of Strasbourg](https://www.unistra.fr/), France

**Manuel Yguel** - [[email protected]](mailto:[email protected]) | [@yguel](https://github.com/yguel)

### [Asterion Robotics](https://asterion-robotics.com)

**Maciej Bednarczyk** - [[email protected]](mailto:[email protected]) | [@mcbed](https://github.com/mcbed)

For more information, see the [full contacts page](https://icube-robotics.github.io/ecat_ros2_workshop/about/contacts/).

---

<div align="center">

[![ICube](https://icube.unistra.fr/fileadmin/templates/DUN/icube/images/logo.png)](https://icube.unistra.fr)
&nbsp;&nbsp;&nbsp;&nbsp;
[![Asterion](https://raw.githubusercontent.com/Asterion-Robotics/assets/refs/heads/main/asterion-logo.png)](https://asterion-robotics.com)

**Made with ❤️ by ICube Laboratory and Asterion Robotics**

</div>
Loading