# 1 - ROS2 - Démarrage



# Installation PC ROS2

---

ROS est un Middleware Open Source pour développer des applications robotiques. Originellement développé sous Linux (Ubuntu), il est maintenant disponible sur plusieurs systèmes d'exploitation dont Debian et Windows.

## Installation des prérequis et liens importants

Pour des raisons de stabilité et légèreté du système, il y a tout à penser que les déploiements de ROS dans des milieux industriels se font (robotique autonome et mobile) et se feront à l'avenir sur Ubuntu et de plus en plus Debian. L'industrie des serveurs a déjà largement adopté Debian pour sa stabilité et sa modularité. C'est pourquoi plutôt que d'apprendre la ligne de commande Windows, nous recommandons d'apprendre la ligne de commande Bash, utilisée dans Ubuntu/Debian. Pour cela, il faut installer un système (noyau) Linux, plusieurs options s'offrent à nous:

- Machine virtuelle 
    - Windows subsystem for Linux (WSL2)
    - Machine virtuelle Linux, par exemple via VirtualBox
- Machine physique 
    - dual-boot Windows-Ubuntu -&gt; Installation en quelques clics via une clé USB Live
    - PC sous Ubuntu 22.04 
        - Pour une tour : Branchement d'un SSD SATA dédié au lieu du SSD Windows
        - Branchement d'un SSD USB3 type Transcend ESD310C

Notes importantes pour les installations virtuelles (deux premières options d'installation) :

- Ces installations sont suffisantes pour effectuer des simulations et du développement tant qu'il n'y a pas de Hardware à tester. VirtualBox fonctionne à peu près pour des TPs avec une VM URSim mais c'est loin d'être optimal (plantages,...)
- L'accélération graphique n'est pas supportée par la carte graphique (GPU) mais par le processeur (CPU) (voir [ce bug](https://github.com/microsoft/wslg/issues/554))
- un PC avec 32Go de RAM est recommandé si des composants imposants de ROS doivent être compilés, par exemple pour utiliser la version de développement [MoveIt 2 Rolling](https://moveit.picknik.ai/main/doc/tutorials/getting_started/getting_started.html). En effet Windows consomme à lui seul près de 4-8Go, Ubuntu &gt;2Go et la compilation &gt;4Go, on peut vite atteindre la saturation. 16Go peuvent suffire mais il faudra compiler sans parallélisation, et fermer des applications lourdes dans Windows comme Firefox.

### Ubuntu via Windows SubSystem for Linux (WSL2)

WSL2 installe une machine virtuelle avec le noyau Linux complet, supporté et managé par Microsoft Windows. **Il n'y a pas besoin de droits administrateur car le logiciel est disponible dans le store Windows**.

**Prérequis** :

- Depuis le menu démarrer Windows, rechercher "A propos de", "Spécifications de Windows" 
    - Version &gt;22H2
    - Build &gt;19041 (testé avec 19045.2486)
    - Si votre version est inférieure, demandez à votre administrateur de màj vers 22H2 et Build 19045.2486
    - Si vous ne pouvez màj, optez pour l'option d'installation d'Ubuntu via VirtualBox
- Exécuter Windows PowerShell en mode administrateur (connectez-vous avec un compte administrateur si vous n'avez pas les droits)
- Lancer `wsl --install` (si ça ne fonctionne pas, votre Windows n'est probablement pas à la bonne version)
- `wsl --update`
- Redémarrer l'ordinateur

**Installation** de Ubuntu 22 :

- Ouvrir Windows Store
- Rechercher et installer `Ubuntu` (c'est la version LTS actuelle qui sera installée, en ce moment 22.04.X)
- Depuis le menu démarrer Windows, Lancer l'application `Ubuntu`. Un Terminal s'ouvre (ligne de commande Linux Bash)
- Définir l'utilisateur principal, par exemple `ros2` et un mot de passe (8 caractères mini, majuscule, minuscule, chiffre, caractère spécial).
- Mettre à jour Ubuntu

```
sudo apt update
sudo apt upgrade
```

Depuis Windows, pour éteindre les Machines Virtuelles Ubuntu et ainsi libérer la mémoire RAM affectée :

- Lancer l'application `Windows PowerShell`
- `wsl --shutdown` Autres commandes WSL depuis `Windows PowerShell` :
- `wsl --status` : devrait retourner `Distribution par défaut : Ubuntu`, `Version par défaut : 2` (WSL2)
- `wsl --list` (ou `wsl -l -v`) : liste les Machines Virtuelles Linux installées via WSL (et la version WSL utilisée)

#### Docker dans une VM WSL2

Pour utiliser [docker dans une VM WSL2](https://docs.docker.com/desktop/windows/wsl/#turn-on-docker-desktop-wsl-2), par exemple Ubuntu :

- [Désinstaller toute version précédente de docker installée](https://docs.docker.com/engine/install/ubuntu/#uninstall-docker-engine) sur votre VM Ubuntu. Dans Terminal(Ubuntu) :
    
    
    - `sudo apt remove docker*`
- Ajouter votre [utilisateur au groupe docker](https://docs.docker.com/engine/install/linux-postinstall/)
    
    
    - `sudo groupadd docker`
    - `sudo usermod -aG docker $USER`
- Passer sur une session `administrateur_windows`
- Installer Docker Desktop for Windows [https://docs.docker.com/desktop/windows/wsl/#turn-on-docker-desktop-wsl-2c](https://docs.docker.com/desktop/windows/wsl/#turn-on-docker-desktop-wsl-2c)
    
    
    - Cocher WSL2 (devrait être coché par défaut si votre config WSL2 est OK)
- [Ajouter votre utilisateur\_windows au groupe docker](https://stackoverflow.com/questions/61530874/docker-how-do-i-add-myself-to-the-docker-users-group-on-windows)
    
    
    - Dans CMD/Powershell :
        
        ```
        net localgroup docker-users "utilisateur_windows" /ADD
        
        ```
- Repasser sur votre session `utilisateur_windows`
- L'intégration Docker-WSL est activée sur la distribution WSL par défaut, normalement Ubuntu (22)
    
    
    - pour s'en assurer, `wsl --set-default ubuntu`
    - Au besoin il est possible de l'activer sur une distro spécifique dans **Settings** &gt; **Resources** &gt; **WSL Integration**
- Démarrer Terminal(Ubuntu)

#### Accélération GPU pour applications graphiques et machine learning

[https://docs.docker.com/desktop/features/gpu/](https://docs.docker.com/desktop/features/gpu/)

Pour tester si le GPU est bien disponible, lancer la commande suivante dans le Terminal(Ubuntu) :

```console
 docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
```

Le résultat suivant indique que la carte graphique dédiée `Nvidia Quadro P620` est bien exploitée pour les calculs :

```
> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Pascal" with compute capability 6.1

> Compute 6.1 CUDA device: [Quadro P620]
4096 bodies, total time for 10 iterations: 4.417 ms
= 37.987 billion interactions per second
= 759.750 single-precision GFLOP/s at 20 flops per interaction
```

Sinon, regarder [https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-de-machine-avec-rt-kernel-et-acceleration-graphique#bkmrk-gpu](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-de-machine-avec-rt-kernel-et-acceleration-graphique#bkmrk-gpu)

### Ubuntu via VirtualBox

Télécharger et installer VirtualBox pour Windows et l'Extension Pack : [https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html](https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html)

<p class="callout warning">Ubuntu 24 requiert une version de VirtualBox &gt;7.1 [https://www.virtualbox.org/ticket/21955](https://www.virtualbox.org/ticket/21955)   
</p>

<p class="callout success">La version 7.1.8 règle des soucis de la version 7.1.6 avec l'USB [https://forums.virtualbox.org/viewtopic.php?t=113298](https://forums.virtualbox.org/viewtopic.php?t=113298)   
</p>

Déployer la VM avec ROS2 préinstallé (grâce aux instructions suivantes dans cette page)

- Télécharger la VM depuis seafile 
    - Ubuntu 22 ROS Humble [Lien public de téléchargement](https://seafile.unistra.fr/f/4892e35890b941e388ef/?dl=1) (\\Seafile\\IHA-IDF\\Smart\_Prod\\Formation\_ROS2\\UbuntuROS.ova)
    - Ubuntu 24 ROS Jazzy : [https://seafile.unistra.fr/f/4892e35890b941e388ef/?dl=1](https://seafile.unistra.fr/f/4892e35890b941e388ef/?dl=1)
- Lancer VirtualBox
- Importer la VM : Outils -&gt; Importer -&gt; Rechercher le fichier UbuntuROS.ova
- Vérifier et adapter la configuration de la VM en ressources RAM, CPU, GPU et Réseau selon la configuration de votre PC  
    cf. [https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-configuration-virtua](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-configuration-virtua)
- Démarrer la VM
- Ignorer l'erreur sur le dossier partagé Linux-Windows

#### Exportation de VM au format OVF

Le système du TP est maintenu à jour et testé sur un PC Windows. Pour l'exporter sur les PC de salle TP, on veut avoir une image la plus petite possible.

- On commence par nettoyer Ubuntu puis on exporte un fichier `.ova`

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/scaled-1680-/nofimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/nofimage.png)

- Sélectionner le format `OVF 2.0` pour une meilleure compressions

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/scaled-1680-/1a7image.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/1a7image.png)

### Setup pour TP MoveIt2+URSim à l'IUT de Haguenau

#### La première année j'ai expérimenté avec des PC Windows et VirtualBox :

- Une VM contient Ubuntu 22, ROS et MoveIt
- Une seconde contient Xubuntu 14/16 avec URSim
- Les deux VMs en Réseau NAT

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/scaled-1680-/hmCimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/hmCimage.png)

- Voir : [https://innovation.iha.unistra.fr/books/robotique-open-source/page/programmer-un-robot-avec-moveit2-jumeau-numerique#bkmrk-sous-windows---virtu](https://innovation.iha.unistra.fr/books/robotique-open-source/page/programmer-un-robot-avec-moveit2-jumeau-numerique#bkmrk-sous-windows---virtu)

<p class="callout warning">Il faut des machines de guerre, régler finement la quantité de RAM et de coeurs alloués aux VM et à Windows, et malgré cela les VM plantent.</p>

#### En 2025 je change donc de fusil d'épaule et utilise la salle réseau de l'IUT

- Avec des vieilles tours de 2013 : i5, 8G de RAM, petite carte graphique, double écran, 60G de SSD
- Réseau isolé donc possibilité de mettre OS au choix sur les PC, d'isoler ou non les PC et d'éventuels robots à piloter

### Migration VM vers disque physique

Entre 2024 et 2025 je suis passé de TPs en VM VirtualBox vers des PC physiques. Dans les deux cas, je maintiens l'environnement de TP sur VirtualBox de mon PC Windows. Ceci présente l'avantage de pouvoir maintenir des états de machines en fonction du type de TP.

On peut déployer un disque virtuel de VM vers un disque physique :

- Nettoyer l'OS et éventuellement désactiver le SWAP pour encore gagner de l'espace   
    cf. [https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-all%C3%A9ger-ubuntu-%28pour](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-all%C3%A9ger-ubuntu-%28pour)
- Réduire la taille de la partition via l'application Disks. Celle-ci pourra être agrandie après copie de la VM. Garder quelques Go de marge.
- Démarrer la VM sur une `.iso` Live Ubuntu

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/scaled-1680-/dC2image.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/dC2image.png)

- Brancher un SSD en USB3 au PC (utiliser un adaptateur SATA-USB3 si nécessaire)
- Passer le périphérique USB à la VM 
    - Avant le démarrage

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/scaled-1680-/z7Iimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/z7Iimage.png)

- - Pendant que la VM tourne

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/scaled-1680-/NA7image.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-01/NA7image.png)

- Ouvrir l'application Disks pour identifier les disques, en général : 
    - disque virtuel de la VM : `/dev/sda`
    - SSD branché en USB : `/dev/sdb`
- Ouvrir un Terminal et lancer [la commande de copie](https://serverfault.com/questions/4906/using-dd-for-disk-cloning) du disque virtuel vers le SSD physique :
- `sudo dd if=/dev/sda of=/dev/sdb bs=4096 status=progress && sync`
- Ouvrir Gparted (depuis une Live USB avec le SSD branché) pour vérifier que la partition principale, généralement `sdb3` est bien identifiée comme formatée en `ext4`. Agrandir la partition à la taille désirée.
- Si le SSD ne boot pas sur un PC, essayer de réparer le grub avec `boot-repair` depuis une Live USB

### Windows 10/11

Une installation native sous Windows 10 avec Visual Studio 2019 (Version Community gratuite) est possible :

- [ROS 1](https://wiki.ros.org/Installation/Windows)
- [ROS 2](https://docs.ros.org/en/humble/Installation/Windows-Install-Binary.html)

## Installation de ROS2 Humble

Les distributions stables publiées (pré-compilées) de ROS2 sont nommées par ordre alphabétique. Début 2023, on va [installer **ROS 2 Humble**](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html) :

```
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update && sudo apt upgrade
sudo apt install ros-humble-desktop-full
source /opt/ros/humble/setup.bash
echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc


```

### Tester l'installation

https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html#try-some-examples

- Ouvrir un premier Terminal : `ros2 run demo_nodes_cpp talker`
- Ouvrir un second Terminal : `ros2 run demo_nodes_cpp listener`

### Installation de Jazzy pour la Navigation et Manipulation

Jazzy est la LTS 2024-2029. Avec UR, Turtlebot3, Nav2, MoveIt2, etc.

```bash
## Install ROS
sudo apt update && sudo apt install locales
# Test locale
#locale
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update && sudo apt upgrade
sudo apt install ros-dev-tools
sudo apt install ros-jazzy-desktop-full
echo 'source /opt/ros/jazzy/setup.bash' >> ~/.bashrc
source ~/.bashrc
# Test installation (first Terminal)
#ros2 run demo_nodes_cpp talker
# Test installation (second Terminal)
#ros2 run demo_nodes_cpp listener

## Install Nav2 (465Mo)
sudo apt install ros-jazzy-nav2-bringup # depends on ros-jazzy-navigation2
source ~/.bashrc
# Test installation
#ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

## Install TurtleBot3 Simulation
sudo apt install ros-jazzy-turtlebot3-simulations
echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
source ~/.bashrc
# Test installation
#ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

## Install dependencies to build ROS packages from source
sudo apt install python3-argcomplete python3-colcon-common-extensions python3-colcon-mixin libboost-system-dev build-essential
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default

## Install TurtleBot3 from source
sudo apt install ros-jazzy-hls-lfcd-lds-driver ros-jazzy-turtlebot3-msgs ros-jazzy-dynamixel-sdk libudev-dev
mkdir -p ~/turtlebot3_ws/src && cd ~/turtlebot3_ws/src
#git clone -b humble-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone -b jazzy https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone -b ros2-devel https://github.com/ROBOTIS-GIT/ld08_driver.git
cd ~/turtlebot3_ws/src/turtlebot3
rm -rf turtlebot3_cartographer turtlebot3_navigation2
cd ~/turtlebot3_ws/
colcon build --symlink-install
rosdep update && rosdep install --ignore-src --from-paths src -y
vcs --help
vcs status
sudo apt list ros-jazzy-gazebo-ros-pkgs
sudo apt list ros-jazzy-ros-gz
sudo apt install ros-jazzy-ros-gz
colcon build --symlink-install
ros2 launch nav2_bringup tb3_simulation_launch.py slam:=True nav:=True headless:=False use_sim_time:=True
exit
cd ..
cd turtlebot3_ws/
colcon build --symlink-install --parallel-workers 1
cd src/
git clone -b jazzy https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
#git clone -b humble https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ..
colcon build --symlink-install --parallel-workers 1
sudo nano .bashrc
sudo nano ~/.bashrc
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
sudo apt list ros-jazzy-turtlebot3-*
sudo apt install ros-jazzy-turtlebot3-fake-node
sudo apt install ros-jazzy-gazebo-msgs
cd src/
sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
rosdep update
sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update
sudo apt-get install gz-harmonic
cd ..
colcon build --symlink-install --parallel-workers 1
source in
source install/setup.bash 
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

## Install MoveIt2 Tutorials
mkdir -p ~/ws_moveit/src
cd ~/ws_moveit/src
git clone -b main https://github.com/moveit/moveit2_tutorials
vcs import --recursive < moveit2_tutorials/moveit2_tutorials.repos
sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ..
colcon build --mixin release
source ~/ws_moveit2/install/setup.bash
# Test installation https://github.com/moveit/moveit2_tutorials/blob/humble/doc/examples/move_group_interface/move_group_interface_tutorial.rst
#ros2 launch moveit2_tutorials move_group.launch.py
# Test installation (second Terminal)
#source ~/ws_moveit2/install/setup.bash
#ros2 launch moveit2_tutorials move_group_interface_tutorial.launch.py

# Install UR ROS2 Driver
mkdir -p ur_ws/src
cd ur_ws
git clone -b main https://github.com/UniversalRobots/Universal_Robots_ROS2_Tutorials.git src/ur_tutorials
rosdep update && rosdep install --ignore-src --from-paths src -y
colcon build --symlink-install
source ~/ur_ws/install/setup.bash
# Test installation (first Terminal)
#ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=yyy.yyy.yyy.yyy use_mock_hardware:=true launch_rviz:=false
# Test installation (second Terminal)
#source ~/ur_ws/install/setup.bash
#ros2 launch ur_moveit_config ur_moveit.launch.py ur_type:=ur5e launch_rviz:=true

# Install UR ROS2 Gazebo
git clone -b ros2 https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation.git src/ur_simulation_gz
rosdep update && rosdep install --ignore-src --from-paths src -y
colcon build --symlink-install
source ~/ur_ws/install/setup.bash
# Test installation https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation
#ros2 launch ur_simulation_gz ur_sim_moveit.launch.py
# OR
# Test installation (first Terminal)
#ros2 launch ur_simulation_gz ur_sim_control.launch.py
# Test installation (second Terminal)
#source ~/ur_ws/install/setup.bash
#ros2 run ur_robot_driver example_move.py

## Install URSim with docker (only on native Ubuntu PC)
sudo apt install docker-compose
sudo usermod -aG docker $USER
sudo service docker start
# Test installation
#docker run hello-world
#sudo service docker status
sudo usermod -aG docker robot
docker pull universalrobots/ursim_e-series
docker run hello-world
docker pull universalrobots/ursim_e-series
ros2 run ur_robot_driver start_ursim.sh -m ur5e
sudo apt install ros-jazzy-ur
sudo apt list python3-rosdep
sudo rosdep init
rosdep update
sudo apt update
sudo apt dist-upgrade
ros2 run ur_robot_driver start_ursim.sh -m ur5e
sudo apt list python3-colcon*
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default
sudo apt list python3-vcstool



```

### Bonus SOARM-100, VBox addons, etc

```bash
  1  sudo apt upgrade
    2  sudo snap remove firefox
    3  sudo apt remove firefox 
    4  snap list
    5  sudo rm -rf /var/cache/snapd/
    6  sudo add-apt-repository ppa:mozillateam/ppa
    7  sudo nano /etc/apt/preferences.d/mozillateamppa
    8  sudo apt update
    9  sudo apt install firefox-esr
   10  sudo apt upgrade
   11  exit
   12  sudo apt install terminator
   13  sudo apt update && sudo apt install locales
   14  # Test locale
   15  #locale
   16  sudo locale-gen en_US en_US.UTF-8
   17  sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
   18  export LANG=en_US.UTF-8
   19  sudo apt install software-properties-common
   20  sudo add-apt-repository universe
   21  sudo apt update && sudo apt install curl
   22  sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
   23  echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
   24  sudo apt update && sudo apt upgrade
   25  sudo apt install ros-dev-tools
   26  sudo apt install ros-jazzy-desktop-full
   27  echo 'source /opt/ros/jazzy/setup.bash' >> ~/.bashrc
   28  source /opt/ros/jazzy/setup.bash
   29  exit
   30  mkdir -p ws_so_arm100/src
   31  cd ws_so_arm100/src
   32  git clone https://github.com/JafarAbdi/ros2_so_arm100 
   33  cd ..
   34  git submodule init
   35  cd src/
   36  git submodule init
   37  git clone --recurse-submodules https://github.com/JafarAbdi/ros2_so_arm100 
   38  rm -rf ros2_so_arm100/
   39  git clone --recurse-submodules https://github.com/JafarAbdi/ros2_so_arm100 
   40  cd ..
   41  rosdep update && rosdep install --ignore-src --from-paths src -y
   42  rosdep init
   43  sudo rosdep init
   44  rosdep update && rosdep install --ignore-src --from-paths src -y
   45  colcon build --symlink-install --parallel-workers 1
   46  source install/setup.bash 
   47  ros2 launch so_arm100_moveit_config demo.launch.py hardware_type:=mock_components
   48  exit
   49  source install/setup.bash
   50  ros2 run rqt_joint_trajectory_controller rqt_joint_trajectory_controller
   51  exit
   52  cd ws_so_arm100/
   53  source install/setup.bash 
   54  ros2 launch so_arm100_moveit_config demo.launch.py hardware_type:=mock_components
   55  ros2 launch so_arm100_moveit_config demo.launch.py hardware_type:=mock_components # hardware_type:=real for running with hardware
   56  ros2 launch so_arm100_moveit_config moveit_rviz.launch.py
   57  exit
   58  ros2 launch so_arm100_description controllers_bringup.launch.py hardware_type:=mock_components # hardware_type:=real for running with hardware
   59  source install/setup.bash 
   60  ros2 launch so_arm100_description controllers_bringup.launch.py hardware_type:=mock_components # hardware_type:=real for running with hardware
   61  exit
   62  cd ws_so_arm100/
   63  source install/setup.bash 
   64  ros2 launch so_arm100_moveit_config demo.launch.py hardware_type:=mock_components # hardware_type:=real for running with hardware
   65  nano src/ros2_so_arm100/so_arm100_description/package.xml 
   66  nano src/ros2_so_arm100/so_arm100_moveit_config/package.xml 
   67  rosdep update && rosdep install --ignore-src --from-paths src -y
   68  nano src/ros2_so_arm100/so_arm100_moveit_config/package.xml 
   69  ros2 launch so_arm100_moveit_config demo.launch.py hardware_type:=mock_components # hardware_type:=real for running with hardware
   70  exit
   71  cd ws_so_arm100/
   72  nano src/ros2_so_arm100/so_arm100_moveit_config/package.xml 
   73  cd
   74  sudo apt install htop
   75  sudo htop
   76  exit
   77  sudo apt install python3-argcomplete python3-colcon-common-extensions libboost-system-dev build-essential
   78  mkdir -p ~/ws_moveit/src
   79  cd ~/ws_moveit/src
   80  git clone -b main https://github.com/moveit/moveit2_tutorials
   81  vcs import --recursive < moveit2_tutorials/moveit2_tutorials.repos
   82  sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
   83  cd ..
   84  colcon build --mixin release
   85  sudo apt install python3-colcon-common-extensions
   86  sudo apt install python3-colcon-mixin
   87  colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
   88  colcon mixin update default
   89  colcon build --mixin release --parallel-workers 1
   90  source install/setup.bash 
   91  exit
   92  cd ws_moveit/
   93  source install/setup.bash 
   94  ros2 launch moveit2_tutorials demo.launch.py rviz_config:=panda_moveit_config_demo_empty.rviz
   95  exit
   96  cd ..
   97  nano .bashrc
   98  cd ur_ws/
   99  source install/setup.bash 
  100  ros2 launch ur_robot_driver test_scaled_joint_trajectory_controller.launch.py
  101  ros2 launch ur_moveit_config ur_moveit.launch.py ur_type:=ur5e launch_rviz:=true
  102  exit
  103  mkdir -p ur_ws/src
  104  cd ur_ws/
  105  git clone https://github.com/UniversalRobots/Universal_Robots_ROS2_Tutorials.git src/ur_tutorials
  106  rosdep update && rosdep install --ignore-src --from-paths src -y
  107  git clone -b ros2 https://github.com/UniversalRobots/Universal_Robots_ROS2_GZ_Simulation.git src/ur_simulation_gz
  108  rosdep update && rosdep install --ignore-src --from-paths src -y
  109  colcon build --symlink-install --parallel-workers 1
  110  source install/setup.bash 
  111  ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=yyy.yyy.yyy.yyy fake_hardware:=true launch_rviz:=false
  112  ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=yyy.yyy.yyy.yyy mock_hardware:=true launch_rviz:=false
  113  ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=yyy.yyy.yyy.yyy use_mock_hardware:=true
  114  ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=yyy.yyy.yyy.yyy use_mock_hardware:=true launch_rviz:=false
  115  exit
  116  wget https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg 
  117  sudo mv pub.gpg /usr/share/keyrings/vscodium-archive-keyring.asc
  118  echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.asc ] https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs vscodium main'     | sudo tee /etc/apt/sources.list.d/vscodium.list
  119  sudo apt update
  120  sudo apt install codium
  121  snap list
  122  df -h
  123  sudo rm -rf /var/cache/snapd/
  124  sudo apt autoremove --purge snapd gnome-software-plugin-snap
  125  rm -fr ~/snap
  126  cat <<EOF | sudo tee /etc/apt/preferences.d/nosnap.pref
  127  # To prevent repository packages from triggering the installation of Snap,
  128  # this file forbids snapd from being installed by APT.
  129  # For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
  130  Package: snapd
  131  Pin: release a=*
  132  Pin-Priority: -10
  133  EOF
  134  sudo apt install gnome-software --no-install-recommends
  135  sudo apt autoremove --purge
  136  exit
  137  sudo apt-get autoremove brltty
  138  wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  139  sha256sum ~/Miniconda3-latest-Linux-x86_64.sh
  140  bash ~/Miniconda3-latest-Linux-x86_64.sh
  141  nano .bashrc
  142  exit
  143  conda create -y -n lerobot python=3.10
  144  conda activate lerobot
  145  git clone https://github.com/huggingface/lerobot.git ~/lerobot
  146  conda install ffmpeg -c conda-forge
  147  cd ~/lerobot && pip install -e ".[feetech]"
  148  nano lerobot/common/robot_devices/robots/configs.py 
  149  python lerobot/scripts/find_motors_bus_port.py
  150  exit
  151  sudo reboot now
  152  conda config --set auto_activate_base false
  153  exit
  154  nano .bashrc
  155  exit
  156  cd ws_so_arm100/
  157  ls src/
  158  source install/setup.bash 
  159  sudo apt list librang*
  160  sudo apt list libserial*
  161  ls /dev
  162  ls /dev/tty*
  163  exit
  164  ./VBoxLinuxAdditions.run 
  165  sudo ./VBoxLinuxAdditions.run 
  166  sudo rcvboxadd reload
  167  sudo shutdown now
  168  sudo rcvoxadd reload
  169  sudo apt install mainline
  170  sudo add-apt-repository ppa:cappelikan/ppa
  171  sudo apt update
  172  sudo apt install mainline
  173  exit
  174  uname -r
  175  sudo su
  176  uname -r
  177  sudo su
  178  uname -r
  179  sudo su
  180  cd /media/admin_ros/VBox_GAs_7.1.8/
  181  sudo ./VBoxLinuxAdditions.run 
  182  sudo rcvboxadd reload
  183  df -h
  184  sudo apt autoremove --purge
  185  df -h
  186  ncdu
  187  sudo apt install ncdu
  188  ncdu
  189  rm -rf .cache/pip/
  190  ncdu
  191  ncdu /
  192  sudo apt clean
  193  df -
  194  df -h
  195  sudo nano /etc/fstab
  196  sudo reboot
  197  df -h
  198  ls -l
  199  rm -rf Miniconda3-latest-Linux-x86_64.sh 
  200  free -m
  201  ncdu /
  202  sudo nano /etc/fstab
  203  sudo rm /swap.img 
  204  exit
  205  df -h
  206  exit

```

### Installation d'autres versions de ROS2

Pour avoir accès à toutes les dernières fonctionnalités en cours de développement (partiellement publiées), il faut [installer **ROS2 Rolling**](https://docs.ros.org/en/rolling/Installation/Ubuntu-Install-Debians.html), qui est une distribution en développement continu ["rolling release"](https://fr.wikipedia.org/wiki/Rolling_release). Par exemple en Avril 2023, l'[API Python de MoveIt2 et son tutoriel](https://moveit.picknik.ai/main/doc/examples/motion_planning_python_api/motion_planning_python_api_tutorial.html) ne sont disponibles que sous rolling.

On peut installer plusieurs versions de ros en parallèle. Chaque version sera installée dans `/opt/ros/version`. Pour faire cohabiter les deux versions, il faut "sourcer" le bon répertoire avant de lancer un programme `ros2 launch ...` ou de compiler un workspace `colcon build ...`. Deux options s'offrent à nous :

- Si on bascule souvent de version : commenter les lignes `source /opt/ros/humble/setup.bash` en bas du fichier `~/.bashrc`
    - Il faudra alors lancer la commande `source /opt/ros/humble/setup.bash` **à chaque nouvelle ouverture de Terminal Bash**.
- Si on travaille principalement avec une version : commenter la ligne correspondant à la version principale `source /opt/ros/humble/setup.bash` en bas du fichier `~/.bashrc` lorsqu'on veut utiliser la version secondaire.

### Gestion de version avec Ansible

L'idéal serait de gérer l'état des VM/PC de TP avec ansible plutôt que des snapshot VirtualBox

Voir [https://innovation.iha.unistra.fr/books/robotique-open-source/page/deploiement-de-ros2](https://innovation.iha.unistra.fr/books/robotique-open-source/page/deploiement-de-ros2)

[https://github.com/richlamdev/ansible-desktop-ubuntu](https://github.com/richlamdev/ansible-desktop-ubuntu)

## Outils utiles

### Terminal multi-fenêtres Terminator

- Installer Terminator : c'est un logiciel de Ligne de commande pratique pour programmer avec ROS 
    - Depuis Windows Store : Rechercher et installer `Terminator (Ubuntu)`
    - Depuis la ligne de commande Linux : `sudo apt install terminator`
- Depuis le menu démarrer Windows, Lancer `Terminator (Ubuntu)`

### Visual Studio Codium

Pour éviter d'alourdir la VM avec de la télémétrie Microsoft, on installe la version sans tracker de Visual Studio Code depuis [un dépôt debian](https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo#option-1-recommended) :

- Lancer la VM VirtualBox ou WSL (`Terminator (Ubuntu)`)
- Dans Terminator, lancer les commandes suivantes :

```
wget https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg 
sudo mv pub.gpg /usr/share/keyrings/vscodium-archive-keyring.asc
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.asc ] https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs vscodium main' \
    | sudo tee /etc/apt/sources.list.d/vscodium.list
sudo apt update
sudo apt install codium


```

- Lancer VSCodium dans la VM VirtualBox ou directement depuis Windows, lancer `VSCodium (Ubuntu)`
- Ouvrir le **dossier contenant le code source** `/src` du projet dont vous voulez étudier/modifier le code : `File --> Open Folder --> ~/ws_moveit/src`

### Installer Firefox dans WSL

https://askubuntu.com/questions/1444962/how-do-i-install-firefox-in-wsl-when-it-requires-snap-but-snap-doesnt-work

```
sudo snap remove firefox
sudo apt remove firefox
sudo add-apt-repository ppa:mozillateam/ppa

# Create a new file, it should be empty as it opens:
sudo gedit /etc/apt/preferences.d/mozillateamppa

# Insert these lines, then save and exit
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501

# after saving, do
sudo apt update
sudo apt install firefox-esr


```

### Alléger Ubuntu (pour VM ou clonage)

- [Désinstaller snap](https://askubuntu.com/questions/1035915/how-to-remove-snap-from-ubuntu) : 
    - Vérifier qu'on n'a pas de paquet snap important avec `snap list`
    - Purger snap et tous ses paquets

```
sudo rm -rf /var/cache/snapd/

sudo apt autoremove --purge snapd gnome-software-plugin-snap

rm -fr ~/snap

# sudo apt-mark hold snapd

```

- - Empêcher snap d'être réinstallé par Ubuntu

```
cat <<EOF | sudo tee /etc/apt/preferences.d/nosnap.pref
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html

Package: snapd
Pin: release a=*
Pin-Priority: -10
EOF

```

- - Installer le magasin d'applications de gnome sans snap/flatpak `sudo apt install gnome-software --no-install-recommends`
- Supprimer les paquets apt plus nécessaires `sudo apt autoremove --purge`
- [Supprimer le cache de compilation de VSCode](https://stackoverflow.com/questions/78300434/is-it-safe-to-delete-cache-vscode-cpptools-in-vscode) `~/.cache/vscode-cpptools`
- Supprimer le cache de pip `~/.cache/pip`
- Supprimer les fichiers de compilation des workspaces qui ne seront pas utilisés en TP. Attention à conserver les paquets qui devront être compilés en TP (en utilisant `colcon build --package-select`).
- Désactiver le SWAP avec `swapoff -a` puis commenter la ligne dans `/etc/fstab` puis supprimer le fichier de swap `/swap.img`
- Réduire la taille de la partition via l'application Disks. Celle-ci pourra être agrandie après copie de la VM.

### Configuration VirtualBox

Windows consomme à lui seul près de 4-8Go, Ubuntu &gt;2Go et la compilation &gt;4Go, on peut vite atteindre la saturation. Un PC de 16Go peut suffire mais il faudra compiler sans parallélisation, et fermer des applications lourdes dans Windows comme Firefox.

- Vérifier et adapter la configuration de la VM en ressources RAM, CPU, GPU et Réseau selon la configuration de votre PC 
    - 8GB mini de RAM si vous devez compiler des workspace ROS
    - 4 CPU mini. 6-10 CPU si l'accélération graphique ne fonctionne pas et que vous faites du RViz ou Gazebo

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/scaled-1680-/GYLimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/GYLimage.png)[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/scaled-1680-/SYCimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/SYCimage.png)

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/scaled-1680-/0ubimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/0ubimage.png)

- <s>Installation des Guest Add-ons pour gestion de l'accélération graphique, du copier-coller entre Windows et la VM</s>  
    <s>[https://doc.ubuntu-fr.org/virtualbox\_additions\_invite](https://doc.ubuntu-fr.org/virtualbox_additions_invite) </s>
- A priori la nouvelle façon d'installer les add-on c'est simplement installer <span class="comment-copy">`sudo apt install virtualbox-guest-x11` dans la VM. Puis démarrer la session Xorg, cf. prochain point.</span>

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-04/scaled-1680-/SxDimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-04/SxDimage.png)

- Démarrage d'une session graphique Xorg qui est plus stable que Wayland sous VirtualBox

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-04/scaled-1680-/I6Fimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-04/I6Fimage.png)

- Désactiver l'accélération graphique qui n'est pas bien supportée sous Ubuntu 24.04 avec VirtualBox 7.1.7   
    [https://www.virtualbox.org/ticket/21955](https://www.virtualbox.org/ticket/21955)   
    [https://forums.virtualbox.org/viewtopic.php?t=111676](https://forums.virtualbox.org/viewtopic.php?t=111676)   
    Même passer au kernel 6.3 qui semblait non problématique n'a pas réglé le soucis

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-04/scaled-1680-/Wviimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2025-04/Wviimage.png)

Astuce en cas de soucis suite à màj VirtualBox : [https://forums.virtualbox.org/viewtopic.php?t=12692](https://forums.virtualbox.org/viewtopic.php?t=12692)

- Supprimer les Extensions Pack
- Désinstaller
- Réinstaller

# Sources

- [Installation de MoveIt2 Humble sur Ubuntu 22.04](https://moveit.picknik.ai/humble/doc/tutorials/getting_started/getting_started.html)
- [Tutoriels débutant](https://docs.ros.org/en/rolling/Tutorials/Beginner-CLI-Tools.html)

<span style="color: #ced4d9;">-----</span>

<span style="color: #70dbd8;">Auteur: Gauthier Hentz, sur le [wiki de l'innovation de l'IUT de Haguenau](https://innovation.iha.unistra.fr/books/robotique-open-source)</span>

<span style="color: #000000; background-color: #70dbd8;">[ Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) ](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.fr)</span>

# Tutoriels de base

Pour comprendre les concepts de ROS2 par la pratique, il existe des tutoriels pour débutant. Ils reposent sur la simulation d'un robot mobile à deux roues principales développé par les développeurs de ROS en 2010 : [Turtlebot](https://fr.wikipedia.org/wiki/TurtleBot). Le [TurtleBot 3 est vendue par Robotis](https://emanual.robotis.com/docs/en/platform/turtlebot3/overview/) et peut être [couplé à un bras manipulateur 5 axes OpenMANIPULATOR-X](https://emanual.robotis.com/docs/en/platform/turtlebot3/manipulation/#manipulation). Il est possible de [simuler des applications de manipulation mobile avec Gazebo](https://emanual.robotis.com/docs/en/platform/turtlebot3/manipulation/#simulation).

Pour réaliser les tutoriels de base, il nous faut un environnement de développement, deux options :

- Une machine virtuelle (VM) [VirtualBox](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-ubuntu-via-virtualbo), ou disponible au téléchargement ici 
    - Le plus simple et rapide pour démarrer
    - Si on n'a pas de Hardware ou qu'on ne souhaite travailler qu'en simulation
- Une installation simple ou dual-boot sur un PC 
    - Il faut alors installer de zéro
    - Indispensable si on veut travailler avec du Hardware

Supposons que vous avez [installé et testé votre environnement comme celui de la VM](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-installation-de-ros2).

Connexion à la VM

- nom : ubuntu22ros2
- utilisateur : `etudiant`
- mdp : département de l'IUT

Nous pouvons directement passer aux tutoriels sur les outils ROS 2 en ligne de commande :

<div class="toctree-wrapper compound" id="bkmrk-configuring-environm"><div class="toctree-wrapper compound">- [Configuring environment](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html)
- [Using `<span class="pre">turtlesim</span>`, `<span class="pre">ros2</span>`, and `<span class="pre">rqt</span>`](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html)
- [Understanding nodes](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Nodes/Understanding-ROS2-Nodes.html)
- [Understanding topics](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.html)
- [Understanding services](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Services/Understanding-ROS2-Services.html)
- [Understanding parameters](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Parameters/Understanding-ROS2-Parameters.html)

</div></div>Ces premiers tutoriels ne nécessitent qu'une installation basique de ROS 2, on n'y regarde pas le code source.

Ensuite on passe aux tutoriels sur les bibliothèques clientes de ROS 2 en C++ et Python :

<div class="toctree-wrapper compound" id="bkmrk-using-colcon-to-buil"><div class="toctree-wrapper compound">- [Using `<span class="pre">colcon</span>` to build packages](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html)
- [Creating a workspace](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html)
- [Creating a package](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html)
- [Writing a simple publisher and subscriber (C++)](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html) --&gt; Correction
- [Writing a simple publisher and subscriber (Python)](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.html)
- [Writing a simple service and client (C++)](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Service-And-Client.html)
- [Writing a simple service and client (Python)](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Service-And-Client.html)
- [Creating custom msg and srv files](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.html)

</div></div>Ces tutoriels vous engagent à copier et analyser du code source en C++ et Python. Les fichiers créés sont placés dans le dossier de travail (workspace) `/home/etudiant/ros2_ws/src`, à ouvrir avec Visual Studio Code :

[![image.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/scaled-1680-/2azimage.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-11/2azimage.png)

Vous trouverez des fichiers de correction commentés dans `ros2_ws/src/cpp_pubsub/src/`, en particulier :

- publisher\_member\_function.cpp
- subscriber\_member\_function.cpp

Pour les tester il [faut lancer ](https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html#build-and-run):

```
cd ~/ros2_ws
colcon build --packages-select cpp_pubsub
source install/setup.bash
ros2 run cpp_pubsub talker
```

Le noeud se met à publier/parler :

```
[INFO] [minimal_publisher]: Publishing: "Hello World: 0"
[INFO] [minimal_publisher]: Publishing: "Hello World: 1"
[INFO] [minimal_publisher]: Publishing: "Hello World: 2"
[INFO] [minimal_publisher]: Publishing: "Hello World: 3"
[INFO] [minimal_publisher]: Publishing: "Hello World: 4"
```

Puis dans un second Terminal :

```
ros2 run cpp_pubsub listener
```

Le noeud se met à écouter :

```
[INFO] [minimal_subscriber]: I heard: "Hello World: 10"
[INFO] [minimal_subscriber]: I heard: "Hello World: 11"
[INFO] [minimal_subscriber]: I heard: "Hello World: 12"
[INFO] [minimal_subscriber]: I heard: "Hello World: 13"
[INFO] [minimal_subscriber]: I heard: "Hello World: 14"
```

Tapez `<span class="pre">Ctrl+C</span>` dans chaque Terminal pour arrêter les noeuds ("stop spinning").

<span style="color: #ced4d9;">-----</span>

<span style="color: #70dbd8;">Auteur: Gauthier Hentz, sur le [wiki de l'innovation de l'IUT de Haguenau](https://innovation.iha.unistra.fr/books/robotique-open-source)</span>

<span style="color: #000000; background-color: #70dbd8;">[ Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) ](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.fr)</span>

# Découverte d'Ubuntu Linux et son Terminal Bash

## Navigating the Ubuntu GUI

> In this exercise, we will familiarize ourselves with the graphical user interface (GUI) of the Ubuntu operating system.

### Task 1: Familiarize Yourself with the Ubuntu Desktop

At the log-in screen, click in the password input box, enter `<span class="pre">rosindustrial</span>` for the password, and hit enter. The screen should look like the image below when you log in:

![../../_images/ubuntu_desktop.png](https://industrial-training-master.readthedocs.io/en/humble/_images/ubuntu_desktop.png)

There are several things you will notice on the desktop:

![../../_images/ubuntu_desktop_details.png](https://industrial-training-master.readthedocs.io/en/humble/_images/ubuntu_desktop_details.png)

<div class="document" id="bkmrk-the-gear-icon-on-the" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div class="document" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div itemprop="articleBody"><div class="section"><div class="section" id="bkmrk-the-gear-icon-on-the-1">1. The gear icon on the top right of the screen brings up a menu which allows the user to log out, shut down the computer, access system settings, etc…
2. The bar on the left side shows running and “favorite” applications, connected thumb drives, etc.
3. The top icon is used to access all applications and files. We will look at this in more detail later.
4. The next icons are either applications which are currently running or have been “pinned” (again, more on pinning later)
5. Any removable drives, like thumb drives, are found after the application icons.
6. If the launcher bar gets “too full”, clicking and dragging up/down allows you to see the applications that are hidden.
7. To reorganize the icons on the launcher, click and hold the icon until it “pops out”, then move it to the desired location.

</div><div class="section">  
</div></div></div></div></div>### Task 2: Open and Inspect an Application

Click on the filing-cabinet icon in the launcher. A window should show up, and your desktop should look like something below:

![../../_images/ubuntu_folder_browser.png](https://industrial-training-master.readthedocs.io/en/humble/_images/ubuntu_folder_browser.png)

Things to notice:

<div class="document" id="bkmrk-the-close%2C-minimize%2C" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div class="document" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div itemprop="articleBody"><div class="section"><div class="section">1. The close, minimize, and maximize buttons typically found on the right-hand side of the window title bar are found on the left-hand side.
2. The menu for windows are found on the menu bar at the top of the screen, much in the same way Macs do. The menus, however, only show up when you hover the mouse over the menu bar.
3. Notice that there are menu highlights of the folder icon. The dots on the left show how many windows of this application are open. Clicking on these icons when the applications are open does one of two things:

- If there is only one window open, this window gets focus.
- If more than one are open, clicking a second time causes all of the windows to show up in the foreground, so that you can choose which window to go to (see below):

</div></div></div></div></div>![../../_images/ubuntu_inspect.png](https://industrial-training-master.readthedocs.io/en/humble/_images/ubuntu_inspect.png)

<div class="document" id="bkmrk--4" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div class="document" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div itemprop="articleBody"><div class="section"><div class="section" id="bkmrk--5"></div><div class="section">  
</div></div></div></div></div>### Task 3: Start an Application &amp; Pin it to the Launcher Bar

Click on the launcher button (top left) and type gedit in the search box. The “Text Editor” application (this is actually gedit) should show up (see below):

![../../_images/ubuntu_start_application.png](https://industrial-training-master.readthedocs.io/en/humble/_images/ubuntu_start_application.png)

Click on the application. The text editor window should show up on the screen, and the text editor icon should show up on the launcher bar on the left-hand side (see below):

![../../_images/ubuntu_application_pin.png](https://industrial-training-master.readthedocs.io/en/humble/_images/ubuntu_application_pin.png)

<div class="document" id="bkmrk-right-click-on-the-t" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div class="document" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div itemprop="articleBody"><div class="section"><div class="section">1. Right-click on the text editor launch icon, and select “Lock to Launcher”.
2. Close the gedit window. The launcher icon should remain after the window closes.
3. Click on the gedit launcher icon. You should see a new gedit window appear.

</div></div></div></div></div>## Le Terminal Linux  


> In this exercise, we will familiarize ourselves with the Linux terminal.

### Starting the Terminal

<div class="section" id="bkmrk-pour-ouvrir-le-termi">1. Pour ouvrir le Terminal, recherchez le programme "terminator" ou cliquez sur l'icône:
    
    [![63008829.png](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-09/scaled-1680-/63008829.png)](https://innovation.iha.unistra.fr/uploads/images/gallery/2023-09/63008829.png)
2. Create a second terminal window, either by:
    
    
    - Right-clicking on the terminal and selecting the “Open Terminal” or
    - Selecting “Open Terminal” from the “File” menu
3. Create a second terminal within the same window by pressing “Ctrl+Shift+T” while the terminal window is selected.
4. Close the 2nd terminal tab, either by:
    
    
    - clicking the small ‘x’ in the terminal tab (not the main terminal window)
    - typing `<span class="pre">exit</span>` and hitting enter.
5. The window will have a single line, which looks like this:
    
    `<span class="pre">ros-industrial@ros-i-humble-vm:~$</span>`
6. This is called the prompt, where you enter commands. The prompt, by default, provides three pieces of information:
    
    
    1. *ros-industrial* is the login name of the user you are running as.
    2. *ros-i-humble-vm* is the host name of the computer.
    3. ~ is the directory in which the terminal is currently in. (More on this later).
7. Close the terminal window by typing `<span class="pre">exit</span>` or clicking on the red ‘x’ in the window’s titlebar.

</div>### Navigating Directories and Listing Files

#### Prepare your environment

<div class="section" id="bkmrk-open-your-home-folde"><div class="section"><div class="section" id="bkmrk-open-your-home-folde-1">1. Open your home folder in the file browser.
2. Double-click on the `<span class="pre">ex0.3</span>` folder we created in the previous step.
    
    
    - *We’ll use this to illustrate various file operations in the terminal.*
3. Right click in the main file-browser window and select “Open in Terminal” to create a terminal window at that location.
4. In the terminal window, type the following command to create some sample files that we can study later:
    
    
    - `<span class="pre">cp</span> <span class="pre">-a</span> <span class="pre">~/industrial_training/exercises/0.3/.</span> <span class="pre">.</span>`

</div></div></div>#### ls Command

<div class="section" id="bkmrk-enter-ls-into-the-te"><div class="section"><div class="section" id="bkmrk-enter-ls-into-the-te-1">1. Enter `<span class="pre">ls</span>` into the terminal.
    
    
    - You should see `<span class="pre">test.txt</span>`, and `<span class="pre">new</span>` listed. (If you don’t see ‘new’, go back and complete the [<span class="doc">previous exercise</span>](https://industrial-training-master.readthedocs.io/en/humble/_source/prerequisites/Exploring-the-Linux-File-System.html)).
    - Directories, like `<span class="pre">new</span>`, are colored in blue.
    - The file `<span class="pre">sample_job</span>` is in green; this indicates it has its “execute” bit set, which means it can be executed as a command.
2. Type `<span class="pre">ls</span> <span class="pre">*.txt</span>`. Only the file `<span class="pre">test.txt</span>` will be displayed.
3. Enter `<span class="pre">ls</span> <span class="pre">-l</span>` into the terminal.
    
    
    - Adding the `<span class="pre">-l</span>` option shows one entry per line, with additional information about each entry in the directory.
    - The first 10 characters indicate the file type and permissions
    - The first character is `<span class="pre">d</span>` if the entry is a directory.
    - The next 9 characters are the permissions bits for the file
    - The third and fourth fields are the owning user and group, respectively.
    - The second-to-last field is the time the file was last modified.
    - If the file is a symbolic link, the link’s target file is listed after the link’s file name.
4. Enter `<span class="pre">ls</span> <span class="pre">-a</span>` in the terminal.
    
    
    - You will now see one additional file, which is hidden.
5. Enter `<span class="pre">ls</span> <span class="pre">-a</span> <span class="pre">-l</span>` (or `<span class="pre">ls</span> <span class="pre">-al</span>`) in the command.
    
    
    - You’ll now see that the file `<span class="pre">hidden_link.txt</span>` points to `<span class="pre">.hidden_text_file.txt</span>`.

</div></div></div>#### `<span class="pre">pwd</span>` and `<span class="pre">cd</span>` Commands

<div class="section" id="bkmrk-enter-pwd-into-the-t"><div class="section"><div class="section">1. Enter `<span class="pre">pwd</span>` into the terminal.
    
    
    - This will show you the full path of the directory you are working in.
2. Enter `<span class="pre">cd</span> <span class="pre">new</span>` into the terminal.
    
    
    - The prompt should change to `<span class="pre">ros-industrial@ros-i-humble-vm:~/ex0.3/new$</span>`.
    - Typing `<span class="pre">pwd</span>` will show you now in the directory `<span class="pre">/home/ros-industrial/ex0.3/new</span>`.
3. Enter `<span class="pre">cd</span> <span class="pre">..</span>` into the terminal. \* In the [<span class="doc">previous exercise</span>](https://industrial-training-master.readthedocs.io/en/humble/_source/prerequisites/Exploring-the-Linux-File-System.html), we noted that `<span class="pre">..</span>` is the parent folder. \* The prompt should therefore indicate that the current working directory is `<span class="pre">/home/ros-industrial/ex0.3</span>`.
4. Enter `<span class="pre">cd</span> <span class="pre">/bin</span>`, followed by `<span class="pre">ls</span>`.
    
    
    - This folder contains a list of the most basic Linux commands.  
        *Note that `<span class="pre">pwd</span>` and `<span class="pre">ls</span>` are both in this folder.*
5. Enter `<span class="pre">cd</span> <span class="pre">~/ex0.3</span>` to return to our working directory.
    
    
    - Linux uses the `<span class="pre">~</span>` character as a shorthand representation for your home directory.
    - It’s a convenient way to reference files and paths in command-line commands.
    - You’ll be typing it a lot in this class… remember it!

</div></div></div>*If you want a full list of options available for any of the commands given in this section, type `<span class="pre">man</span> <span class="pre"><command></span>` (where `<span class="pre"><command></span>` is the command you want information on) in the command line. This will provide you with built-in documentation for the command. Use the arrow and page up/down keys to scroll, and `<span class="pre">q</span>` to exit.*

<div class="section" id="bkmrk--8"><div class="section" id="bkmrk--9"></div></div>### Altering Files

#### mv Command

<div class="section" id="bkmrk-type-mv-test.txt-tes"><div class="section"><div class="section" id="bkmrk-type-mv-test.txt-tes-1">1. Type `<span class="pre">mv</span> <span class="pre">test.txt</span> <span class="pre">test2.txt</span>`, followed by `<span class="pre">ls</span>`.
    
    
    - You will notice that the file has been renamed to `<span class="pre">test2.txt</span>`.  
        *This step shows how `<span class="pre">mv</span>` can rename files.*
2. Type `<span class="pre">mv</span> <span class="pre">test2.txt</span> <span class="pre">new</span>`, then `<span class="pre">ls</span>`.
    
    
    - The file will no longer be present in the folder.
3. Type `<span class="pre">cd</span> <span class="pre">new</span>`, then `<span class="pre">ls</span>`.
    
    
    - You will see `<span class="pre">test2.txt</span>` in the folder.  
        *These steps show how `<span class="pre">mv</span>` can move files.*
4. Type `<span class="pre">mv</span> <span class="pre">test2.txt</span> <span class="pre">../test.txt</span>`, then `<span class="pre">ls</span>`.
    
    
    - `<span class="pre">test2.txt</span>` will no longer be there.
5. Type `<span class="pre">cd</span> <span class="pre">..</span>`, then `<span class="pre">ls</span>`.
    
    
    - You will notice that `<span class="pre">test.txt</span>` is present again.  
        *This shows how `<span class="pre">mv</span>` can move and rename files in one step.*

</div></div></div>#### cp Command

<div class="section" id="bkmrk-type-cp-test.txt-new"><div class="section"><div class="section" id="bkmrk-type-cp-test.txt-new-1">1. Type `<span class="pre">cp</span> <span class="pre">test.txt</span> <span class="pre">new/test2.txt</span>`, then `<span class="pre">ls</span> <span class="pre">new</span>`.
    
    
    - You will see `<span class="pre">test2.txt</span>` is now in the `<span class="pre">new</span>` folder.
2. Type `<span class="pre">cp</span> <span class="pre">test.txt</span> <span class="pre">"test</span> <span class="pre">copy.txt"</span>`, then `<span class="pre">ls</span> <span class="pre">-l</span>`.
    
    
    - You will see that `<span class="pre">test.txt</span>` has been copied to `<span class="pre">test</span> <span class="pre">copy.txt</span>`.  
        *Note that the quotation marks are necessary when spaces or other special characters are included in the file name.*

</div></div></div>#### rm Command

<div class="section" id="bkmrk-type-rm-%22test-copy.t"><div class="section"><div class="section" id="bkmrk-type-rm-%22test-copy.t-1">1. Type `<span class="pre">rm</span> <span class="pre">"test</span> <span class="pre">copy.txt"</span>`, then `<span class="pre">ls</span> <span class="pre">-l</span>`.
    
    
    - You will notice that `<span class="pre">test</span> <span class="pre">copy.txt</span>` is no longer there.

</div></div></div>#### mkdir Command

<div class="section" id="bkmrk-type-mkdir-new2%2C-the"><div class="section"><div class="section" id="bkmrk-type-mkdir-new2%2C-the-1">1. Type `<span class="pre">mkdir</span> <span class="pre">new2</span>`, then `<span class="pre">ls</span>`.
    
    
    - You will see there is a new folder `<span class="pre">new2</span>`.

</div></div></div>#### touch Command

<div class="section" id="bkmrk-type-touch-%7E%2Ftemplat"><div class="section"><div class="section">1. Type `<span class="pre">touch</span> <span class="pre">~/Templates/"Untitled</span> <span class="pre">Document"</span>`.
    
    
    - This will create a new Document named **“Untitled Document”**

</div></div></div>*You can use the `<span class="pre">-i</span>` flag with `<span class="pre">cp</span>`, `<span class="pre">mv</span>`, and `<span class="pre">rm</span>` commands to prompt you when a file will be overwritten or removed.*

<div class="section" id="bkmrk--10"><div class="section" id="bkmrk--11"></div></div>#### Editing Text (and Other GUI Commands)

<div class="section" id="bkmrk-type-gedit-test.txt."><div class="section"><div class="section" id="bkmrk-type-gedit-test.txt.-1">1. Type `<span class="pre">gedit</span> <span class="pre">test.txt</span>`.
    
    
    - You will notice that a new text editor window will open, and `<span class="pre">test.txt</span>` will be loaded.
    - The terminal will not come back with a prompt until the window is closed.
2. There are two ways around this limitation. Try both…
3. **Starting the program and immediately returning a prompt:**
    
    
    1. Type `<span class="pre">gedit</span> <span class="pre">test.txt</span> <span class="pre">&</span>`.
        
        
        - The `<span class="pre">&</span>` character tells the terminal to run this command in “the background”, meaning the prompt will return immediately.
    2. Close the window, then type `<span class="pre">ls</span>`.
        
        
        - In addition to showing the files, the terminal will notify you that `<span class="pre">gedit</span>` has finished.
4. **Moving an already running program into the background:**
    
    
    1. Type `<span class="pre">gedit</span> <span class="pre">test.txt</span>`.
        
        
        - The window should open, and the terminal should not have a prompt waiting.
    2. In the terminal window, press Ctrl+Z.
        
        
        - The terminal will indicate that `<span class="pre">gedit</span>` has stopped, and a prompt will appear.
    3. Try to use the `<span class="pre">gedit</span>` window.
        
        
        - Because it is paused, the window will not run.
    4. Type `<span class="pre">bg</span>` in the terminal.
        
        
        - The `<span class="pre">gedit</span>` window can now run.
    5. Close the `<span class="pre">gedit</span>` window, and type `<span class="pre">ls</span>` in the terminal window.
        
        
        - As before, the terminal window will indicate that `<span class="pre">gedit</span>` is finished.

</div></div></div>#### Running Commands as Root

<div class="section" id="bkmrk-in-a-terminal%2C-type--2"><div class="section"><div class="section">1. In a terminal, type `<span class="pre">ls</span> <span class="pre">-a</span> <span class="pre">/root</span>`.
    
    
    - The terminal will indicate that you cannot read the folder `<span class="pre">/root</span>`.
    - Many times you will need to run a command that cannot be done as an ordinary user, and must be done as the “super user”
2. To run the previous command as root, add `<span class="pre">sudo</span>` to the beginning of the command.
    
    
    - In this instance, type `<span class="pre">sudo</span> <span class="pre">ls</span> <span class="pre">-a</span> <span class="pre">/root</span>` instead.
    - The terminal will request your password (in this case, `<span class="pre">rosindustrial</span>`) in order to proceed.
    - Once you enter the password, you should see the contents of the `<span class="pre">/root</span>` directory.

</div></div></div>***Warning**: `<span class="pre">sudo</span>` is a powerful tool which doesn’t provide any sanity checks on what you ask it to do, so be **VERY** careful in using it*

*https://industrial-training-master.readthedocs.io/en/humble/\_source/prerequisites/Navigating-the-Ubuntu-GUI.html*

<div class="section" id="bkmrk--12"><div class="section" id="bkmrk--13"></div></div><div class="document" id="bkmrk--14" itemscope="itemscope" itemtype="http://schema.org/Article" role="main"><div itemprop="articleBody"><div class="section" id="bkmrk--15"><div class="section" id="bkmrk--16"></div></div></div></div>

# Usage avancé du bash Linux

### Job management

#### Stopping Jobs

<div class="section" id="bkmrk-type-.%2Fsample_job.-t"><div class="section"><div class="section" id="bkmrk-type-.%2Fsample_job.-t-1">1. Type `<span class="pre">./sample_job</span>`.
    
    
    - The program will start running.
2. Press Control+C.
    
    
    - The program should exit.
3. Type `<span class="pre">./sample_job</span> <span class="pre">sigterm</span>`.
    
    
    - The program will start running.
4. Press Control+C.
    
    
    - This time the program will not die.

</div></div></div>#### Stopping “Out of Control” Jobs

<div class="section" id="bkmrk-open-a-new-terminal-"><div class="section"><div class="section" id="bkmrk-open-a-new-terminal--1">1. Open a new terminal window.
2. Type `<span class="pre">ps</span> <span class="pre">ax</span>`.
3. Scroll up until you find `<span class="pre">python</span> <span class="pre">./sample_job</span> <span class="pre">sigterm</span>`.
    
    
    - This is the job that is running in the first window.
    - The first field in the table is the ID of the process (use `<span class="pre">man</span> <span class="pre">ps</span>` to learn more about the other fields).
4. Type `<span class="pre">ps</span> <span class="pre">ax</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">sample</span>`.
    
    
    - You will notice that only a few lines are returned.
    - This is useful if you want to find a particular process
    - *Note: this is an advanced technique called “piping”, where the output of one program is passed into the input of the next. This is beyond the scope of this class, but is useful to learn if you intend to use the terminal extensively.*
5. Type `<span class="pre">kill</span> <span class="pre"><id></span>`, where `<span class="pre"><id></span>` is the job number you found with the `<span class="pre">ps</span> <span class="pre">ax</span>`.
6. In the first window, type `<span class="pre">./sample_job</span> <span class="pre">sigterm</span> <span class="pre">sigkill</span>`.
    
    
    - The program will start running.
7. In the second window, type `<span class="pre">ps</span> <span class="pre">ax</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">sample</span>` to get the id of the process.
8. Type `<span class="pre">kill</span> <span class="pre"><id></span>`.
    
    
    - This time, the process will not die.
9. Type `<span class="pre">kill</span> <span class="pre">-SIGKILL</span> <span class="pre"><id></span>`.
    
    
    - This time the process will exit.

</div></div></div>#### Showing Process and Memory usage

<div class="section" id="bkmrk-in-a-terminal%2C-type-"><div class="section"><div class="section" id="bkmrk-in-a-terminal%2C-type--1">1. In a terminal, type `<span class="pre">top</span>`.
    
    
    - A table will be shown, updated once per second, showing all of the processes on the system, as well as the overall CPU and memory usage.
2. Press the Shift+P key.
    
    
    - This will sort processes by CPU utilization.  
        *This can be used to determine which processes are using too much CPU time.*
3. Press the Shift+M key.
    
    
    - This will sort processes by memory utilization  
        *This can be used to determine which processes are using too much memory.*
4. Press q or Ctrl+C to exit the program.

</div></div></div>

# Déploiement de ROS2

### Pour le déploiement d'environnements pédagogique et concours

On voit plusieurs approches :

- déploiement de machine native Ubuntu, par clonage de disque par exemple
- déploiement de VM VirtualBox
- déploiement de Docker container

Veut-on enseigner la robotique ou l'ingénierie logiciel sous Linux ? Selon moi, il faut différencier deux types de public :

- On veut enseigner la robotique Open Source, par exemple à des électroniciens 
    - on n'aborde pas l'installation ROS, la création de package dans un workspace et sa compilation
    - on fournit une machine dont l'enseignant maitrise l'état
    - tout est fait dans un IDE type VSCode.
    - les apprenants peuvent se concentrer sur la génération de codes et d'algorithmes pour résoudre un problème robotique
    - on reste en simulation ou on déploie sur un robot en fin de parcours
    - on bascule d'une conteneur à un autre depuis VSCode pour éviter les erreurs de config
- On veut enseigner l'ingénierie logiciel appliquée à la robotique avec ROS 
    - initiation à Ubuntu et à la ligne de commande
    - on déroule tout le tutoriel ROS en encourageant à faire un dual-boot (ou éventuellement un WSL) sur une machine personnelle
    - on insiste sur les réflexes de compilation dans le terminal
    - on laisse naviguer entre plusieurs workspaces sans Docker

#### Besoin pour la robotique industrielle

Par ordre croissant de complexité :

- Visualisation et planification trajectoire avec MoveIt2 via plugin motion\_planning dans RViz2 [https://moveit.picknik.ai/main/doc/tutorials/quickstart\_in\_rviz/quickstart\_in\_rviz\_tutorial.html](https://moveit.picknik.ai/main/doc/tutorials/quickstart_in_rviz/quickstart_in_rviz_tutorial.html)
    - cellule SO-ARM100 ou Panda (moveit2\_tutorial officiel) ou cellule UR5e
- MoveIt2 Python API [https://moveit.picknik.ai/main/doc/examples/motion\_planning\_python\_api/motion\_planning\_python\_api\_tutorial.html](https://moveit.picknik.ai/main/doc/examples/motion_planning_python_api/motion_planning_python_api_tutorial.html)
- Connexion à docker container URSim [https://innovation.iha.unistra.fr/books/robotique-open-source/page/universal-robot-ros2-driver#bkmrk-installation-du-simu](https://innovation.iha.unistra.fr/books/robotique-open-source/page/universal-robot-ros2-driver#bkmrk-installation-du-simu)
- Contrôle vrai SO-ARM100
- Contrôle vrai UR5e
- Contrôle local de trajectoire avec MoveIt Servo : téléopération via manette ou asservissement visuel (TOF sensor) [https://moveit.picknik.ai/main/doc/how\_to\_guides/controller\_teleoperation/controller\_teleoperation.html](https://moveit.picknik.ai/main/doc/how_to_guides/controller_teleoperation/controller_teleoperation.html)
- Gazebo et simulation traitement de l'image 2D/3D
- Pour aller plus loin : [Cartesian Path Planning](https://moveit.picknik.ai/main/doc/how_to_guides/using_ompl_constrained_planning/ompl_constrained_planning.html), [Hybrid Planning](https://moveit.picknik.ai/main/doc/examples/hybrid_planning/hybrid_planning_tutorial.html), MoveIt Task Constructor ([https://moveit.picknik.ai/main/doc/tutorials/pick\_and\_place\_with\_moveit\_task\_constructor/pick\_and\_place\_with\_moveit\_task\_constructor.html](https://moveit.picknik.ai/main/doc/tutorials/pick_and_place_with_moveit_task_constructor/pick_and_place_with_moveit_task_constructor.html) , UR10e\_welding\_demo)

#### Besoin pour la robotique mobile

Par ordre croissant de complexité :

- Tutoriels Nav2 avec paquets tb3 [https://docs.nav2.org/getting\_started/index.html](https://docs.nav2.org/getting_started/index.html)
- Tutoriels ROBOTIS Turtlebot3 en simulation [https://github.com/ROBOTIS-GIT/turtlebot3\_simulations](https://github.com/ROBOTIS-GIT/turtlebot3_simulations)
    - Cartographie et Navigation autonome avec GZ Sim
    - Suivi de ligne avec OpenCV [https://innovation.iha.unistra.fr/books/robotique-open-source/page/suivi-de-ligne-ros2-humble](https://innovation.iha.unistra.fr/books/robotique-open-source/page/suivi-de-ligne-ros2-humble)
- Tutoriels ROBOTIS Turtlebot3 avec le vrai robot [https://emanual.robotis.com/docs/en/platform/turtlebot3/quick-start/](https://emanual.robotis.com/docs/en/platform/turtlebot3/quick-start/)
- Architecture de flotte : 
    - temps réel sur le Raspberry : drivers actionneurs et capteurs, planification locale de trajectoire ?
    - calcul lourds sur PC déporté : cartographie, SLAM, planification globale de trajectoire
- Déploiement contrôleur sur le Raspberry du TurtleBot3
- Setup communication via access point ou hotspot wifi
- Environnement sur le PC de développement capable de communiquer via le réseau 
    - PC portable pour le concours de robotique
- Contrôle vrai robot
- Cartographie vrai robot
- Calibration vraie caméra
- Pour aller plus loin : Traitement de l'image vrai robot, suivi de ligne, Behavior Trees Demo

### Pour le déploiement de robots dans l'industrie

### Dev Container

[https://github.com/robot-mindset](https://github.com/robot-mindset)

#### Pour un développement local

- Installer Visual Studio Code
- Installer Docker avec le support de l'accélération graphique
- Installer l'extension `Dev Container`

#### Pour un développement sur un serveur/PC distant

- Installer le pack d'extensions `Remote Development`

Lancer le conteneur de développement :

- Optionnel : se connecter à la machine de développement distante depuis Visual Studio Code 
    - Ouvrir la Command Palette `Ctrl+Shift+P`
    - Lancer `Remote-SSH: Connect to host...`
    - Configurer la connexion ssh par mot-de-passe ou clé si ce n'a pas encore été fait
- Cloner le dépôt [https://github.com/rplayground/sandbox](https://github.com/rplayground/sandbox)
- Lancer `Dev Container: Reopen in Container`

[https://articulatedrobotics.xyz/tutorials/docker/dev-containers/](https://articulatedrobotics.xyz/tutorials/docker/dev-containers/)

Nav2, container, PWA [https://discourse.rRemote-SSH: Connect to host...os.org/t/mini-workshop-developing-and-teaching-ros-from-a-web-browser-using-dev-containers-and-pwas/31533](https://discourse.ros.org/t/mini-workshop-developing-and-teaching-ros-from-a-web-browser-using-dev-containers-and-pwas/31533) [https://discourse.ros.org/t/repeatable-reproducible-and-now-accessible-ros-development-via-dev-containers/31398](https://discourse.ros.org/t/repeatable-reproducible-and-now-accessible-ros-development-via-dev-containers/31398) [https://github.com/ros-navigation/docs.nav2.org/blob/master/development\_guides/devcontainer\_docs/devcontainer\_guide.md](https://github.com/ros-navigation/docs.nav2.org/blob/master/development_guides/devcontainer_docs/devcontainer_guide.md)

#### Remote-SSH sur machine distante via une machine intermédiaire

[https://stackoverflow.com/questions/59456119/ssh-session-within-ssh-session-vs-code](https://stackoverflow.com/questions/59456119/ssh-session-within-ssh-session-vs-code)

- On veut connecter Visual Studio Code à une machine `MyWorkstation` sur un réseau local via un serveur public `MyServer` qui est dans ce réseau local
- On ajoute la configuration suivante dans `/home/user/.ssh/config`

```
Host MyServer
    HostName adress.server
    User username

Host MyWorkstation
    HostName workstation.adress.within.network.of.the.server
    User usernameInWorkstation
    ProxyJump server.adress
```

### Docker Containers + VSCode

[https://github.com/gautz/unistra-aica-practical/tree/main/tmuxinator](https://github.com/gautz/unistra-aica-practical/tree/main/tmuxinator)

[https://github.com/ppswaroopa/ros2-dockergen](https://github.com/ppswaroopa/ros2-dockergen)

[https://github.com/robot-mindset](https://github.com/robot-mindset)

Quelques conseils de Ragesh ([https://robotair.io/](https://robotair.io/)) que j'ai rencontré au Fraunhofer :

[https://github.com/athackst/workstation\_setup](https://github.com/athackst/workstation_setup)

[https://docs.ros.org/en/iron/How-To-Guides/Setup-ROS-2-with-VSCode-and-Docker-Container.html](https://docs.ros.org/en/iron/How-To-Guides/Setup-ROS-2-with-VSCode-and-Docker-Container.html)

[https://www.allisonthackston.com/articles/vscode-docker-ros2.html](https://www.allisonthackston.com/articles/vscode-docker-ros2.html)

MoveIt2, docker [https://fr.slideshare.net/secret/vdPbBCNB3LamRy](https://fr.slideshare.net/secret/vdPbBCNB3LamRy) [https://moveit.picknik.ai/main/doc/how\_to\_guides/how\_to\_setup\_docker\_containers\_in\_ubuntu.html](https://moveit.picknik.ai/main/doc/how_to_guides/how_to_setup_docker_containers_in_ubuntu.html)

### Ansible

[https://github.com/robot-mindset](https://github.com/robot-mindset)

[https://www.linkedin.com/pulse/deploying-ros2-packages-using-ansible-ragesh-ramachandran/](https://www.linkedin.com/pulse/deploying-ros2-packages-using-ansible-ragesh-ramachandran/)

[https://blog.robotair.io/best-way-to-ship-your-ros-app-a53927186c35](https://blog.robotair.io/best-way-to-ship-your-ros-app-a53927186c35)

[https://github.com/swarmBots-ipa/ansible\_automation](https://github.com/swarmBots-ipa/ansible_automation)

[https://github.com/ipa-rar/ros2-playbooks](https://github.com/ipa-rar/ros2-playbooks)

[https://github.com/Laura7089/ros2-ansible](https://github.com/Laura7089/ros2-ansible)

[https://github.com/jeremyfix/ros2\_ansible\_turtlebot](https://github.com/jeremyfix/ros2_ansible_turtlebot)

[https://github.com/rarrais/ansible-role-ros2](https://github.com/rarrais/ansible-role-ros2)

### Multipass

[https://artivis.github.io/post/2023/multipass\_ros\_blueprint/](https://artivis.github.io/post/2023/multipass_ros_blueprint/)

### YOCTO

[https://www.yoctoproject.org/](https://www.yoctoproject.org/)

### JupyterLab

[https://blog.jupyter.org/jupyterlab-ros-3dc9dab7f421](https://blog.jupyter.org/jupyterlab-ros-3dc9dab7f421)

### Scripts bash, Cluster SSH

[https://github.com/robot-mindset](https://github.com/robot-mindset)

[https://github.com/ROS-French-Users-Group/ros2\_bash\_deployment\_scripts](https://github.com/ROS-French-Users-Group/ros2_bash_deployment_scripts)

[https://github.com/runtimerobotics/ros2\_oneline\_install](https://github.com/runtimerobotics/ros2_oneline_install)

Scripts de Loïc Cuvillon : [https://seafile.unistra.fr/d/50662484c5f641709cd7/](https://seafile.unistra.fr/d/50662484c5f641709cd7/)

Scripts Gauthier Hentz : [https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-installation-de-jazz](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-installation-de-jazz)

### Discussions

[https://discourse.ros.org/t/easy-way-to-distribute-an-instance-of-ubuntu-w-ros-to-students/31824/4](https://discourse.ros.org/t/easy-way-to-distribute-an-instance-of-ubuntu-w-ros-to-students/31824/4)

Singularity, Robolaunch, ROSblox [https://discourse.ros.org/t/what-environments-do-you-use-for-training-and-courses/26473/6](https://discourse.ros.org/t/what-environments-do-you-use-for-training-and-courses/26473/6)

Python [https://discourse.ros.org/t/teaching-with-ros-or-zeroros-at-university/32124](https://discourse.ros.org/t/teaching-with-ros-or-zeroros-at-university/32124)

### Sources

# Déploiement de TP de simulation avec Dev Container

On suppose qu'on veut déployer des TP qui font appel à des environnements de simulation, comme Gazebo ou URSim.

Pour faciliter le déploiement reproductible en général, et en particulier la réutilisation d'environnements de développement fournis par les développeurs, on utilise des conteneurs Docker. On a besoin d'accélération graphique via un GPU pour afficher ces simulations afin de ne pas surcharger le CPU.

### Installation de Docker

On peut faire tourner le conteneur Docker sur n'importe quel environnement : Linux, Windows, Mac, ou sur un serveur

#### Développement local sur Linux avec X11 et pas Wayland

- Installer par exemple Ubuntu 24 ou Linux Mint 22 Mate
- Vérifier que le système de fenêtrage est X11 et pas Wayland
- [Installer docker.io : le paquet debian de docker](https://doc.ubuntu-fr.org/docker#depots_apt_ubuntu)  
    `sudo apt install -y docker.io --install-recommends`
- <p class="callout danger">Ajouter votre user au groupe docker, ATTENTION ça lui donne les droits admin</p>
    
    `sudo usermod -aG docker $USER`
- Installer git  
    `sudo apt install git`

#### Développement local sur Windows avec X11 forwarding 

- Vérifier les prérequis à WSL2 de votre Windows
- Installer Docker Desktop
- Vérifier que Docker est configuré et fonctionne avec WSL2
- Installer une distribution Linux via WSL2, par exemple Ubuntu 24 depuis le Microsoft Store
- Lancer un Terminal Ubuntu sur WSL2 (taper `ubuntu` depuis le menu démarrer)
- Installer git  
    `sudo apt install git`

#### Développement sur serveur distant

- Installer une distribution Linux Server, par exemple Yunohost 12
- [Installer Docker en mode rootless](https://docs.docker.com/engine/security/rootless/)
- Créer un utilisateur YunoHost, lui donner un accès ssh et les droits appropriés (ne pas l'ajouter au groupe admin YunoHost)
- <p class="callout danger">NE PAS ajouter votre user au groupe docker, car ça lui donnerait des droits admin</p>
    
    <s>`sudo usermod -aG docker $USER`</s>
- Lancer les commandes `docker` avec `sudo`

### Avec PWA

<p class="callout info">Ici, on suppose qu'on ne fait pas tourner d'algorithmes qui ont besoin de GPU, type Machine Learning, dans le conteneur.</p>

Une première approche est de séparer la partie calcul CPU de la partie graphique GPU. On fait tourner les calculs dans le conteneur. On fait tourner les applications graphiques dans le navigateur Web de l'hôte via une PWA, par exemple via `gzweb` pour gazebo. Il nous faut alors un navigateur qui supporte l'accélération graphique des applications Web, seuls Chrome et dérivés supportent le WebGL :

- Installer Chrome sur Windows ou [Chromium sur Linux, de préférence depuis le PPA](https://doc.ubuntu-fr.org/chromium-browser#version_stable)
- Vérifier que WebGL est activé en vérifiant que le cube tourne sur [https://get.webgl.org/](https://get.webgl.org/)

<p class="callout success">L'énorme avantage est que l'environnement de développement Docker n'a pas besoin d'accélération graphique. Pas besoin de perdre du temps à essayer de passer la carte graphique au conteneur. Un serveur sans accélération graphique suffit.</p>

[https://discourse.ros.org/t/mini-workshop-developing-and-teaching-ros-from-a-web-browser-using-dev-containers-and-pwas/31533](https://discourse.ros.org/t/mini-workshop-developing-and-teaching-ros-from-a-web-browser-using-dev-containers-and-pwas/31533)

[https://github.com/rplayground/sandbox](https://github.com/rplayground/sandbox)

```bash
source /opt/ros/$ROS_DISTRO/setup.bash
source /usr/share/gazebo/setup.sh
GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(find /opt/ros/$ROS_DISTRO/share \
  -mindepth 1 -maxdepth 2 -type d -name "models" | paste -s -d: -)
ros2 launch ./launch/security_demo_launch.py \
  use_rviz:=False headless:=True
```

#### Pour un développement local

- Installer Visual Studio Code, [sur Linux depuis Snap ou le PPA Microsoft](https://doc.ubuntu-fr.org/visual_studio_code#installation_vscode) Noter que Codium sur Linux ne supporte par l'extension Dev Container nécessaire
- Désactiver la collecte des données : `Settings > Telemetry > Telemetry Level > off`
- Installer Docker <s>avec le support de l'accélération graphique</s>, cf. ci-dessus
- Installer l'extension `Dev Container`. Noter que les extensions nécessaires au développement de ROS seront installées dans le VSCode-Server du container
- Sur Windows : Lancer un Terminal Ubuntu sur WSL2 (taper ubuntu depuis le menu démarrer)
- Sur Linux : Lancer un Terminal
- Cloner le dépôt du Dev Container  
    `git clone https://github.com/rplayground/sandbox`
- Se placer dans le dossier  
    `cd ~/sandbox`
- Ouvrir le dossier dans Visual Studio Code  
    `code .`
- Lancer `Dev Container: Reopen in Container`

#### Pour un développement distant sur un serveur/PC

- Installer le pack d'extensions `Remote Development`
- Se connecter à la machine de développement distante depuis Visual Studio Code 
    - Ouvrir la Command Palette `Ctrl+Shift+P`
    - Lancer `Remote-SSH: Connect to host...`
    - Configurer la connexion ssh par mot-de-passe ou clé si ce n'a pas encore été fait
- Cloner le dépôt [https://github.com/rplayground/sandbox](https://github.com/rplayground/sandbox)
- Ouvrir le dossier sandbox
- Lancer `Dev Container: Reopen in Container`

#### Tester l'installation

- Le dépôt [https://github.com/rplayground/sandbox?tab=readme-ov-file#demo](https://github.com/rplayground/sandbox?tab=readme-ov-file#demo) fournit un environnement préconfiguré avec 
    - Les paquets Nav2
    - Les paquets turtlebot3\_simulations
    - Le serveur Gazebo et le client web gzweb
    - Des utilitaires pour le démarrage des interfaces graphiques dans le navigateur
- Ouvrir un nouveau Terminal dans VisualStudio Code
- Configurer le Bash et lancer la démo de sécurité :

```
source /opt/ros/$ROS_DISTRO/setup.bash
source /usr/share/gazebo/setup.sh
GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(find /opt/ros/$ROS_DISTRO/share \
  -mindepth 1 -maxdepth 2 -type d -name "models" | paste -s -d: -)
ros2 launch ./launch/security_demo_launch.py \
  use_rviz:=False headless:=True
```

- Depuis la palette de commandes `F1` , taper `Tasks: Run Task` et sélectionner `Start Visualizations`
- Depuis le panneau des Ports, cliquer `Open in Browser` pour le port `8080` et ouvrir le lien dans Chrome/Chromium

Il est possible de lancer d'autres environnements de simulation, par ex. turtlebot3\_simulations :

- On choisi le modèle de turtlebot3 et on lance gazebo en mode headless ```bash
    export ROS_DOMAIN_ID=30 #TURTLEBOT3
    export LDS_MODEL=LDS-01
    export TURTLEBOT3_MODEL=burger
    ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py \
      use_rviz:=False headless:=True
    ```

#### Comprendre les spécificités du container sandbox

- On remarque qu'on est connecté en `root` et que la sandbox est installée dans un workspace d'overlay  
    `root@iha-portrob-1:/opt/overlay_ws/src/sandbox#`
- Le fichier de configuration du bash `cat /root/.bashrc` n'a pas été modifié pour sourcer les exécutables ros
- La distribution ROS installée est  
    `echo $ROS_DISTRO `  
    `humble`
- A chaque réinitialisation du container et ouverture de nouveau Terminal il faut donc lancer :  
    ```
    source /opt/ros/$ROS_DISTRO/setup.bash
    source /usr/share/gazebo/setup.sh
    GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(find /opt/ros/$ROS_DISTRO/share \
      -mindepth 1 -maxdepth 2 -type d -name "models" | paste -s -d: -)
    ```
- Que nous dit `devcontainer.json`

```
{
    "name": "Sandbox",
    "image": "ghcr.io/rplayground/sandbox:main",
    // "build": {
    //     "dockerfile": "../Dockerfile",
    //     "context": "..",
    //     "target": "visualizer",
    //     "cacheFrom": "ghcr.io/rplayground/sandbox:main"
    // },
    "runArgs": [
        // "--cap-add=SYS_PTRACE", // enable debugging, e.g. gdb
        // "--ipc=host", // shared memory transport with host, e.g. rviz GUIs
        // "--network=host", // network access to host interfaces, e.g. eth0
        // "--pid=host", // DDS discovery with host, without --network=host
        // "--privileged", // device access to host peripherals, e.g. USB
        // "--security-opt=seccomp=unconfined", // enable debugging, e.g. gdb
    ],
    "workspaceFolder": "/opt/overlay_ws/src/sandbox",
    "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind",
    "onCreateCommand": ".devcontainer/on-create-command.sh",
    "updateContentCommand": ".devcontainer/update-content-command.sh",
    "postCreateCommand": ".devcontainer/post-create-command.sh",
    "customizations": {
        "codespaces": {
            "openFiles": [
                "README.md"
            ]
        },
        "vscode": {
            "settings": {},
            "extensions": [
                "eamodio.gitlens",
                "GitHub.copilot",
                "ms-iot.vscode-ros",
                "streetsidesoftware.code-spell-checker"
            ]
        }
    }
}

```

- Que nous dit `Dockerfile`

### Installation de Docker avec accélération graphique

<p class="callout info">Ici, on peut faire tourner dans le conteneur des algorithmes qui ont besoin de GPU, type Machine Learning.</p>

#### AMD/Intel sous Linux

#### NVidia Sous Linux

- [Installer le Driver propriétaire NVidia ](https://doc.ubuntu-fr.org/nvidia#via_les_depots_ubuntu)(si les driver proprio n'ont pas été autorisés à l'installation d'Ubuntu)
- `sudo apt install curl`
- [Installer le Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#with-apt-ubuntu-debian)

```
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \
    sudo apt-get update && sudo apt-get install nvidia-container-toolkit
```

- Redémarrer le PC
- Lancer docker avec l'argument `--gpus=all` pour tester qu'il a bien accès au GPU  
    `docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark`
- Le résultat suivant indique que la carte graphique dédiée `Nvidia Quadro P620` est bien exploitée pour les calculs :

```
> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
GPU Device 0: "Pascal" with compute capability 6.1

> Compute 6.1 CUDA device: [Quadro P620]
4096 bodies, total time for 10 iterations: 4.417 ms
= 37.987 billion interactions per second
= 759.750 single-precision GFLOP/s at 20 flops per interaction
```

- Si ça ne s'affiche pas : [https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker)

#### NVidia Sous Linux Public Server (rootless docker)

[https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#rootless-mode](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#rootless-mode)

#### NVidia Sous Windows

[https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-acc%C3%A9l%C3%A9ration-gpu-pou](https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-pc-ros2#bkmrk-acc%C3%A9l%C3%A9ration-gpu-pou)

#### Lancement Dev Container avec accélération graphique

- Ajouter dans `.devcontainer/devcontainer.json`

```
{
    "name": "Sandbox",
    "hostRequirements": {
        "gpu": "optional" // switch on CPU if no (NVidia?) GPU available
    },
    "runArgs": [
        "--gpus=all" // enable NVidia GPU with NVidia driver
        // "--device=/dev/dri" // enable Intel/AMD GPU
}
```

### Avec X11 Forwarding

On peut aussi afficher les fenêtres graphiques des applications qui tournent dans le Container directement sur l'hôte, par ex. `gazebo-client`

Pour cela il faut :

- Installer dans le conteneur le gestionnaire de fenêtres x11-apps (partie serveur)
- Avoir accès à un gestionnaire de fenêtres X11 sur l'hôte (partie client)
- Configurer correctement l'hôte et le Dev Container pour que le conteneur ait accès au client X11
- Cela peut poser des problèmes de sécurité car le conteneur risque d'avoir accès à tout ce qu'il se passe sur l'écran de l'hôte

<p class="callout warning">On ne peut plus se contenter d'une distribution Linux Serveur type YunoHost pour le développement distant</p>

Les calculs graphiques se font alors dans le container ??

### Avec VNC

### Ressources

[https://articulatedrobotics.xyz/tutorials/docker/dev-containers/](https://articulatedrobotics.xyz/tutorials/docker/dev-containers/)

Nav2, container, PWA [https://discourse.ros.org/t/repeatable-reproducible-and-now-accessible-ros-development-via-dev-containers/31398](https://discourse.ros.org/t/repeatable-reproducible-and-now-accessible-ros-development-via-dev-containers/31398) [https://github.com/ros-navigation/docs.nav2.org/blob/master/development\_guides/devcontainer\_docs/devcontainer\_guide.md](https://github.com/ros-navigation/docs.nav2.org/blob/master/development_guides/devcontainer_docs/devcontainer_guide.md)