Robotique Open Source

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC Attribution-Non Commercial-Share Alike 4.0 International Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International https://creativecommons.org/licenses/by-nc-sa/4.0/deed.fr

1 - ROS2 - Démarrage

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:

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

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 :

Installation de Ubuntu 22 :

sudo apt update
sudo apt upgrade

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

Docker dans une VM WSL2

Pour utiliser docker dans une VM WSL2, par exemple Ubuntu :

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

https://docs.docker.com/desktop/features/gpu/ 

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

 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 

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

Ubuntu 24 requiert une version de VirtualBox >7.1 https://www.virtualbox.org/ticket/21955 

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 

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

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.

image.png

image.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 :

image.png

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.

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

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 :

image.png

image.png

image.png

Windows 10/11

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

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 :

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

Installation de Jazzy pour la Navigation et Manipulation

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

## 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

  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, qui est une distribution en développement continu "rolling release". Par exemple en Avril 2023, l'API Python de MoveIt2 et son tutoriel 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 :

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://github.com/richlamdev/ansible-desktop-ubuntu

Outils utiles

Terminal multi-fenêtres Terminator

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 :

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

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)

sudo rm -rf /var/cache/snapd/

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

rm -fr ~/snap

# sudo apt-mark hold snapd
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

Configuration VirtualBox

Windows consomme à lui seul près de 4-8Go, Ubuntu >2Go et la compilation >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.

image.pngimage.png

image.png

image.png

image.png

image.png

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

Sources

-----

Auteur: Gauthier Hentz, sur le wiki de l'innovation de l'IUT de Haguenau

Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0)

1 - ROS2 - Démarrage

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. Le TurtleBot 3 est vendue par Robotis et peut être couplé à un bras manipulateur 5 axes OpenMANIPULATOR-X. Il est possible de simuler des applications de manipulation mobile avec Gazebo.

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

Supposons que vous avez installé et testé votre environnement comme celui de la VM.

Connexion à la VM

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

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 : 

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

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

Pour les tester il faut lancer :

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 Ctrl+C dans chaque Terminal pour arrêter les noeuds ("stop spinning").

-----

Auteur: Gauthier Hentz, sur le wiki de l'innovation de l'IUT de Haguenau

 Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) 

1 - ROS2 - Démarrage

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 rosindustrial for the password, and hit enter. The screen should look like the image below when you log in:

../../_images/ubuntu_desktop.png

There are several things you will notice on the desktop:

../../_images/ubuntu_desktop_details.png

  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.


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

Things to notice:

  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):

../../_images/ubuntu_inspect.png


Task 3: Start an Application & 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

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

  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.

Le Terminal Linux

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

Starting the Terminal

  1. Pour ouvrir le Terminal, recherchez le programme "terminator" ou cliquez sur l'icône:

    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 exit and hitting enter.

  5. The window will have a single line, which looks like this:

    ros-industrial@ros-i-humble-vm:~$

  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 exit or clicking on the red ‘x’ in the window’s titlebar.

Navigating Directories and Listing Files

Prepare your environment

  1. Open your home folder in the file browser.

  2. Double-click on the ex0.3 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:

    • cp -a ~/industrial_training/exercises/0.3/. .

ls Command

  1. Enter ls into the terminal.

    • You should see test.txt, and new listed. (If you don’t see ‘new’, go back and complete the previous exercise).

    • Directories, like new, are colored in blue.

    • The file sample_job is in green; this indicates it has its “execute” bit set, which means it can be executed as a command.

  2. Type ls *.txt. Only the file test.txt will be displayed.

  3. Enter ls -l into the terminal.

    • Adding the -l 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 d 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 ls -a in the terminal.

    • You will now see one additional file, which is hidden.

  5. Enter ls -a -l (or ls -al) in the command.

    • You’ll now see that the file hidden_link.txt points to .hidden_text_file.txt.

pwd and cd Commands

  1. Enter pwd into the terminal.

    • This will show you the full path of the directory you are working in.

  2. Enter cd new into the terminal.

    • The prompt should change to ros-industrial@ros-i-humble-vm:~/ex0.3/new$.

    • Typing pwd will show you now in the directory /home/ros-industrial/ex0.3/new.

  3. Enter cd .. into the terminal. * In the previous exercise, we noted that .. is the parent folder. * The prompt should therefore indicate that the current working directory is /home/ros-industrial/ex0.3.

  4. Enter cd /bin, followed by ls.

    • This folder contains a list of the most basic Linux commands.
      Note that pwd and ls are both in this folder.

  5. Enter cd ~/ex0.3 to return to our working directory.

    • Linux uses the ~ 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!

If you want a full list of options available for any of the commands given in this section, type man <command> (where <command> 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 q to exit.

Altering Files

mv Command

  1. Type mv test.txt test2.txt, followed by ls.

    • You will notice that the file has been renamed to test2.txt.
      This step shows how mv can rename files.

  2. Type mv test2.txt new, then ls.

    • The file will no longer be present in the folder.

  3. Type cd new, then ls.

    • You will see test2.txt in the folder.
      These steps show how mv can move files.

  4. Type mv test2.txt ../test.txt, then ls.

    • test2.txt will no longer be there.

  5. Type cd .., then ls.

    • You will notice that test.txt is present again.
      This shows how mv can move and rename files in one step.

cp Command

  1. Type cp test.txt new/test2.txt, then ls new.

    • You will see test2.txt is now in the new folder.

  2. Type cp test.txt "test copy.txt", then ls -l.

    • You will see that test.txt has been copied to test copy.txt.
      Note that the quotation marks are necessary when spaces or other special characters are included in the file name.

rm Command

  1. Type rm "test copy.txt", then ls -l.

    • You will notice that test copy.txt is no longer there.

mkdir Command

  1. Type mkdir new2, then ls.

    • You will see there is a new folder new2.

touch Command

  1. Type touch ~/Templates/"Untitled Document".

    • This will create a new Document named “Untitled Document”

You can use the -i flag with cp, mv, and rm commands to prompt you when a file will be overwritten or removed.

Editing Text (and Other GUI Commands)

  1. Type gedit test.txt.

    • You will notice that a new text editor window will open, and test.txt 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 gedit test.txt &.

      • The & character tells the terminal to run this command in “the background”, meaning the prompt will return immediately.

    2. Close the window, then type ls.

      • In addition to showing the files, the terminal will notify you that gedit has finished.

  4. Moving an already running program into the background:

    1. Type gedit test.txt.

      • 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 gedit has stopped, and a prompt will appear.

    3. Try to use the gedit window.

      • Because it is paused, the window will not run.

    4. Type bg in the terminal.

      • The gedit window can now run.

    5. Close the gedit window, and type ls in the terminal window.

      • As before, the terminal window will indicate that gedit is finished.

Running Commands as Root

  1. In a terminal, type ls -a /root.

    • The terminal will indicate that you cannot read the folder /root.

    • 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 sudo to the beginning of the command.

    • In this instance, type sudo ls -a /root instead.

    • The terminal will request your password (in this case, rosindustrial) in order to proceed.

    • Once you enter the password, you should see the contents of the /root directory.

Warning: sudo 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

1 - ROS2 - Démarrage

Usage avancé du bash Linux

Job management

Stopping Jobs

  1. Type ./sample_job.

    • The program will start running.

  2. Press Control+C.

    • The program should exit.

  3. Type ./sample_job sigterm.

    • The program will start running.

  4. Press Control+C.

    • This time the program will not die.

Stopping “Out of Control” Jobs

  1. Open a new terminal window.

  2. Type ps ax.

  3. Scroll up until you find python ./sample_job sigterm.

    • This is the job that is running in the first window.

    • The first field in the table is the ID of the process (use man ps to learn more about the other fields).

  4. Type ps ax | grep sample.

    • 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 kill <id>, where <id> is the job number you found with the ps ax.

  6. In the first window, type ./sample_job sigterm sigkill.

    • The program will start running.

  7. In the second window, type ps ax | grep sample to get the id of the process.

  8. Type kill <id>.

    • This time, the process will not die.

  9. Type kill -SIGKILL <id>.

    • This time the process will exit.

Showing Process and Memory usage

  1. In a terminal, type top.

    • 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.

1 - ROS2 - Démarrage

Déploiement de ROS2

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

On voit plusieurs approches :

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

Besoin pour la robotique industrielle

Par ordre croissant de complexité : 

Besoin pour la robotique mobile

Par ordre croissant de complexité :

Pour le déploiement de robots dans l'industrie

Dev Container

https://github.com/robot-mindset 

Pour un développement local

Pour un développement sur un serveur/PC distant

Lancer le conteneur de développement :

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/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 

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

https://stackoverflow.com/questions/59456119/ssh-session-within-ssh-session-vs-code 

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/ppswaroopa/ros2-dockergen 

https://github.com/robot-mindset 

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

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://www.allisonthackston.com/articles/vscode-docker-ros2.html

MoveIt2, docker https://fr.slideshare.net/secret/vdPbBCNB3LamRy  https://moveit.picknik.ai/main/doc/how_to_guides/how_to_setup_docker_containers_in_ubuntu.html 

Ansible

https://github.com/robot-mindset 

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://github.com/swarmBots-ipa/ansible_automation 

https://github.com/ipa-rar/ros2-playbooks 

https://github.com/Laura7089/ros2-ansible 

https://github.com/jeremyfix/ros2_ansible_turtlebot 

https://github.com/rarrais/ansible-role-ros2 

Multipass

https://artivis.github.io/post/2023/multipass_ros_blueprint/ 

YOCTO

https://www.yoctoproject.org/ 

JupyterLab

https://blog.jupyter.org/jupyterlab-ros-3dc9dab7f421 

Scripts bash, Cluster SSH

https://github.com/robot-mindset 

https://github.com/ROS-French-Users-Group/ros2_bash_deployment_scripts 

https://github.com/runtimerobotics/ros2_oneline_install 

Scripts de Loïc Cuvillon : 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 

Discussions

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 

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

Sources



1 - ROS2 - Démarrage

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

Développement local sur Windows avec X11 forwarding 

Développement sur serveur distant

Avec PWA

Ici, on suppose qu'on ne fait pas tourner d'algorithmes qui ont besoin de GPU, type Machine Learning, dans le conteneur.

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 :

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.

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 

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

Pour un développement distant sur un serveur/PC

Tester l'installation

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

Il est possible de lancer d'autres environnements de simulation, par ex. turtlebot3_simulations :

Comprendre les spécificités du container sandbox

{
    "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"
            ]
        }
    }
}

Installation de Docker avec accélération graphique

Ici, on peut faire tourner dans le conteneur des algorithmes qui ont besoin de GPU, type Machine Learning.

AMD/Intel sous Linux

NVidia Sous Linux

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
> 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

NVidia Sous Linux Public Server (rootless docker)

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 

Lancement Dev Container avec accélération graphique

{
    "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 :

On ne peut plus se contenter d'une distribution Linux Serveur type YunoHost pour le développement distant

Les calculs graphiques se font alors dans le container ??

Avec VNC


Ressources

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://github.com/ros-navigation/docs.nav2.org/blob/master/development_guides/devcontainer_docs/devcontainer_guide.md 

2 - ROS2 - Robotique mobile

2 - ROS2 - Robotique mobile

Turtlesim et modèle de Dubins

https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html

2 - ROS2 - Robotique mobile

TurtleBot3 - Bases en Simulation

Astuces

Gazebo

Le robot ne spawn pas

On a remarqué que parfois certains processus de gazebo continuent à tourner ou sont redémarrés malgré l'arrêt du noeud ROS principal. Il faut alors tuer le processus avecla commande kill 1234, voir commandes utiles ci-dessous.

Commandes utiles

Ressources

2 - ROS2 - Robotique mobile

TurtleBot3 - Piloter le Robot

https://emanual.robotis.com/docs/en/platform/turtlebot3/navigation/#navigation

 

Les 2 ordinateurs dans le FabLab sur le mur de gauche sont installés sous Ubuntu 22.04 avec ROS2 Humble et les paquets nécessaires au pilotage des TurtleBot3. Il faut utiliser le compte étudiant (et non le compte fablab qui se login automatiquement au démarrage) avec le même mdp que celui utilisé en TP. 

Vous pouvez emprunter un des 2 TurtleBot quand vous voulez en demandant à M. Carron ou M. Hentz dans le bureau en face :
- TurtleBot3 Burger
- TurtleBot3 Waffle + OpenManipulator X
Pensez bien à les recharger pour les suivants.

Un réseau Wifi fab-lab-5g est disponible et les TurtleBot configurés pour s'y connecter. Attention ce réseau est limité à 20Go de données, donc ne pas l'utiliser pour autre-chose que la robotique. Les PC doivent être connectés sur le même réseau que les TurtleBot. Vous devez ensuite vous connecter au Robot via ssh pour démarrer le noeud ROS2 côté robot :

ssh ubuntu@192.168.3.10 (burger) ou ssh ubuntu@192.168.3.11 (waffle) avec le même mdp qu'en TP.

Les autres noeuds sont lancés sur le PC : télémanipulation, cartographie, navigation autonome, planification de trajectoire avec évitement d'obstacle etc.

2 - ROS2 - Robotique mobile

Calibration de la caméra

https://docs.nav2.org/tutorials/docs/camera_calibration.html

image.png

Ressources

2 - ROS2 - Robotique mobile

Suivi de ligne ROS2 Humble

Le suivi de ligne repose surtout sur du traitement de l'image avec OpenCV, et l'envoi de commandes de vitesse au robot. Le code sous ROS1 devrait donc être portable assez directement sous ROS2.

Environnement de simulation Gazebo

Modélisation

Créer un paquet

Ressources

Pour le suivi d'une ligne blanche :

2 - ROS2 - Robotique mobile

Behavior Trees Demo

Concepts

https://docs.nav2.org/concepts/index.html#behavior-trees 

https://docs.nav2.org/behavior_trees/overview/nav2_specific_nodes.html 

https://docs.nav2.org/behavior_trees/overview/detailed_behavior_tree_walkthrough.html 

Démo avec le Turtlebot3

https://github.com/sea-bass/turtlebot3_behavior_demos

Usage sans docker

On lance l'environnement de simulation lié à la démo de Behavior Tree :

Démos de Behavior Trees en Python

On regarde le fichier turtlebot3_behavior_demos/docker-compose.yaml pour déterminer les commandes Bash correspondant aux commande docker indiquées dans le dépôt.

Dans un second terminal, on lance une des démos suivantes :

Les fichiers source de la démo sont : 

2 - ROS2 - Robotique mobile

Installation et démarrage du Turtlebot 3

Remarques sur les architectures ROS pour un robot mobile

L'architecture utilisée par Robotis pour son Turtlebot3, qui est également plébiscitée par la communauté de robotique mobile ROS Navigation 2, repose sur un PC embarqué (ARM64, Raspberry 4) sur le robot pour les calculs temps réel, et un PC de calcul et développement logiciel (AMD64, PC portable ou fixe) pour les calculs lourds et ayant une moindre contrainte temporelle. Les deux PC communiquent via un réseau wifi. On installe typiquement Ubuntu Server (sans interface graphique donc plus léger) sur la Raspberry et Ubuntu Desktop sur le PC.

Avec l'utilisation d'une Raspberry >=4, les problèmes de ressources sont moins importants et on peut envisager d'installer un environnement de bureau (interface graphique) et faire les calculs lourds sur la Raspberry. Dans cette architecture, on peut envisager de se connecter à l'environnement de bureau de la Raspberry depuis un PC (Linux ou Windows) via le wifi et VNC.

Il est déconseillé d'utiliser les applications graphiques de ROS comme RViz et Gazebo sur architecture ARM64. Par exemple, Gazebo 11 n'est pas disponible sur ARM64 sous ROS Humble. Il l'est depuis peu sous Jazzy.

Préconisation

Nous préconisons l'architecture suivante pour les TP et projets : 

Pour simplifier l'expérience utilisateur :

Installation Ubuntu Server

Configuration clavier en Français

Version rapide

sudo umount /media/user/writable /media/user/system-boot

Attention, bien vérifier le disque associé à la carte SD avant de lancer la commande dd. Sinon on risque d'écraser le disque dur. En général disque dur = /dev/sda et carte SD = /dev/sdb

sudo gunzip -c ~/turtlebot3-manipulator-humble.img.gz | sudo dd of=/dev/sdb status=progress
            addresses: [IP_TURTLEBOT/24]
            gateway4: IP_BOX
            nameservers:
                addresses: [DNS_BOX_OPERATEUR, 9.9.9.9, 89.234.141.66]
            access-points:
                "SSID_WIFI":
                    password: PASSWORD_WIFI

Remarque : l'image a été créée après avoir suivi les instructions longues ci-dessous (et quelques workspace et package ros installés en plus) en lançant la commande suivante :

sudo dd if=/dev/sda status=progress | gzip -9 > ~/turtlebot3-manipulator-humble.img.gz

Reinitialiser le mot-de-passe

Voir la section 4 ici

Installation d'un environnement graphique

Pour installer un environnement graphique sur la Raspberry Pi 4 préalablement installée en Ubuntu server. On choisit Mate qui est léger et assez moderne à la fois : 

cf. https://phoenixnap.com/kb/how-to-install-a-gui-on-ubuntu#ftoc-heading-4 

Version longue

https://emanual.robotis.com/docs/en/platform/turtlebot3/sbc_setup/#sbc-setup 

Depuis un ordinateur sous Ubuntu 22.04

Depuis une VM WSL Ubuntu 22

A faire

Configuration réseau

Configurer la connexion automatique au réseau wifi et donner une IP fixe au robot (dans la plage DHCP autorisée par le routeur)  :

network:
    renderer: networkd
    ethernets:
        eth0:
            dhcp4: true
            dhcp6: true
            optional: true
    wifis:
        wlan0:
            dhcp4: false
            dhcp6: false
            addresses: [192.168.100.40/24]
            gateway4: 192.168.100.1
            nameservers:
                addresses: [192.168.100.1, 9.9.9.9, 89.234.141.66]
            access-points:
                fablab:
                    password: ...
    version: 2
network: {config: disabled}

Connexion au robot en ssh

Insérer la carte dans le robot, le démarrer assez proche du hotspot wifi configuré, se connecter en ssh depuis l'ordinateur :

Installation de ROS embarqué

Installer ROS 2 Humble sans interfaces graphiques (ros-humble-desktop) qui seront lancées sur l'ordinateur externe :

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-ros-base ros-dev-tools
source /opt/ros/humble/setup.bash
echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc

Installer le workspace du turtlebot et les dépendances :

sudo apt install python3-argcomplete python3-colcon-common-extensions libboost-system-dev build-essential
sudo apt install ros-humble-hls-lfcd-lds-driver
sudo apt install ros-humble-turtlebot3-msgs
sudo apt install ros-humble-dynamixel-sdk
sudo apt install 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 ros2-devel https://github.com/ROBOTIS-GIT/ld08_driver.git
cd ~/turtlebot3_ws/src/turtlebot3
rm -r turtlebot3_cartographer turtlebot3_navigation2
cd ~/turtlebot3_ws/
echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
source ~/.bashrc
colcon build --symlink-install --parallel-workers 1
echo 'source ~/turtlebot3_ws/install/setup.bash' >> ~/.bashrc
source ~/.bashrc

Configurer le Port USB pour OpenCR :

sudo cp `ros2 pkg prefix turtlebot3_bringup`/share/turtlebot3_bringup/script/99-turtlebot3-cdc.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger

ID de domain ROS pour la communication DDS :

echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
source ~/.bashrc

Configurer le modèle du LIDAR : 

echo 'export LDS_MODEL=LDS-02' >> ~/.bashrc
source ~/.bashrc

Raspberry Pi 5 - Ubuntu Noble 24.04 - ROS2 Jazzy

ROS2 Jazzy est la nouvelle version LTS. Elle est installable sur Raspberry Pi 5. 

Pour installer ROS2 Humble sur Ubuntu 24.04 il faut compiler depuis les sources : 

sudo apt install -y git colcon python3-rosdep2 vcstool wget python3-flake8-docstrings python3-pip python3-pytest-cov python3-flake8-blind-except python3-flake8-builtins python3-flake8-class-newline python3-flake8-comprehensions python3-flake8-deprecated python3-flake8-import-order python3-flake8-quotes python3-pytest-repeat python3-pytest-rerunfailures python3-vcstools libx11-dev libxrandr-dev libasio-dev libtinyxml2-dev

mkdir -p ~/ros2_iron/src

cd ~/ros2_iron

vcs import --input https://raw.githubusercontent.com/ros2/ros2/iron/ros2.repos src

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

sudo apt upgrade

sudo rosdep init

rosdep update

rosdep install --from-paths src --ignore-src --rosdistro iron -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers python3-vcstool"

colcon build --symlink-install

cf. https://forums.raspberrypi.com/viewtopic.php?t=361746 

3 - ROS2 - Manipulation Mobile

3 - ROS2 - Manipulation Mobile

Assemblage du Turtlebot et OpenManipulator-X et configuration initiale

https://www.classes.cs.uchicago.edu/archive/2022/fall/20600-1/turtlebot_assembly_setup.html

A Word of Caution


This page is NOT intended for student use. This page is designed for course staff to build and maintaing the turtlebots. If you are a student, please ensure you have permission from course staff before making any of the changes detailed on this page to any of the turtlebots.


Setup Checklist



Turtlebot Assembly Tips


Turtlebot3


OpenMANIPULATOR Arm



OpenMANIPULATOR Arm First-Time Configuration


After assembling an OpenMANIPULATOR arm, its servos must first be configured properly before it can be used. By default, all the arm motors are set to the same ID (1) and the wrong baud rate, which causes collisions when trying to detect them.

  1. Connect a SINGLE motor (no daisy-chains in the arm) to the OpenCR module and DISCONNECT ALL OTHER MOTORS (the wheel motors!!)
  2. Open up Dynamixel Wizard 2.0 and update the firmware for that motor by following this tutorial. The arm Dynamixel model is XM430-W350, and the wheel motors are XM430-W210.
  3. Scan for connected Dynamixels using the “Scan” button on the top menu. If the scan does not turn up any results, you may need to change the scan options in the "Options" menu. By default, an unconfigured arm motor will have ID 1, be on Protocol 2.0, and have a baud rate of 57600 bps.
  4. Change the ID for the detected motor from 1 to 11/12/13/14/15 (whichever you're doing the procedure for). Click on the “ID” item, and find the ID # you want in the lower right corner. Click it and press “Save”.
  5. Change the baud rate to 1M (if not already 1M). Click on the “Baud Rate (Bus)” item, and find the 1 Mbps option. Click it and press “Save”.
  6. Disconnect the motor (both in the wizard by clicking “Disconnect” up top and physically disconnecting from the board) and repeat the steps for the remaining ones.


Attaching/Detaching the OpenMANIPULATOR Arm


Physical Attachment/Detachment


Follow these steps below:

  1. The arm can be attached and detached by first removing the top layer of the the Turtlebot. There are 10 screws around the perimeter of the top layer that you will need to remove with a Phillips head / cross screwdriver.
  2. Once the top layer of the Turtlebot is loose, disconnect the cable that is attached to the LiDAR. This cable is multi-colored with several pins.
    Note: ONLY remove this LiDAR cable in this step.

    Turtlebot3 with an arm.

    Once the top layer is fully disconnected, flip the top layer upside-down for easy access.
  3. To connect the arm, there are four screws that you will need to insert through the bottom side of the top layer that connect to Dynamixel #11. The exact location of the screws are marked in the picture below. Use an hex/allen key to secure them.

    Turtlebot3 with an arm.

  4. Once the arm is securely attached, thread the cable connected to DynaMIXEL #11 through the top layer (if not already threaded) and attach the other end to the remaining 3-pin slot on the OpenCR board. It should be the open slot adjacent to the already occupied slots.
  5. Reconnect the LiDAR cable and re-screw the top layer onto the robot.

To disconnect the arm, follow the same steps as above, but remove the four screws instead and disconnect the DynaMIXEL.

Updating Firmware and Files


Every time the arm is attached or detached, you will need to reconfigure environment variables and update the OpenCR firmware.

If you are attaching the arm, set the environment variable OPENCR_MODEL=om_with_tb3 and ensure that OPENCR_PORT=/dev/ttyACM0 in the ~/.bashrc file.

Note: You can also set those environment variables in the command line by running:
$ export OPENCR_PORT=/dev/ttyACM0
$ export OPENCR_MODEL=om_with_tb3

Source the file and update the firmware with:

$ source ~/.bashrc
$ cd ~/opencr_update && ./update.sh $OPENCR_PORT $OPENCR_MODEL.opencr


If you are detaching the arm, set the environment variable OPENCR_MODEL=waffle and ensure that OPENCR_PORT=/dev/ttyACM0 in the ~/.bashrc file.

Enter the OpenCR board into firmware recovery mode by pressing and holding SW2, and simultaneously pressing RESET (you will need to remove the top layer of the turtlebot in order to access those OpenCR buttons). If you want to read more about the OpenCR bootloader, please refer to this page in the OpenCR 1.0 manual.


buttons on OpenCR

Source the file and update the firmware with:

$ source ~/.bashrc
$ cd ~/opencr_update && ./update.sh $OPENCR_PORT $OPENCR_MODEL.opencr


Common Errors During Setup


Firmware Recovery Mode and Device Firmware Update for OpenCR Board


We found the firmware recovery mode not clearly detailed in the Turtlebot3 manual. Here are the steps for firmware recovery:

  1. Push and hold SW2
  2. Press RESET
  3. Release SW2
  4. Arduino code should upload successfully with jump_with_fw

Firmware recovery is different from device firmware update (DFU), where the steps are:

  1. Push and hold BOOT
  2. Press RESET
  3. Release BOOT

Troubleshooting /dev/ttyACM0 Connection Issues


If the /dev/ttyACM0 port isn't found or running bringup on the Pi is hanging:

If the hydro rosserial / groovy Arduino error appears:

3 - ROS2 - Manipulation Mobile

Installation et démarrage du OpenManipulator-X & Turtlebot 3

Suivre d'abord https://innovation.iha.unistra.fr/books/robotique-open-source/page/installation-et-demarrage-du-turtlebot-3 

Montage et Configuration des Dynamixels

https://www.classes.cs.uchicago.edu/archive/2022/fall/20600-1/turtlebot_assembly_setup.html

Pour l'Open-Manipulator

Configurer les dynamixel (baud et ID 11 à 15) https://www.classes.cs.uchicago.edu/archive/2022/fall/20600-1/turtlebot_assembly_setup.html#arm-first-time :

Pour le Turtlebot

Via Arduino IDE ou DynamixelWizard en s'inspirant de : https://emanual.robotis.com/docs/en/platform/turtlebot3/faq/#setup-dynamixels-for-turtlebot3

Test depuis un PC sans la raspberry

Téléopération du OpenManipulator-X seul

Suivre le tutoriel Foxy en remplaçant foxy par humble et foxy-devel par ros2 en utilisant l'interface de communication OpenCR : https://emanual.robotis.com/docs/en/platform/openmanipulator_x/quick_start_guide/

Pour tester le bon fonctionnement du bras et de sa pince, on connecte la carte OpenCR directement à un PC ayant ROS Humble préinstallé :

sudo apt install ros-humble-rqt* ros-humble-joint-state-publisher
mkdir -p ~/openmanipulator_ws/src/
cd ~/openmanipulator_ws/src/
git clone -b ros2 https://github.com/ROBOTIS-GIT/DynamixelSDK.git
git clone -b ros2 https://github.com/ROBOTIS-GIT/dynamixel-workbench.git
git clone -b ros2 https://github.com/ROBOTIS-GIT/open_manipulator.git
git clone -b ros2 https://github.com/ROBOTIS-GIT/open_manipulator_msgs.git
git clone -b ros2 https://github.com/ROBOTIS-GIT/open_manipulator_dependencies.git
git clone -b ros2 https://github.com/ROBOTIS-GIT/robotis_manipulator.git
cd ~/openmanipulator_ws && colcon build --symlink-install

image.png

Programmation hors-ligne du OpenManipulator-X et TurtleBot3 depuis MoveIt

On suit le tutoriel https://emanual.robotis.com/docs/en/platform/turtlebot3/manipulation/#operate-the-actual-openmanipulator en installant tout ce qui est censé être installé sur le raspberry [SBC]/[TurtleBot3] sur le PC [Remote PC].

sudo apt install ros-humble-dynamixel-sdk ros-humble-ros2-control ros-humble-ros2-controllers ros-humble-gripper-controllers ros-humble-moveit
cd ~/turtlebot3_ws/src/
git clone -b humble-devel https://github.com/ROBOTIS-GIT/turtlebot3_manipulation.git
cd ~/turtlebot3_ws && colcon build --symlink-install
export ROS_DOMAIN_ID=30 #TURTLEBOT3
export LDS_MODEL=LDS-02
export TURTLEBOT3_MODEL=waffle_pi
export OPENCR_PORT=/dev/ttyACM0
export OPENCR_MODEL=turtlebot3_manipulation
rm -rf ./opencr_update.tar.bz2
wget https://github.com/ROBOTIS-GIT/OpenCR-Binaries/raw/master/turtlebot3/ROS2/latest/opencr_update.tar.bz2
tar -xvf opencr_update.tar.bz2
cd ./opencr_update
./update.sh $OPENCR_PORT $OPENCR_MODEL.opencr

Configuration OpenCR

Pour le Turtlebot : https://emanual.robotis.com/docs/en/platform/turtlebot3/opencr_setup/#opencr-setup

Pour l'OpenManipulator-X : https://emanual.robotis.com/docs/en/platform/turtlebot3/manipulation/#opencr-setup

Dépendances manquantes :

sudo apt install ros-humble-hardware-interface
ros-humble-ros2-control ?
ros-humble-joint-state-publisher ?

Dépendances manquantes côté Raspberry : 

sudo apt install rros-humble-gripper-controllers ros-humble-xacro

Dépendances manquantes côté PC : 

sudo apt install ros-humble-moveit-servo

Issues :

https://forum.robotis.com/t/ros-2-foxy-openxmanuipaltor-bringup-issues/2142/9

https://github.com/ROBOTIS-GIT/open_manipulator/issues/212

https://github.com/ROBOTIS-GIT/open_manipulator/issues/209

https://www.classes.cs.uchicago.edu/archive/2022/fall/20600-1/turtlebot_assembly_setup.html#arm-first-time

-----

Auteur: Gauthier Hentz, sur le wiki de l'innovation de l'IUT de Haguenau

 Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) 

4 - ROS2 - Manipulation Cobot

4 - ROS2 - Manipulation Cobot

Universal Robot ROS2 Driver

Le Driver ROS2 pour les cobots Universal Robot a été développé en collaboration entre Universal Robots, le Forschungszentrum für Informatik (INRIA allemand) et PickNik Robotics. Plus précisément par nos voisins de Karlsruhe, en particulier Felix Exner (https://github.com/fmauch)). Le FZI est également à l'origine d'une proposition d'interface ROS standard pour les trajectoires Cartésiennes, qui est désormais implémentée dans les contrôleurs ROS Cartésiens d'Universal Robots. La proposition repose sur un état de l'art très intéressant des interfaces de programmation des marques de robot majeures.

Installation des paquets UR pour ROS2

sudo apt install ros-humble-ur
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
sudo apt update
sudo apt dist-upgrade

Installation du simulateur hors-ligne URSim

https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver#getting-started

https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver#install-from-binary-packages

Le moyen le plus simple de découvrir et commencer à utiliser un robot UR avec ROS2 est d'utiliser la simulation de la console de programmation (teach panel) de son contrôleur. URSim est le simulateur hors-ligne de Universal Robots. Il permet de reproduire le comportement réel d'un robot quasiment à l'identique en se connectant à son adresse IP. Il est possible d'installer URSim 5 sur un Ubuntu <18 (non inclus!) ou dans une machine virtuelle (VirtualBox). Il faut se créer un compte pour télécharger le fichier URSim 5.13. Ubuntu 18 n'est plus supporté, et MoveIt2 tourne sur Ubuntu 22.

Sur Ubuntu 22

En attendant la sortie de URSim/Polyscope 6, la manière la plus simple d'installer URSim 5 sur Ubuntu 22 est via conteneur Docker créé par UR Lab (pas maintenu officiellement).

Installer Docker

Depuis les dépôts officiels Ubuntu :

sudo apt update
sudo apt install docker-compose

Ajouter votre utilisateur au groupe docker afin de manipuler les containers sans avoir à utiliser sudo systématiquement :

sudo usermod -aG docker $USER

Fermer et rouvrir la session. Tester la bonne installation :

sudo service docker start
docker run hello-world

Installer le conteneur URSim

On suit le tutoriel fourni dans la documentation du driver UR ROS. Il existe une image docker fournie sur hub.docker.com, c'est très simple :

docker pull universalrobots/ursim_e-series
ros2 run ur_robot_driver start_ursim.sh -m <ur_type>

Sur Windows 10/11

Pour les systèmes non-Linux, UR fournit une VM LUbuntu 14.04 qui peut tourner sous VirtualBox (gratuit) ou sur VMware (gratuit pour usage non commercial).

Installer VirtualBox

Télécharger et configurer la Machine Virtuelle

Ajouter l'URCap External Control

Configurer le réseau pour que les VMs communiquent

Démarrage et configuration URSim

image.png

Programmation hors-ligne avec URSim et MoveIt2/RViz

sudo apt install python3-rosdep
sudo rosdep init
rosdep update
sudo apt update
sudo apt dist-upgrade
sudo apt install python3-colcon-common-extensions
sudo apt install python3-colcon-mixin
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default

NOTES IMPORTANTES

sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y --os=ubuntu:jammy
colcon build --mixin release --parallel-workers 1

Déploiement du code source des Tutoriels de MoveIt

mkdir -p ~/ws_moveit2/src
cd ~/ws_moveit2/src
git clone https://github.com/ros-planning/moveit2_tutorials -b humble --depth 1

Optionnel : Installation d'un environnement de développement MoveIt2 avec les dernières améliorations et résolutions de bug

Installation de MoveIt2 Humble sur Ubuntu 22.04 :

sudo apt install python3-vcstool
cd ~/ws_moveit2/src
vcs import < moveit2_tutorials/moveit2_tutorials.repos

Note : si `vcs import` vous demande vos identifiants GitHub, tapez Entrer jusqu'à ce que ça continue. Pas besoin d'identifiant pour récupérer un dépôt GitHub public.

Installation des dépendances et compilation

sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ~/ws_moveit2
colcon build --mixin release
cd ~/ws_moveit2
source ~/ws_moveit2/install/setup.bash
echo 'source ~/ws_moveit2/install/setup.bash' >> ~/.bashrc

Tester la communication entre ROS et URSim

https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/usage.html#usage-with-official-ur-simulator

ros2 run ur_robot_driver start_ursim.sh -m ur5e
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=192.168.56.101

https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/usage.html#example-commands-for-testing-the-driver

Envoyer des commandes au contrôleur

Avant d'envoyer des commandes, vérifier l'état des contrôleurs en utilisant ros2 control list_controllers

-----

Auteur: Gauthier Hentz, sur le wiki de l'innovation de l'IUT de Haguenau

 Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) 


4 - ROS2 - Manipulation Cobot

Commander un robot UR avec le driver ROS2

Installation d'Ubuntu avec des capacités temps-réel

Pour un usage basique, un Ubuntu (ou Linux Mint) classique permet de piloter le robot : 

Pour éviter des instabilités il est conseillé d'installer un noyau Linux avec des capacités temps-réel (PREEMPT_RT kernel). En particulier avec un robot de la Série-E, la fréquence de contrôle plus élevée peut entraîner des trajectoires non fluides sans noyau temps-réel.

mkdir -p ~/rt_kernel_build
cd ~/rt_kernel_build
tar xf linux-4.14.139.tar
cd linux-4.14.139
xzcat ../patch-4.14.139-rt66.patch.xz | patch -p1
make oldconfig

Récupérer les sources du noyau temps-réel

wget https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/patch-5.15.107-rt62.patch.xz
wget https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/patch-5.15.107-rt62.patch.sign
wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.15.107.tar.xz
wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.15.107.tar.sign
xz -dk patch-5.15.107-rt62.patch.xz
xz -d linux-5.15.107.tar.xz
gpg2 --locate-keys torvalds@kernel.org gregkh@kernel.org
gpg2 --keyserver hkp://keys.gnupg.net --search-keys salisbury
gpg2 --verify linux-5.15.107.tar.sign

gpg: Good signature from "Greg Kroah-Hartman <gregkh@kernel.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.

gpg2 --verify patch-5.15.107-rt62.patch.sign

gpg: Good signature from "Tom Zanussi <tom.zanussi@linux.intel.com>" [unknown]
gpg:                 aka "Tom Zanussi <zanussi@kernel.org>" [unknown]
gpg:                 aka "Tom Zanussi <tzanussi@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.

Compiler le noyau temps réel

tar xf linux-5.15.107.tar
cd linux-5.15.107
xzcat ../patch-5.15.107-rt62.patch.xz | patch -p1
make oldconfig

Preemption Model
  1. No Forced Preemption (Server) (PREEMPT_NONE)
> 2. Voluntary Kernel Preemption (Desktop) (PREEMPT_VOLUNTARY)
  3. Preemptible Kernel (Low-Latency Desktop) (PREEMPT)
  4. Fully Preemptible Kernel (RT) (PREEMPT_RT_FULL) (NEW)
choice[1-4]: 4

make -j `getconf _NPROCESSORS_ONLN` deb-pkg
sudo apt install ../linux-headers-5.15.107-rt62_*.deb ../linux-image-5.15.107-rt62_*.deb

Définir les permissions utilisateur pour exécuter des tâches temps-réel

sudo groupadd realtime
sudo usermod -aG realtime $(whoami)
@realtime soft rtprio 99
@realtime soft priority 99
@realtime soft memlock 102400
@realtime hard rtprio 99
@realtime hard priority 99
@realtime hard memlock 102400

Note: Pour que ces changements soient pris en compte il faut se déconnecter et se reconncter. On redémarrera plus tard.

https://github.com/HowardWhile/Ubunutu22.04-RT-Kernel

Configurer GRUB pour toujours booter le noyau temps-réel

awk -F\' '/menuentry |submenu / {print $1 $2}' /boot/grub/grub.cfg
menuentry Ubuntu
submenu Advanced options for Ubuntu

    menuentry Ubuntu, with Linux 5.15.107-rt62
    menuentry Ubuntu, with Linux 5.15.107-rt62 (recovery mode)
sudo sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.15.107-rt62"/' /etc/default/grub
$ sudo update-grub

Vérification de la capacité de préemption temps-réel

uname -v | cut -d" " -f1-4

#1 SMP PREEMPT RT

Optionnel : Désactiver le CPU speed scaling

Les threads planifiés en temps-réel s'exécutent sans problème. Cependant, des composants externes tels que les systèmes de visual servoing, non planifiés pour le temps réel peuvent être interrompus par les fonctionnalités d'économie d'énergie des processeurs récents qui changent leur fréquence d'horloge de manière dynamique.

sudo apt install cpufrequtils
cpufreq-info

current CPU frequency is XXX MhZ

sudo systemctl disable ondemand
sudo systemctl enable cpufrequtils
sudo sh -c 'echo "GOVERNOR=performance" > /etc/default/cpufrequtils'
sudo systemctl daemon-reload && sudo systemctl restart cpufrequtils

Configuration du robot UR

https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/installation/robot_setup.html

Récupération de la calibration usine

Les robots sont calibrés en usine. Pour que les calculs cinématiques effectués dans ROS soient exacts, il faut récupérer les données de calibration. Sinon la précision des trajectoires envoyées depuis ROS et exécutées sur le robot risquent d'être de l'ordre du centimètre (au lieu du dixième de millimètre en temps normal).

https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/installation/robot_setup.html#extract-calibration-information

-----

Auteur: Gauthier Hentz, sur le wiki de l'innovation de l'IUT de Haguenau

 Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) 

4 - ROS2 - Manipulation Cobot

Programmer un robot avec MoveIt2 - Jumeau Numérique

Prérequis : être arrivé au bout du tutoriel sur le Driver UR ROS2

Comment fonctionne la manipulation avec MoveIt ?

MoveIt2 est la plateforme de manipulation robotique pour ROS2. Il implémente un nombre important des dernières innovations en termes de :

https://moveit.picknik.ai/humble/doc/concepts/concepts.html 

Premiers pas avec MoveIt dans RViz

Pour débuter avec MoveIt, on peut utiliser ses fonctionnalités de planification de trajectoire via le plugin MoveIt Display du logiciel de visualisation 3D de ROS RViz. C'est un outils très puissant pour débuguer des applications robotiques ROS. On verra que RViz est alors un jumeau numérique du vrai robot.

Les tutoriels pour débuter et approfondir ses compétences avec MoveIt sont en Anglais et fonctionnent avec le robot Panda de Franka Emika.

Nous reprenons ici le tutoriel pour débuter avec MoveIt, et l'appliquons à un UR5e avec le driver UR ROS2.

Avec un hardware simulé par ROS

Faire tourner le driver UR ROS2 :

  1. Jusqu'à ROS2 Humble
    ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=yyy.yyy.yyy.yyy fake_hardware:=true launch_rviz:=false
  2. A partir de ROS2 Jazzy
    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

Avec la simulation URSim

Voir https://innovation.iha.unistra.fr/books/robotique-open-source/page/universal-robot-ros2-driver#bkmrk-installation-du-simu 

Sous Ubuntu 22 - docker

ros2 run ur_robot_driver start_ursim.sh -m ur5e
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=192.168.56.101 launch_rviz:=false

Sous Windows - VirtualBox

Avec le vrai robot

ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=192.168.0.10 launch_rviz:=false

Lancer MoveIt et RViz

ros2 launch ur_moveit_config ur_moveit.launch.py ur_type:=ur5e launch_rviz:=true

https://ur-documentation.readthedocs.io/en/latest/index.html ?

Déplacer le Robot avec le Plugin MoveIt dans RViz

Résultat

ros2_moveit2_ros2control_commande_externet_UR5e.mp4

Planification de trajectoire avec OMPL

Ajouter un obstacle

ros2_moveit2_OMPL_RRTconnect_evitement_collision_automatique

Tester différents algorithmes d'OMPL

ros2_moveit2_OMPL_RRTstar_evitement_collision_longueur_optimisee

Résultat

En optimisant la trajectoire avec RRTstar, on obtient un mouvement fluide, qui évite les collision avec l'environnement et de longueur minimisée. Voir la vidéo réalisée en salle robotique de l'IUT. 

-----

Auteur: Gauthier Hentz, sur le wiki de l'innovation de l'IUT de Haguenau

 Attribution-NonCommercial-PartageMemeConditions 4.0 International (CC BY-NC-SA 4.0) 

4 - ROS2 - Manipulation Cobot

Manipulation avancée avec AICA - déploiement Cloud

Prérequis

On déploie les TP avec une architecture client-serveur.

Avantages :

Côté serveur

Côté client

Si notre client est un PC Linux on peut avoir une expérience AICA complète en affichant RViz et AICA Launcher sur le PC : https://docs.aica.tech/docs/reference/manual-installation-launch#display-sharing

Installation de AICA sur le serveur via ssh

https://docs.aica.tech/docs/reference/manual-installation-launch 

TP3 - Vision par IA avec Yolo

Pour déploiement sur un serveur avec GPU NVidia et nvidia-container-toolkit :

#syntax=ghcr.io/aica-technology/app-builder:v2

[core]
"image" = "v5.1.0"

[packages]
# add components
#"@aica/components/rl-policy-components" = "v2.0.0"
"@aica/components/advanced-perception" = "v1.0.0" # contains YoloExecutor
"@aica/components/core-vision" = "v1.1.2" # contains CameraStreamer
"@aica/foss/toolkits/ml" = "v1.0.0-cpu24.04" # prerequisite for YoloExecutor

# other extensions

# add hardware collections

Pour déploiement sur un serveur sans GPU :

#syntax=ghcr.io/aica-technology/app-builder:v2

[core]
"image" = "v5.1.0"

[packages]
# add components
#"@aica/components/rl-policy-components" = "v2.0.0"
"@aica/components/advanced-perception" = "v1.0.0" # contains YoloExecutor
"@aica/components/core-vision" = "v1.1.2" # contains CameraStreamer
"@aica/foss/toolkits/ml" = "v1.0.0-cpu24.04" # prerequisite for YoloExecutor

# other extensions
"@aica/foss/web-video-server" = "v0.1.0" # enables web streaming of video topics

# add hardware collections

Si elles ne sont pas déjà dispo dans docker/ télécharger et compiler les composants dépendants, par ex. :

"my-local-package" = "docker-image://my-custom-component-package"

Démarrer une instance du conteneur aica-yolo-web nommée aica en lui passant le dossier persistant aica-yolo-web/persistent/ qui sera disponible dans un dossier persistent/ :

sudo docker run -it --rm --privileged --net=host -v /home/user/docker/aica/aica-license.toml:/license:ro -v /home/user/docker/aica/aica-yolo-web/persistent/:/persistent:rw -e AICA_SUPER_ADMIN_PASSWORD=12345678 --name aica aica-yolo-web

Il peut y avoir des Warnings qui ne sont à ignorer et apparaissent si Cloud Storage n'est pas configuré ou si la vérification de license prend plus que quelques secondes :

[2024-11-18 13:38:16 +0000] [135] [INFO] Starting sync of cloud applications
[2024-11-18 13:38:16 +0000] [135] [WARNING] Sync failed
[2024-11-18 13:08:42 +0000] [151] [INFO] Waiting for licensing status... 5
[WARN] [1731935323.407252919] [EventEngine.ServiceHandler]: (404): Could not determine any license status

Attacher un Terminal à l'intérieur l'instance aica de aica-yolo-web :

sudo docker container exec -it -u ros2 aica /bin/bash
ros2 node list

On voit bien que le contenu du dossier de la VM aica-yolo-web/persistent/ est dispo dans le conteneur dans le dossier persistent/ :

ls persistent
aica.sqlite aica.sqlite-shm aica.sqlite-wal

Détacher le Terminal du conteneur avec CTRL+D ou en tapant exit.

Stopper le conteneur : docker container ps puis docker container stop <container_name>.

Déroulé du TP3

Define a workcell setup
AICA studio -> Hardware -> modify URDF of e.g. UR5e

Build a custom package for Workcell or moveit python API script
https://github.com/aica-technology/community/blob/main/extensions/topic_based_ros2_control/aica-package.toml
source = "git://github.com/hellantos/ur5e_cell#start-of-training:ur5e_cell_description"

4 - ROS2 - Manipulation Cobot

Manipulation avancée avec AICA - déploiement on Premise

Pour déploiement sur un PC Linux avec GPU et nvidia-container-toolkit :

#syntax=ghcr.io/aica-technology/app-builder:v2

[core]
"image" = "v5.0.1"

[packages]
# add components
#"@aica/components/rl-policy-components" = "v2.0.0"
"@aica/components/core-vision" = "v1.1.2"
"@aica/foss/toolkits/cuda" = "v1.0.0-cuda24.12"
"@aica/foss/toolkits/ml" = "v1.0.0-gpu24.12"

# add hardware collections
"@aica/collections/ur-collection" = "v4.2.0"

Pour déploiement sur un serveur sans accélération graphique :

#syntax=ghcr.io/aica-technology/app-builder:v2

[core]
"image" = "v5.0.1"

[packages]
# add components
#"@aica/components/rl-policy-components" = "v2.0.0"
"@aica/components/core-vision" = "v1.1.2"
"@aica/foss/toolkits/ml" = "v1.0.0-cpu24.04"

# add hardware collections
"@aica/collections/ur-collection" = "v4.2.0"

cat /home/user/aica/aica-license.toml | sudo docker login registry.licensing.aica.tech -u USERNAME --password-stdin

sudo docker build -f /home/user/aica/aica-application.toml -t aica-runtime .

sudo docker run -it --rm   --privileged   --net=host   -v /home/user/aica/aica-license.toml:/license:ro   aica-runtime

Roomba ROS2

Roomba ROS2

Connexion physique

http://www.robotappstore.com/Knowledge-Base/3-Serial-Port-Baud-Rate-Configuration/17.html

https://fr.aliexpress.com/item/1005004346786275.html

https://www.yoctopuce.com/FR/article/piloter-un-roomba-avec-un-module-yoctopuce

https://www.adafruit.com/product/2438

https://www.crc.id.au/hacking-the-roomba-600/ 

Roomba ROS2

ROS2

 

Roomba ROS2
https://hackaday.io/project/178565-roomba-rpi
https://github.com/process1183/roomba-rpi
https://github.com/process1183/roomba-ros2

https://hackaday.io/project/183524-controll-yer-roomba-600-series-with-esp8266 

CRASHbot, Ubuntu 18 for NVidia Jetson nano, ROS Melodic, AutonomyLab create-robot
https://www.hackster.io/andrewrgross/crashbot-part-1-planning-a-ros-roomba-helper-robot-d1c8cc

Roomblock Ubuntu 16 ROS Kinetic
https://www.instructables.com/Roomblock-a-Platform-for-Learning-ROS-Navigation-W/
https://github.com/tork-a/roomblock

ROS navigation Ubuntu 10
https://www.ctralie.com/Teaching/DukeDusty2/

Ressources

https://github.com/AutonomyLab/create_robot/tree/humble

https://github.com/process1183/roomba-ros2

https://github.com/process1183/roomba-rpi

Roomba ROS2

Application

https://www.hackster.io/search?i=projects&q=roomba 

https://www.hackster.io/andrewrgross/crashbot-part-1-planning-a-ros-roomba-helper-robot-d1c8cc 

https://www.hackster.io/ssbaker/making-roomba-smarter-800-series-40c5e2 

https://www.hackster.io/FANUEL_CONRAD/automatic-soap-dispenser-75abd6 

 

Bras Robot éducatif- Arduino, ROS2

Bras Robot éducatif- Arduino, ROS2

Etat de l'art Bras robot low-cost

Modèles commerciaux fermés

Niryo Ned 2

https://niryo.com/fr/produit/bras-robotise-6-axes/ 

https://github.com/NiryoRobotics 

DAGU Six-servo Robot Arm

image.png

https://seafile.unistra.fr/d/693101e6046d4819a3af/ 

https://arexx.com/product/robot-arm/ 

www.arexx.com.cn 

Modèles Open Source

https://github.com/AntoBrandi/Robotics-and-ROS-2-Learn-by-Doing-Manipulators 

Trossen Robotics ALOHA

Stationary

https://docs.trossenrobotics.com/trossen_arm/main/specifications.html 

https://docs.trossenrobotics.com/aloha_docs/2.0/specifications.html#aloha-stationary 

https://docs.trossenrobotics.com/aloha_docs/2.0/operation/stationary.html 

Solo
Dimensions 1019D x 1066H x 1225W mm
Leader Arms WidowX 250 S - Aloha Version
Follower Arms ViperX 300 S - Aloha Version
Camera 2x Intel RealSense D405
Chassis Modular
Computer Coming Soon
USB Hubs Yes 1X

https://docs.trossenrobotics.com/aloha_docs/2.0/specifications.html#aloha-solo

https://docs.trossenrobotics.com/aloha_docs/2.0/operation/solo.html 

 Trossen Robotics (Interbotix) X-Series Arms

https://docs.trossenrobotics.com/interbotix_xsarms_docs/specifications.html 

ALOHA WidowX-250 6DOF

ALOHA ViperX-300 6DOF


Waveshare RoArm

ROBOTIS OMX

Follower:

Leader: 

ROBOTIS Open Manipulator-P

ROBOTIS Open Manipulator-X

https://emanual.robotis.com/docs/en/platform/openmanipulator_x/specification/#specification 

SO-ARM100

https://github.com/TheRobotStudio/SO-ARM100 

https://github.com/huggingface/lerobot/blob/main/examples/10_use_so100.md 

https://medium.com/@sarohapranav/my-experiences-and-tips-for-creating-a-robotic-so100-arm-3df779a4aae7 

https://github.com/JafarAbdi/ros2_so_arm100 

pince compatible SO-ARM

Poppy Ergo JR

6DOF mais architecture semble optimisée pour faible le coût, qui n'a plus trop de sens avec le coût des servos Feetech. Une architecture 5DOF ou "typique industrielle" de type épaule poignet semble plus intéressante.

https://www.poppy-education.org/robots/poppy-ergo-jr/ 

Cartes de contrôle

OpenCR1.0

https://emanual.robotis.com/docs/en/parts/controller/opencr10/ 

Waveshare Serial Bus Servo Driver Board

 https://www.waveshare.com/wiki/Bus_Servo_Adapter_(A) 

Feetech FE-URT-1 

https://www.feetechrc.com/FE-URT1-C001.html 

AREXX Intelligence Centre

https://seafile.unistra.fr/d/693101e6046d4819a3af/ 

image.png

image.png

Servomoteurs

Dynamixel XM430-W350

https://emanual.robotis.com/docs/en/dxl/x/xm430-w350/ 

Feetech STS3215

https://www.feetechrc.com/en/2020-05-13_56655.html 


Bras Robot éducatif- Arduino, ROS2

SO-ARM100 - Robotique éducative

Les bases d'un bras robot

https://docs.phospho.ai/learn/overview 

Pilotage bras robot avec Scratch

https://www.poppy-education.org/activites/initiation-ergo-jr-et-scratch/ 

Pilotage du SO-ARM100 avec Phospho

https://docs.phospho.ai/learn/overview 

Simulation et pilotage du SO-ARM100 avec ROS2

Attention avant d'utiliser le robot avec ROS2, il faut avoir calibré les servomoteurs, par ex. avec le script de calibration du projet LeRobot

https://github.com/JafarAbdi/ros2_so_arm100 

https://discourse.openrobotics.org/t/interactive-so-101-ik-in-ros-2-with-viser-robokin/53850 

Jumeau numérique

Pilotage de la simulation ou du vrai robot

https://github.com/tessel-la/robo-boy 

Adapter le tuto suivant au SO-ARM100 : https://innovation.iha.unistra.fr/books/robotique-open-source/page/programmer-un-robot-avec-moveit2-jumeau-numerique 

Contrôle des moteurs par un GUI de "jogging"

Joint Trajectory Controller

ros2 run rqt_joint_trajectory_controller rqt_joint_trajectory_controller

https://github.com/tessel-la/robo-boy 

Contrôle de l'outil sans collisions via le plugin MoveIt de RViz

Cartesian Trajectory

ros2 launch so_arm100_moveit_config moveit_rviz.launch.py

Réalisation d'un programme en Python

https://moveit.picknik.ai/main/doc/examples/motion_planning_python_api/motion_planning_python_api_tutorial.html#single-pipeline-planning-pose-goal 

# set plan start state to current state
panda_arm.set_start_state_to_current_state()

# set pose goal with PoseStamped message
pose_goal = PoseStamped()
pose_goal.header.frame_id = "panda_link0"
pose_goal.pose.orientation.w = 1.0
pose_goal.pose.position.x = 0.28
pose_goal.pose.position.y = -0.2
pose_goal.pose.position.z = 0.5
panda_arm.set_goal_state(pose_stamped_msg=pose_goal, pose_link="panda_link8")

# plan to goal
plan_and_execute(panda, panda_arm, logger)

En utilisant l'environnement de développement Jupyter Notebook https://moveit.picknik.ai/main/doc/examples/jupyter_notebook_prototyping/jupyter_notebook_prototyping_tutorial.html 

Pilotage du bras robot par LeRobot (IA, VR, etc.)

Environnement Python sous Windows ou Linux

Contrôle du bras par clavier ou manette

Avec LeRobot+Phospho https://docs.phospho.ai/basic-usage/teleop 

ou avec ROS2+MoveIt2 https://moveit.picknik.ai/main/doc/examples/jupyter_notebook_prototyping/jupyter_notebook_prototyping_tutorial.html 

Contrôle du bras par Oculus Quest

Compatible LeRobot (WIndows et Ubuntu) :

Depuis Windows :

Depuis Ubuntu avec ROS2 et moveit_servo :

Autre : https://github.com/lts0429/teleoperation 

Contrôle du bras via un modèle d'IA

https://docs.phospho.ai/basic-usage/inference 

Pilotage ST3215 depuis un ESP32 (embarqué, micro-ROS)

Sans utiliser la carte de contrôle Feetech/Waveshare

(5€) : https://github.com/sepastian/ESP32_ST3215 

Pilotage bluetooth depuis un smartphone

Utiliser l'ESP32 pour faire l'interface bluetooth vers une télécommande smartphone ? Avec ou sans carte de contrôle officielle (cf. ci-dessus) ?

Micro-ROS avec bras robot

https://micro.ros.org/docs/tutorials/demos/openmanipulator_demo/ 

6-DoF Inertial Measurement Unit (LSM6DSL), composed of an accelerometer and a gyroscope, and a 3-DoF magnetometer (LIS3MDL). The fusion of the measurements fetched by these sensors outputs the pose, or relative orientation of the board with respect to a fixed reference frame.

Bras Robot éducatif- Arduino, ROS2

ROS2 avec SO-ARM101

ROS2 et MoveIt2

Installer les paquets ROS2 du SO-ARM100 :

mkdir -p ~/ws_so_arm100/src
cd ~/ws_so_arm100/src
git clone --recurse-submodules https://github.com/JafarAbdi/ros2_so_arm100
cd ~/ws_so_arm100
sudo rosdep init
rosdep update && rosdep install --ignore-src --from-paths src -y
colcon build --symlink-install # dans une VM ajouter --parallel-workers 1
source install/setup.bash
ros2 launch so_arm100_moveit_config demo.launch.py hardware_type:=mock_components # hardware_type:=real for running with hardware

Tester la démo en simulation :

Bras Robot éducatif- Arduino, ROS2

Pilotage des servomoteurs : TTL, RS232, RS485

Modes de contrôle des servomoteurs

Regarder la classification des constructeurs permet de se rendre compte des différentes manières de piloter un servomoteur :

Cela va donc du contrôle PWM jusqu'aux bus et protocoles industriels :

Introduction au contrôle PLC

https://celka.fr/ocw/plc-control/modbus/intro-modbus/intro/ 

Protocoles de communication

Dynamixel :

Feetech :

https://esp32io.com/tutorials/esp32-rs485 

Bras Robot éducatif- Arduino, ROS2

Transmission TTL et protocole RS485

Transmission série

Avantages

Inconvénients

Transmission série synchrone

 

Transmission série asynchrone

Exemple : port série RS232 du PC

 

Exemple d’un adapteur FTDI USB-RS232

image.pngimage.png

Transmission série asynchrone TTL

Exemple de trame série (TTL)

‘1’ logique = +5V

‘0’ logique = 0V

image.png

Transmission série asynchrone RS485 vs RS232

 

image.png

Transmission série asynchrone RS485

image.png

Liaisons multipoints

image.png

Penser aux résistances de Terminaison de 120 Ω au début et à la fin de la liaison RS485.

image.png

image.png

Half Duplex


Définition

Exemple

image.png

Topologie : Bus

Principe

image.png

 

image.png

Avantages

Inconvénients

Exemples

Source : Cours IUT Haguenau - Département GEII - Automatisme Spé. 4 - Réseaux Locaux IndustrielsPhilippe Celka, le 28.02.2022

Philippe Celka Copyright © 2025 CC Attribution-Non Commercial-Share Alike 4.0 International

Bras Robot éducatif- Arduino, ROS2

Introduction à Modbus

Protocole Modbus

logo Modbus

Introduction

Modbus est un protocole de communication non propriétaire créé par Modicon en 1979. Les spécifications du protocole sont données librement sur le site de la Modbus Organization. Ce consortium a été créé par Schneider suite au rachat de Modicon en 1997 pour promouvoir Mobdus auprès des fabricants et utilisateurs.

Modbus est très populaire dans les environnement industriels car c’est un protocole simple, facile à intégrer, efficace, fiable, ouvert et royalty-free ! Vous pouvez très facilement intégrer Modbus dans vos projets à base d’ESP32, Raspberry, STM32 …

Le protocole Modbus était à l’origine un protocole sur bus série (Modbus RTU). Il a évolué pour s’intégrer aux technologies TCP/IP quand Ethernet est monté en puissance. On le retrouve dans les domaines de:

C’est une couche applicative (niveau 7 OSI) qui se base sur les liaison séries ou sur les trames Ethernet et les couches TCP/IP.

Stack de communication Modbus :

Modbus Stack

On distingue les différents modes de communication :

Nous débuterons l’analyse du protocole suivant la chronologie avec l’étude du Mobdus RTU (Remote Terminal Unit) sur liaison série.

Modbus RTU

Principe du protocole Master / Slave utilisé en Modbus Serial


La terminologie Master / Slave est remise en cause ces dernières années dans la communauté des développeurs et l’on évite de l’utiliser sur de nouveaux projets. Comme ces termes sont utilisés dans les spécifications officielles “Modbus Serial”, je continuerai des les employer sur cet exemple par cohérence avec les documentations.

Principe de fonctionnement :

Le Master peut initier une transaction avec le Slave suivant deux modes :

Modbus RTU unicast

Le fait d’interroger les Slaves les uns à la suite des autres consiste à effectuer du “Polling”.

Description du protocole

Le protocole Modbus définie un Protocol Data Unit (PDU) indépendant des couches de communication. Il s’agit de la structure du message de base :


Modbus PDU

Function Code représente le type d’ordre (lire, écrire) et les datas sont les paramètres de l’ordre (lire 4 registres mémoire depuis l’adresse 0x3214 par exemple).

Empaqueter le protocole Modbus sur un bus série ou Ethernet nécessite des champs additionels au PDU.

Modbus RTU PDU

 

Sur une liaison Modbus série, l’Address field contient uniquement l’adresse du Slave.

Le champ CRC contient un code de contrôle d’intégrité de message pour détecter les erreurs de transmission.

Les règles d’adressage Modbus

Les adresses des appareils (devices) Modbus sont codés sur 1 octet (8 bits). Il y a donc 256 adresses possibles.

0 From 1 to 247 From 248 to 255
Broadcast address Slave individual addresses Reserved

Les types de données

Il y a deux types de données en Modbus, le bit et le Word (16 bits).

  Type d’objet Accès Exemple
Discrete Input bit Read-Only Entrée TOR, fin de course, contact auxilliaire de disjoncteurs, …
Coil bit Read-Write Sortie TOR, bit interne, RAZ d’un compteur d’énergie, …
Input Register Word (16 bits) Read-Only Entrée analogique, lecture d’un capteur, …
Holding Register Word (16 bits) Read-Write Sortie analogique, variable de programme (ex : temporisation, opérande d’un calcul,…) Valeur de paramétrage d’un équipement (ex: consigne de vitesse d’un variateur de fréquence,…)

Un registre est codé sur 16 bits. Holding Register correspond ainsi à 16 Coil en mode Read-Write tandis que Input Register correspond à 16 entrées que l’on peut seulement acceder en lecture (Read-only).

Rappel :

Les fonctions Modbus

Les “Function Code” correspondent aux types d’ordres, lire ou écrire par exemple, ainsi que le type d’accès (accès au niveau bit ou au niveau registre de 16 bits). Les fonctions sont identifiées par un code sur 8 bits qui peut être représenté en décimal ou en hexa.

Bit access

Code Hex Nom de fonction Commentaire
02 0x02 Read Discrete Inputs Physical Discrete Inputs
01 0x01 Read Coils Internal Bits or Physical coils
05 0x05 Write Single Coil Internal Bits or Physical coils
15 0x0F Write Multiple Coils Internal Bits or Physical coils

16-bit access (register)

Code Hex Nom de fonction Commentaire
04 0x04 Read Input Register Physical Input Registers
03 0x03 Read Holding Registers Internal Registers or Physical Output Registers
06 0x06 Write Single Register Internal Registers or Physical Output Registers
16 0x10 Write Multiple Registers Internal Registers or Physical Output Registers

Les tableaux ci-dessus ne sont pas exhaustif, il y a également des Function Code pour réaliser du diagnostique. Il faut savoir que les fabricants de matériel Modbus n’intègre pas forcément toutes les fonctions possibles. Les fonctions Modbus disponibles sont données dans la documentation technique du constructeur.

Description d’une trame Modbus série

Une communication Modbus série est définie par

Classiquement, en Modbus RTU, c’est la parité paire (Even) qui est utilisée. Si l’on choisit de ne pas implémenter le contrôle de parité (None) il faut placer 2 bits de stop.

Une trame Modbus RTU est composée a minima de 4 octets et au maximun de 256 octets. Chaque octet (byte) qui compose une trame Modbus est codé de la manière suivante :

Modbus RTU frame

 

Une trame Modbus RTU

Une trame Modbus RTU est ainsi composée :

Modbus RTU Frame

La taille maximale d’une trame Modbus RTU est de 256 bytes.

Le CRC est calculé avec l’algo CRC-16-MODBUS.

Acquisition d’une trame Modbus de type request

Scope Frame Modbus RTU

Le décodage de trame Modbus intégré donne au format hexa la trame suivante :

01 03 00 01 00 02 95 CB

On en déduit :

Pour Data, suivant les caractéristiques de la fonction 03 Read Holding Register, les deux premiers bytes 00 01 corresponde à l’adresse de registre de départ et les deux suivants 00 02 correspondent aux nombre de registres que l’on souhaite lire à partir du registre de départ.

En résumé: la trame Modbus RTU suivante effectue la requête suivante -> Au Slave 01, donne la valeur des 00 02 premiers registres à partir de l’adresse mémoire 00 01.

Branchement Modbus RTU en configuration 2 Wire

Le branchement Modbus RTU classique est le “2 Wire” en conformité avec le standard RS-485. Sur un “2W-Bus”, seul un driver à la fois a la possibilité de transmettre un message.

Modbus Two 2 Wire

On parle de topologie 2 fils (2-Wire), mais on se rend compte sur le schéma, que finalement, 3 fils sont utilisés avec la masse (Common).

Modbus Name RS-485 Name Autre Nom Description
D1 B D+ ou Data+ Transceiver Terminal 1 (V1>V0 for binary 1 [OFF] state)
D0 A D- ou Data- Transceiver Terminal 0 (V0>V1 for binary 0 [ON] state)
Common C 0v ou GND Commun, Masse (0V)

En RS-485, à 9600 bit/s sur une paire torsadée en AWG26, on arrive à une longueur de bus maximale de 1000 m!

Les résistances de polarisation (RPull−Up et RPull−Down) permettent de limiter le bruit sur le bus quand il n’y a pas de communication. Les valeurs de ces résistances sont comprises entre 450Ω et 650Ω.

Remarques : Il existe également des configurations de branchement en 4 fils (4-Wire) mais c’est rare.

Connectique Modbus RTU

En Modbus RTU RS-485, trois types de connecteurs connecteurs sont souvent utilisés :

Bornier à visser :

Sur le Wago Controller 100, la connexion se fait par un bornier automatique et utilise les abréviations D+ (D1 ou B) et D- (D0 ou A). L’abréviation GND est utilisée pour le commun (0V) et SH (Shield) pour une connexion au blindage.

Modbus Wago Controller 100

Connecteur DB9 :

L’automate PFC200 de chez Wago utilise une connectique DB9 qui permet de réaliser des liaisons RS-485 ou RS232. Pour le Modbus RTU, c’est la RS-485 qui est classiquement utilisée.

PFC200 WAGO Connecteur DB9
Modbus Wago PFC200
Modbus Wago DB9

La documentation constructeur donne les informations suivantes pour la connectique DB9 du PFC200 en mode RS485.

Contact Signal RS-485 Description
1 NC Not assigned
2 NC Not assigned
3 A (Tx/Rx+) Transmitt/receive Data+
4 NC Not assigned
5 FB_GND Ground
6 FB_5V Power Supply
7 NC Not assigned
8 B (Tx/Rx-) Transmitt/receive Data-
9 NC Not assigned
Housing Shield Shield

On se rend compte que Wago ne respecte pas la norme Modbus dans ce produit ! Ils appellent A -> Data + et B -> Data - qui correspond à la dénomination Profibus de Siemens ! Si votre communication ne fonctionne pas, il suffit parfois d’inverser les fils A-B car le fabricant a mélangé la norme.

Connecteur RJ45


Les fabricants utilisent aussi parfois un connecteur RJ45 pour les liaison RS-485 ! L’erreur est de croire que l’on peut connecter ce type d’appareils sur un switch ou sur le port RJ45 de votre PC. NE LE FAITES PAS !

Bien qu’il s’agisse d’un connecteur RJ45, il s’agit d’une liaison série qui est transportée et il faut donc l’associer à une interface série et non au port RJ45 de votre PC ou de votre switch ! Les fabricants adoptent parfois la connectique RJ45 car les câbles sont peu chers avec un branchement qui est facile et rapide.

Wago Current Sensor Modbus RTU

La documentation Wago donne l’association des broches du connecteur RJ45 :

Pin Function
1 Ub
2 Ub
3 n.c.
4 A (Data+)
5 B (Data-)
6 n.c.
7 GND
8 GND

Toujours la même erreur chez Wago. Ils appellent A -> Data+ et B -> Data- qui correspond à la dénomination Profibus de Siemens.

Connexion RJ45 et DB9 selon spécifications Modbus

Modbus DB9 RJ45
Pin on RJ45 Pin on DB9 Level of requirement Modbus RS-485 Description
3 3 optional PMC - Port Mode Control
4 5 required D1 B Transceiver terminal 1, V1 Voltage (V1>V0 for binary 1 [OFF] state)
5 9 required D0 A Transceiver terminal 0, V0 Voltage (V0>V1 for binary 0 [ON] state)
7 2 recommended VP - Positive 5..24 Vdc Power Supply
8 1 required Common C Signal and Power Supply Common

On se rend compte que Wago n’a pas suivi les recommandations de câblage fixées par la Modbus Organization, de nombreux fabricants font de même. Quand il s’agit d’appareillages d’un même constructeur, cela ne pose pas de soucis, par contre, il faut parfois inverser les signaux A et B quand on mélange les appareillages de fabricants différents sur un même bus Modbus RTU. En Modbus TCP, comme c’est sur du câble Ethernet, on n’a pas ce problème.

Exemple : Modbus RTU avec un capteur de Température et Humidité

Dans cet exemple, je vais connecter un capteur de température et d’humidité PKTH100B-CZ1 qui communique en Modbus RTU avec mon ordinateur portable.

Pour que le PC portable puisse communiquer en RS-485, je lui ajoute un convertisseur FTDI USB-RS485, ainsi qu’un Oscilloscope pour visualiser les trames Modbus-RTU (côté didactique)

Capteur PKTH100B-CZ1 FTDI USB-RS485 Oscilloscope
PKTH100-1 Sensor
FTDI USB RS485
Siglent SDS1202X-E

L’analyse de la documentation du câble FTDI USB-RS485 nous donne les informations suivantes :

Les câble USB-RS485

FTDI USB-RS485 colors
Signal Couleur de fil
GND Noir
(A) Data - Jaune
+5V Rouge
R de 120Ω pin 1 Brun
(B) Data + Orange
R de 120Ω pin 2 Vert

Le capteur

PKTH100-1 Sensor
Terminals number 1 2 3 4
Identifying GND VCC B A
Description Power- Power+ RS485- RS485+

On remarque que sur la documentation du capteur, le signal A est nommé RS485+ tandis que sur la document du convertisseur USB-RS485, le signal A est nommé Data - …

On va rester pragramatique et brancher le fil A (jaune) sur le bornier A (4) du capteur et le fil B (Orange) du convertisseur vers la borne B (3) du capteur. Si jamais cela ne fonctionne pas, il suffira d’inverser ;)

Les masses devant être communes, on branchera le fil GND (noir) du convertisseur à la borne GND (1) du capteur.

Pour alimenter le capteur, j’utilise une alimentation de laboratoire de 24Vdc. Pareil, je brancherai le +24Vdc de l’alimentation à la borne VCC (2) du capteur et le 0V de l’alimentation à la borne GND (1) du capteur.

Pour les résistances de terminaison de 120Ω, je fais le choix de ne pas les placer dans un premier temps car la longueur de bus est très faible.

La manipulation

Manipulation Modbus Capteur Temperature

La documentation (en chinois) indique les paramètres suivants :

  • Vitesse de transmission : 9600 bit/s
  • 8 bits de données
  • Parity : None
  • 1 Stop bit (non respect de la norme)
  • Slave Address (factory) : 1

La document indique également que la requête à envoyer est une fonction de type 03 Read Holding Resgister à l’adresse de Slave 1 et que l’on lit à partir du registre mémoire 0 un nombre de 2 registres.

La trame à envoyer avec le CRC est la suivante : 01 03 00 00 00 02 C4 0B

J’utilise le logiciel QModMaster pour générer facilement la trame et et bien sur, cela ne fonctionne pas :(

On va essayer d’inverser les fils A et B -> boum, ça fonctionne…bref

Les différentes étapes de la configuration de qModMaster

On le numéro du port Com utilisé par le convertisseur USB-RS485 avec le gestionnaire de périphériques Windows. On remarque que dans mon cas, c’est le COM5 qui lui a été attribué. Cela nous permet de paramétrer la liaison série RTU dans QModMaster avec le bon numéro de Com et l’on saisie également les paramètres de liaison du capteur de température (9600 bit/s 8bits de données 1 bit de stop et parity None)

Gestionnaire de périphériques Config Serial dans QModMaster

Dans QModMaster, je choisis le Mode RTU, le Slave Address à 1, le Function Code à 0x03 pour Read Holding Register, le Start Address à 0 et Number of Coils (Registers) à 2.

Dans le Bus Monitor, on remarque que la trame de request vaut : 01 03 00 00 00 02 C4 0B -> ce qui était demandé par la doc, donc on est OK !

La trame de réponse (reply) du capteurs vaut : 01 03 04 01 28 02 22 FA BE

QModMaster Bus Monitor

Le décodage du résultat est donné directement par QModMaster:

  • Le premier registre vaut : 296 en décimal
  • Le second registre vaut : 546 en décimal

La documentation du capteur indique que la valeur du premier registre correspond à la température multipliée par 10. On en déduit qu’il fait 29,6°C en cette journée d’août -> c’est OK

L’humidité multipliée par 10 est dans le second registre. On en déduit que l’humidité relative Hr=54.6% ce qui est conforme.

Méthode de décodage à partir de la trame de réponse

La trame de réponse (reply) du capteurs vaut : 01 03 04 01 28 02 22 FA BE . On peut décoder le contenu de la manière suivante :

  • 01: correspond à l’adresse du capteuur qui donne la réponse
  • 03: indique qu’il répond à une réquête de type 03 Read Holding Register
  • 04: c’est la valeur de la fonction 03 + 1 pour dire que tout c’est bien passé !
  • 01 28: c’est la valeur en hexa du contenu du premier registre avec 01 l’octet de poids fort et 28 l’octet de poids faible. Converti en décimal, on obtient 296
  • 02 22: correspond à la valeur en hexa du second registre. Converti en décimal, on obtient 546.
  • FA BE: correspond au CRC de la trame de réponse.

Capture des trames Modbus RTU avec l’oscilloscope

On peut observer la trame de request générée par QModMaster qui vaut 01 03 00 00 00 02 C4 0B

Modbus Oscilloscope Frame

 

Et la trame de réponse du capteur qui vaut 01 03 04 01 28 02 22 FA BE

Modbus Oscilloscope Frame

Source https://celka.fr/ocw/plc-control/modbus/intro-modbus/intro/ 

Philippe Celka Copyright © 2025 CC Attribution-Non Commercial-Share Alike 4.0 International

0 - Robotique et physical AI

0 - Robotique et physical AI

IA robotique - Architectures pour l'apprentissage profond

Le contrôle d'un robot pour une application donnée au moyen d'un modèle de réseaux de neurones nécessite de fournir une quantité importante de données d'apprentissage. Ces données doivent permettre de comprendre comment résoudre la tâche, par exemple pour une tâche de saisie et dépose d'un objet (Pick and Place) elles doivent donc comporter :

L'approche la plus répandue pour générer ces données d'apprentissage est la démonstration : le robot est "téléguidé" par un opérateur. On enregistre la trajectoire des servomoteurs ainsi qu'une ou plusieurs vidéos filmant les objets et le robot.

Bancs matériel de Machine Learning

Open ARM et open arm mini

https://huggingface.co/spaces/lerobot/robot-folding 

image.png

openarm-mini1.0Xrhdt1t.jpg

Koch

Robotis OMX

https://ai.robotis.com/omx/introduction_omx.html 

LeRobot SO-ARM10X

PXL_20250613_153054943.jpg

Aloha Solo

Base : $9,899.95

image.png

https://www.youtube.com/watch?v=hFqZJZ666Cw 

Whole Product Shot Square.jpg

https://www.trossenrobotics.com/aloha-solo 

Aloha Stationary

Without Laptop : $30,799.98

aloha-stationary-mv-p2.jpg

Environnement logiciel de collecte de données

Hugging Face LeRobot - Python

Visualisation des DataSet : https://huggingface.co/spaces/lerobot/visualize_dataset 

On note qu'il y a beaucoup de tests avec le SO-ARM10X. Mais pas d'homogénéité dans la collecte de données : les caméras sont placées la plupart du temps devant le robot, parfois sur la pince, et quasiment jamais avec le setup recommandé.

Rechercher des DataSet qui ont servi à entrainer des modèles disponibles publiés :


Setup similaires à celui du SO-ARM10X simple :

Télécharger un DataSet : https://github.com/huggingface/lerobot/blob/a1daeaf0c4ae345df9b2f5b862f091ce158e4446/examples/1_load_lerobot_dataset.py 

Rejouer les épisodes d'un DataSet : https://github.com/huggingface/lerobot/blob/a1daeaf0c4ae345df9b2f5b862f091ce158e4446/examples/12_use_so101.md#replay-an-episode 

Evaluer un modèle pré-entrainé : https://github.com/huggingface/lerobot/blob/a1daeaf0c4ae345df9b2f5b862f091ce158e4446/examples/2_evaluate_pretrained_policy.py 

Trossen Robotics Interbotix - ROS, Python, 

0 - Robotique et physical AI

Banc de machine learning avec SO-ARM101

Assemblage et démarrage du SO-ARM101

Configurer les servomoteurs

La carte FE-URT-1 fournie par Feetech n'est pas détectée sous Ubuntu à cause d'un conflit avec un paquet de brail. On le désinstalle : 

sudo apt-get autoremove brltty

https://askubuntu.com/questions/1321442/how-to-look-for-ch340-usb-drivers/1472246#1472246 

https://github.com/huggingface/lerobot/blob/main/examples/10_use_so100.md#c-configure-the-motors 

python lerobot/scripts/find_motors_bus_port.py
sudo chmod 666 /dev/ttyACM0
sudo chmod 666 /dev/ttyACM1

gedit ~/lerobot/lerobot/common/robot_devices/robots/configs.py

python lerobot/scripts/configure_motor.py \
  --port /dev/tty.usbmodem58760432961 \
  --brand feetech \
  --model sts3215 \
  --baudrate 1000000 \
  --ID 1

Ne plus bouger les servos jusqu'à l'assemblage

Construction et assemblage mécanique

Une version 101 est sortie en 05/2025. Le Leader est plus simple à assembler, et plus besoin de démonter les servos pour enlever un engrenage et les rendre passifs. Il suffit d'acheter le kit de 6 servos avec 3 rapports de transmission différents :

Astuces pour l'assemblage

image.png

Banc de Machine Learning LeRobot

Agencement des caméras et robots

Le nombre, le positionnement et la qualité des caméras sont importants pour la qualité du DataSet :

Au FabLab de IUT Haguenau

PXL_20250613_142740983_crop.jpg

Calibration des caméras

https://huggingface.co/docs/lerobot/cameras 

0 - Robotique et physical AI

Assembler un PC d'IA en 2026

Usages :

Configuration pour un total d'environ 1500€ :

5070 Ti

Donc par exemple : 

export distro="ubuntu2404"
export arch="x86_64"
export version="570"
wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt install nvidia-driver-pinning-$version
sudo IGNORE_PREEMPT_RT_PRESENCE=1 apt install cuda-drivers nvidia-driver-$version-open

Benchmark glmark2 en résolution 1920x1080 https://openbenchmarking.org/test/pts/glmark2 

glmark2 -s 1920x1080
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      NVIDIA Corporation
    GL_RENDERER:    NVIDIA GeForce RTX 5070 Ti/PCIe/SSE2
    GL_VERSION:     4.6.0 NVIDIA 570.211.01
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   1920x1080 windowed
=======================================================
[build] use-vbo=false: FPS: 17118 FrameTime: 0.058 ms
[build] use-vbo=true: FPS: 29160 FrameTime: 0.034 ms
[texture] texture-filter=nearest: FPS: 24267 FrameTime: 0.041 ms
[texture] texture-filter=linear: FPS: 29185 FrameTime: 0.034 ms
[texture] texture-filter=mipmap: FPS: 29395 FrameTime: 0.034 ms
[shading] shading=gouraud: FPS: 28971 FrameTime: 0.035 ms
[shading] shading=blinn-phong-inf: FPS: 28964 FrameTime: 0.035 ms
[shading] shading=phong: FPS: 28750 FrameTime: 0.035 ms
[shading] shading=cel: FPS: 28703 FrameTime: 0.035 ms
[bump] bump-render=high-poly: FPS: 26538 FrameTime: 0.038 ms
[bump] bump-render=normals: FPS: 29854 FrameTime: 0.033 ms
[bump] bump-render=height: FPS: 29795 FrameTime: 0.034 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 25300 FrameTime: 0.040 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 19425 FrameTime: 0.051 ms
[pulsar] light=false:quads=5:texture=false: FPS: 27432 FrameTime: 0.036 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 9557 FrameTime: 0.105 ms
[desktop] effect=shadow:windows=4: FPS: 17248 FrameTime: 0.058 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 3425 FrameTime: 0.292 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 3852 FrameTime: 0.260 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 4847 FrameTime: 0.206 ms
[ideas] speed=duration: FPS: 24299 FrameTime: 0.041 ms
[jellyfish] <default>: FPS: 20993 FrameTime: 0.048 ms
[terrain] <default>: FPS: 2663 FrameTime: 0.376 ms
[shadow] <default>: FPS: 17595 FrameTime: 0.057 ms
[refract] <default>: FPS: 6201 FrameTime: 0.161 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 28276 FrameTime: 0.035 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 28159 FrameTime: 0.036 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 23158 FrameTime: 0.043 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 24062 FrameTime: 0.042 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 27253 FrameTime: 0.037 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 28133 FrameTime: 0.036 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 28144 FrameTime: 0.036 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 28068 FrameTime: 0.036 ms
=======================================================
                                  glmark2 Score: 22083 
=======================================================

 

Config laptop

0 - Robotique et physical AI

Installation de machine avec RT Kernel et accélération graphique

Déploiement avec FAI-Project

https://fai-project.org/FAIme/ 

Your job BYDEGIKS is currently being processed. https://fai-project.org/myimages/BYDEGIKS

Your web config:

type="install"
partition="ONE"
desktop="XORG"
suite="ubuntu"
keyboard="fr"
addpkgs="software-properties-common terminator nano htop wget curl gpg apt-transport-https python3-rosdep2 ubuntu-realtime docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
email="robotics@hentz.eu"
rootpw=''
username="etudiant"
userpw=''
gittype=""
gituser=""
repo="deb [trusted=yes] http://download.docker.com/linux/ubuntu noble stable"
postinst="install_pc_aica.sh"
rclocal="1"
datapart=""
cmdline=""
options="STANDARD REBOOT RECOMMENDS"

curl "https://fai-project.org/cgi/faime.cgi?type=install;username=etudiant;partition=ONE;repo=http%3A%2F%2Fdownload.docker.com%2Flinux%2Fubuntu%20noble%20stable;keyboard=fr;suite=ubuntu;desktop=XORG;cl6=STANDARD;addpkgs=software-properties-common%20terminator%20nano%20htop%20wget%20curl%20gpg%20apt-transport-https%20python3-rosdep2%20ubuntu-realtime%20docker-ce%20docker-ce-cli%20containerd.io%20docker-buildx-plugin%20docker-compose-plugin;cl9=RECOMMENDS;email=robotics%40hentz.eu;postinst=install_pc_aica.sh;rclocal=1;cl8=REBOOT;sbm=2"

sudo apt install ubuntu-realtime
sudo nano /etc/default/grub
sudo update-grub
uname -v | cut -d" " -f1-4
sudo apt install cpufrequtils
sudo systemctl disable ondemand
sudo systemctl enable cpufrequtils
sudo sh -c 'echo "GOVERNOR=performance" > /etc/default/cpufrequtils'
sudo systemctl daemon-reload && sudo systemctl restart cpufrequtils
sudo systemctl status docker
cpufreq-info

wget <https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb>
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt install nvidia-driver-pinning-570
sudo IGNORE_PREEMPT_RT_PRESENCE=1 apt install cuda-drivers

sudo apt-get update && sudo apt-get install -y --no-install-recommends    ca-certificates    curl    gnupg2
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: <https://download.docker.com/linux/ubuntu>
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
sudo usermod -aG docker $USER

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 update
sudo apt install nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo reboot
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

git clone <https://github.com/gautz/unistra-aica-practical> aica
cd ~/aica/package-template
docker build -f aica-package.toml -t object-detection-utils .

RT Kernel

RT Kernel ou Low Latency ?

https://unix.stackexchange.com/questions/553980/why-would-anyone-choose-not-to-use-the-lowlatency-kernel 

Soit on build à la main (https://innovation.iha.unistra.fr/books/robotique-open-source/page/commander-un-robot-ur-avec-le-driver-ros2#bkmrk-installation-d%27ubunt ), soit on prend un Kernel qui est dispo dans les dépôts

sudo apt list *realtime* linux*rt

ubuntu-realtime
linux-realtime
linux-image-6.8.1-1015-realtime
GRUB_SAVEDEFAULT=true
GRUB_DEFAULT="saved" # Le dernier Kernel choisi devient le Kernel par défaut
#GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 6.8.1-1015-realtime"
#GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=3 # 3 secondes pour choisir le Kernel à démarrer

https://unix.stackexchange.com/questions/198003/set-the-default-kernel-in-grub 

https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html 

Accélération GPU

Que ce soit pour LeRobot, pour AICA, ou en général pour utiliser des modèles d'IA, l'installation de Linux avec les bons drivers graphiques n'est pas toujours aisé.

On veut accéder dans Docker aux capacités Compute d'un GPU, essentiellement fournie par NVidia Cuda. On différentiera l'installation d'un serveur qui n'a pas besoin de l'accélération graphique liée à l'affichage, ni de capacités temps-réel, contrairement à un PC de commande de robot.

NVidia Driver et RT Kernel

https://interfacinglinux.com/2024/01/16/nvidia-cuda-on-debian-real-time-kernel/ 

https://gist.github.com/pantor/9786c41c03a97bca7a52aa0a72fa9387 

Prérequis

sudo apt install nvidia-driver installe la dernière version du driver dispo, mais cuda-drivers n'est pas forcément dispo pour cette version. Donc on va chercher la bonne version.

Pour supprimer tous les drivers nvidia précédemment installés. A utiliser avec précautions : sudo apt autoremove --purge *nvidia*

Installation du nvidia-driver et de cuda

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker 

Optionnel

sudo apt -V install libnvidia-compute nvidia-dkms

sudo apt -V install libnvidia-gl nvidia-dkms

https://docs.nvidia.com/datacenter/tesla/driver-installation-guide/ubuntu.html 

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#network-repo-installation-for-ubuntu 

Vérification de la compatibilité GPU - Application IA

Procédure :
On a une application d'IA donnée

Par exemple YOLO :

ONNX Runtime (ORT) qui sert à l'inférence des modèles Yolo sur GPU nécessitent des Compute Capability >= 6.0

Différentes versions de l'environnement d'exécution

https://docs.nvidia.com/deeplearning/cudnn/backend/latest/reference/support-matrix.html 

cuDNN>=v9.12.0 supporte :

cuDNN<=v9.11.1 

cuDNN<=v9.10.2 : 

Compatibilité de version d'Ubuntu

Sur Ubuntu 24.04 :

On a une carte graphique donnée :

Problèmes avec les GPU NVidia anciens : https://github.com/ultralytics/ultralytics/issues/5305 

GPU NVidia anciens / Legacy

On lance Yolo et on a l'erreur suivante : 

10:17:40.111 [yolo_executor] error: ONNX Runtime error during model query: Non-zero status code returned while running QuickGelu node. Name:'node_silu/QuickGeluFusion/' Status Message: CUDA error cudaErrorNoKernelImageForDevice:no kernel image is available for execution on the device

ONNX Runtime (ORT) qui sert à l'inférence des modèles Yolo sur GPU nécessitent des Compute Capability > 5.2

Solution (voir analyse ci-dessous) :

https://github.com/microsoft/onnxruntime/issues/17861#issuecomment-1758098712 

On a une carte graphique donnée | par exemple Quadro M620 (GM107GLM) :

Option 1 : Driver Version: 580   CUDA Version: 13.0

Option 2 : Driver Version: 570   CUDA Version: 12.8

Option 3 : Driver Version: 535.288.01   CUDA Version: 12.2

Option 4 : Driver Version: 470   CUDA Version: 11.x

https://pytorch.org/get-started/previous-versions/

https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-892/support-matrix/index.html 

cuDNN=v8.9.2 : 

https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-897/support-matrix/index.html 

cuDNN=v8.9.7 : 

Voir aussi https://docs.nvidia.com/deeplearning/cudnn/onnxruntime-gpuarchives/index.html 

Avec :

#syntax=ghcr.io/aica-technology/app-builder:v2
# launch with bash: 
[core]
"image" = "v5.1.0"

[packages]
# add components
#"@aica/components/rl-policy-components" = "v3.0.0"
"@aica/components/advanced-perception" = "v1.0.0" # contains YoloExecutor
"@aica/components/core-vision" = "v1.1.2" # contains CameraStreamer
"@aica/foss/toolkits/cuda" = "v1.0.0-cuda24.12" # prerequisite for NVidia GPU acceleration
"@aica/foss/toolkits/ml" = "v1.0.0-gpu24.12" # prerequisite for ML model inference

# other extensions
"object-detection-utils" # self-built component to feed goal frame extracted from yolo to robot velocity controller

# add hardware collections
"@aica/collections/intel-realsense-collection" = "v2.0.1" # D4XX and L515 cameras models, stream RGBD
"@aica/collections/ur-collection" = "v4.3.0"

On a :

ros2@iha-portrob-1:~/examples$ python3 -m torch.utils.collect_env 
<frozen runpy>:128: RuntimeWarning: 'torch.utils.collect_env' found in sys.modules after import of package 'torch.utils', but prior to execution of 'torch.utils.collect_env'; this may result in unpredictable behaviour
Collecting environment information...
PyTorch version: 2.6.0+cu126
Is debug build: False
CUDA used to build PyTorch: 12.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 24.04.2 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Clang version: Could not collect
CMake version: version 3.28.3
Libc version: glibc-2.39

Python version: 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.17.0-14-generic-x86_64-with-glibc2.39
Is CUDA available: True
CUDA runtime version: 12.6.85
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: Quadro M620
Nvidia driver version: 570.211.01
cuDNN version: Probably one of the following:
/usr/lib/libcudnn.so.9.6.0
/usr/lib/libcudnn_adv.so.9.6.0
/usr/lib/libcudnn_cnn.so.9.6.0
/usr/lib/libcudnn_engines_precompiled.so.9.6.0
/usr/lib/libcudnn_engines_runtime_compiled.so.9.6.0
/usr/lib/libcudnn_graph.so.9.6.0
/usr/lib/libcudnn_heuristic.so.9.6.0
/usr/lib/libcudnn_ops.so.9.6.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                            x86_64
CPU op-mode(s):                          32-bit, 64-bit
Address sizes:                           39 bits physical, 48 bits virtual
Byte Order:                              Little Endian
CPU(s):                                  4
On-line CPU(s) list:                     0-3
Vendor ID:                               GenuineIntel
Model name:                              Intel(R) Core(TM) i5-7440HQ CPU @ 2.80GHz
CPU family:                              6
Model:                                   158
Thread(s) per core:                      1
Core(s) per socket:                      4
Socket(s):                               1
Stepping:                                9
CPU(s) scaling MHz:                      84%
CPU max MHz:                             3800.0000
CPU min MHz:                             800.0000
BogoMIPS:                                5599.85
Flags:                                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
Virtualization:                          VT-x
L1d cache:                               128 KiB (4 instances)
L1i cache:                               128 KiB (4 instances)
L2 cache:                                1 MiB (4 instances)
L3 cache:                                6 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-3
Vulnerability Gather data sampling:      Vulnerable
Vulnerability Ghostwrite:                Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             KVM: Mitigation: Split huge pages
Vulnerability L1tf:                      Mitigation; PTE Inversion; VMX conditional cache flushes, SMT disabled
Vulnerability Mds:                       Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Meltdown:                  Mitigation; PTI
Vulnerability Mmio stale data:           Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Old microcode:             Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Mitigation; IBRS
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; IBRS; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                     Mitigation; Microcode
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Mitigation; TSX disabled
Vulnerability Vmscape:                   Mitigation; IBPB before exit to userspace

Versions of relevant libraries:
[pip3] ament-flake8==0.17.2
[pip3] flake8==7.0.0
[pip3] flake8-builtins==2.1.0
[pip3] flake8-comprehensions==3.14.0
[pip3] flake8-docstrings==1.6.0
[pip3] flake8-import-order==0.18.2
[pip3] flake8-quotes==3.4.0
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.6.4.1
[pip3] nvidia-cuda-cupti-cu12==12.6.80
[pip3] nvidia-cuda-nvrtc-cu12==12.6.77
[pip3] nvidia-cuda-runtime-cu12==12.6.77
[pip3] nvidia-cudnn-cu12==9.5.1.17
[pip3] nvidia-cufft-cu12==11.3.0.4
[pip3] nvidia-curand-cu12==10.3.7.77
[pip3] nvidia-cusolver-cu12==11.7.1.2
[pip3] nvidia-cusparse-cu12==12.5.4.2
[pip3] nvidia-cusparselt-cu12==0.6.3
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.6.85
[pip3] nvidia-nvtx-cu12==12.6.77
[pip3] onnxruntime-gpu==1.22.2
[pip3] pytorch3d==0.7.8
[pip3] torch==2.6.0+cu126
[pip3] torchaudio==2.6.0+cu126
[pip3] torchvision==0.21.0+cu126
[pip3] triton==3.2.0
[conda] Could not collect

Avec :

"@aica/foss/toolkits/cuda" = "v1.0.0-cuda24.12" # prerequisite for NVidia GPU acceleration
"@aica/foss/toolkits/ml" = "v1.0.0-gpu24.12" # prerequisite for ML model inference

On a :

ros2@iha-portrob-1:~/examples$ python3 -m torch.utils.collect_env
<frozen runpy>:128: RuntimeWarning: 'torch.utils.collect_env' found in sys.modules after import of package 'torch.utils', but prior to execution of 'torch.utils.collect_env'; this may result in unpredictable behaviour
Collecting environment information...
PyTorch version: 2.6.0+cu126
Is debug build: False
CUDA used to build PyTorch: 12.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 24.04.2 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Clang version: Could not collect
CMake version: version 3.28.3
Libc version: glibc-2.39

Python version: 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.17.0-14-generic-x86_64-with-glibc2.39
Is CUDA available: True
CUDA runtime version: 12.6.85
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: Quadro M620
Nvidia driver version: 570.211.01
cuDNN version: Probably one of the following:
/usr/lib/libcudnn.so.9.6.0
/usr/lib/libcudnn_adv.so.9.6.0
/usr/lib/libcudnn_cnn.so.9.6.0
/usr/lib/libcudnn_engines_precompiled.so.9.6.0
/usr/lib/libcudnn_engines_runtime_compiled.so.9.6.0
/usr/lib/libcudnn_graph.so.9.6.0
/usr/lib/libcudnn_heuristic.so.9.6.0
/usr/lib/libcudnn_ops.so.9.6.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                            x86_64
CPU op-mode(s):                          32-bit, 64-bit
Address sizes:                           39 bits physical, 48 bits virtual
Byte Order:                              Little Endian
CPU(s):                                  4
On-line CPU(s) list:                     0-3
Vendor ID:                               GenuineIntel
Model name:                              Intel(R) Core(TM) i5-7440HQ CPU @ 2.80GHz
CPU family:                              6
Model:                                   158
Thread(s) per core:                      1
Core(s) per socket:                      4
Socket(s):                               1
Stepping:                                9
CPU(s) scaling MHz:                      81%
CPU max MHz:                             3800.0000
CPU min MHz:                             800.0000
BogoMIPS:                                5599.85
Flags:                                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
Virtualization:                          VT-x
L1d cache:                               128 KiB (4 instances)
L1i cache:                               128 KiB (4 instances)
L2 cache:                                1 MiB (4 instances)
L3 cache:                                6 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-3
Vulnerability Gather data sampling:      Vulnerable
Vulnerability Ghostwrite:                Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             KVM: Mitigation: Split huge pages
Vulnerability L1tf:                      Mitigation; PTE Inversion; VMX conditional cache flushes, SMT disabled
Vulnerability Mds:                       Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Meltdown:                  Mitigation; PTI
Vulnerability Mmio stale data:           Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Old microcode:             Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Mitigation; IBRS
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; IBRS; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                     Mitigation; Microcode
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Mitigation; TSX disabled
Vulnerability Vmscape:                   Mitigation; IBPB before exit to userspace

Versions of relevant libraries:
[pip3] ament-flake8==0.17.2
[pip3] flake8==7.0.0
[pip3] flake8-builtins==2.1.0
[pip3] flake8-comprehensions==3.14.0
[pip3] flake8-docstrings==1.6.0
[pip3] flake8-import-order==0.18.2
[pip3] flake8-quotes==3.4.0
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.6.4.1
[pip3] nvidia-cuda-cupti-cu12==12.6.80
[pip3] nvidia-cuda-nvrtc-cu12==12.6.77
[pip3] nvidia-cuda-runtime-cu12==12.6.77
[pip3] nvidia-cudnn-cu12==9.5.1.17
[pip3] nvidia-cufft-cu12==11.3.0.4
[pip3] nvidia-curand-cu12==10.3.7.77
[pip3] nvidia-cusolver-cu12==11.7.1.2
[pip3] nvidia-cusparse-cu12==12.5.4.2
[pip3] nvidia-cusparselt-cu12==0.6.3
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.6.85
[pip3] nvidia-nvtx-cu12==12.6.77
[pip3] onnxruntime-gpu==1.22.2
[pip3] pytorch3d==0.7.8
[pip3] torch==2.6.0+cu126
[pip3] torchaudio==2.6.0+cu126
[pip3] torchvision==0.21.0+cu126
[pip3] triton==3.2.0
[conda] Could not collect

Sources

https://stackoverflow.com/questions/30820513/what-is-the-correct-version-of-cuda-for-my-nvidia-driver/30820690#30820690 

https://interfacinglinux.com/2024/01/16/nvidia-cuda-on-debian-real-time-kernel/ 

https://forum.zorin.com/t/nvidia-drivers-cannot-be-installed-because-of-real-time-kernel/46419/22 

0 - Robotique et physical AI

Machine Learning LeRobot avec SO-ARM101

Installation et prérequis

Prérequis pour l'exécution d'un modèle d'IA :

Prérequis pour l'entraînement d'un modèle d'IA :

Installation sous Linux

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# Vérifier que la clé SHA256 de Miniconda3-latest-Linux-x86_64.sh ici : https://repo.anaconda.com/miniconda/ correspond à :
sha256sum ~/Miniconda3-latest-Linux-x86_64.sh
bash ~/Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda create -y -n lerobot python=3.10
conda activate lerobot
git clone https://github.com/huggingface/lerobot.git ~/lerobot
conda install ffmpeg=7.1.1 -c conda-forge
cd ~/lerobot && pip install -e ".[feetech]"

Astuces pour activer/désactiver l'environnement conda sans passer par la modification du ~/.bashrc :

Installation Windows

conda create -y -n lerobot python=3.10
conda activate lerobot
git clone https://github.com/huggingface/lerobot.git ~/lerobot
cd ~/lerobot
# pip install av poetry-core
conda install ffmpeg=7.1.1 -c conda-forge
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -e ".[feetech]"

Débuguer l'installation si les scripts basculent sur le cpu

S'assurer que Pytorch a été installé, cela installe Cuda :

pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

Récupérer les infos système :

Créer un compte HuggingFace et se login via un token

Vous pouvez maintenant uploader et downloaded des DataSets et Modèles vers le Hub HuggingFace pour collaborer avec des experts du Machine Learning.

Google Colab

Pour avoir accès à un GPU avec suffisamment de mémoire (16G recommandé et 64G dans l'idéal) on peut utiliser Google Colab

image.png

!cd lerobot && python src/lerobot/scripts/lerobot_train.py \
  --dataset.repo_id=gautz/so101_pick_red_18650_drop_black_box_test2_100ep \
  --policy.type=act \
  --output_dir=outputs/train/act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch \
  --job_name=act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch \
  --policy.device=cuda \
  --policy.push_to_hub=True \
  --policy.repo_id=gautz/act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch \
  --batch_size=64 \
  --wandb.enable=true
huggingface-cli upload ${HF_USER}/act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch \
/content/lerobot/outputs/train/act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch/checkpoints/last/pretrained_model

Astuces et Erreurs :

   18  cd /content/
   20  cd lerobot/
   24  python
   25              from huggingface_hub import HfApi
   26              hub_api = HfApi()
   27              hub_api.create_tag("gautz/so101_pick_red_18650_drop_black_box_test2_100ep", tag="v2.1", repo_type="dataset"
   30  cd src/
   32  cd lerobot
   34  python -m lerobot.datasets.v30.convert_dataset_v21_to_v30 --repo-id=gautz/so101_pick_red_18650_drop_black_box_test2_100ep

Voir le rapport : https://api.wandb.ai/links/hentz-robotics/wdsr4k2r 

Utilisation de LeRobot avec le bash Linux

lerobot-find-port

A chaque connexion du robot : sudo chmod 666 /dev/ttyACM1

lerobot-find-cameras opencv

lerobot-calibrate     --robot.type=so101_follower     --robot.port=/dev/ttyACM0     --robot.id=follower_arm_fan1

lerobot-calibrate     --teleop.type=so101_leader     --teleop.port=/dev/ttyACM1     --teleop.id=leader_arm_fan1

lerobot-teleoperate     --robot.type=so101_follower     --robot.port=/dev/ttyACM0     --robot.id=follower_arm_fan1     --teleop.type=so101_leader     --teleop.port=/dev/ttyACM1     --teleop.id=leader_arm_fan1

lerobot-dataset-viz     --repo-id gautz/so101_pick_red_18650_drop_black_box_test2_100ep     --episode-index 0

lerobot-record   --robot.type=so101_follower   --robot.port=/dev/ttyACM0   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 4, width: 800, height: 600, fps: 20},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 20}}"   --display_data=true   --dataset.push_to_hub=False   --dataset.repo_id=gautz/eval_act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch_60ksteps   --dataset.num_episodes=10   --dataset.single_task="Pick red 18650 battery place black box"   --policy.path=gautz/act_so101_pick_red_18650_drop_black_box_test2_100ep_64batch_60ksteps

--resume=true

lerobot-train   --dataset.repo_id=gautz/so101_pick_red_18650_drop_black_box_test2_100ep   --policy.type=act   --output_dir=outputs/train/act_so101_pick_red_18650_drop_black_box_test2_100ep_m620   --job_name=act_so101_pick_red_18650_drop_black_box_test2_100ep_m620   --policy.device=cuda   --wandb.enable=false   --policy.repo_id=gautz/act_so101_pick_red_18650_drop_black_box_test2_100ep_m620 --batch_size=2

nano lerobot/common/robot_devices/robots/configs.py

python lerobot/scripts/control_robot.py   --robot.type=so101   --robot.cameras='{}'   --control.type=teleoperate

lerobot-record     --robot.type=so101_follower     --robot.port=/dev/ttyACM0     --robot.id=follower_arm_fan1 --robot.cameras="{ top: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 20},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 20}}"   --dataset.push_to_hub=False   --dataset.repo_id=gautz/eval_act_so101_pick_battery_place_ifixit_test1_50ep_rtx507016_chkpt100kter --dataset.num_episodes=10   --dataset.single_task="Eval Pick battery place ifixit" --policy.path=outputs/train/act_so101_pick_battery_place_ifixit_test1_50ep_rtx507016/checkpoints/100000/pretrained_model --display_data=false

Server inference

pip install 'lerobot[feetech,async]'

python -m lerobot.async_inference.robot_client     --server_address=127.0.0.1:8080     --robot.type=so101_follower     --robot.port=/dev/ttyACM0     --robot.id=follower_arm_fan1     --robot.cameras="{ top: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 20},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 20}}"     --task="Eval Pick battery place ifixit"     --policy_type=act     --pretrained_name_or_path=gautz/act_so101_pick_battery_place_ifixit_test1_50ep_rtx507016_chkpt100000     --policy_device=cuda     --actions_per_chunk=50     --chunk_size_threshold=0.5     --aggregate_fn_name=weighted_average     --debug_visualize_queue_size=True

Calibration robot et configuration caméras

python -m lerobot.calibrate     --teleop.type=so101_leader  --teleop.port=/dev/ttyACM0 --teleop.id=leader_arm_fan1

python -m lerobot.calibrate     --robot.type=so101_follower     --robot.port=/dev/ttyUSB0 --robot.id=follower_arm_fan1

Téléopération

python -m lerobot.teleoperate \
    --robot.type=so101_follower \
    --robot.port=/dev/ttyUSB0 \
    --robot.id=follower_arm_fan1 \
    --robot.cameras="{ top: {type: opencv, index_or_path: 2, width: 640, height: 480, fps: 30},follower: {type: opencv, index_or_path: 4, width: 640, height: 480, fps: 30}}" \
    --teleop.type=so101_leader \
    --teleop.port=/dev/ttyACM0 \
    --teleop.id=leader_arm_fan1 \
    --display_data=true

Rejouer dataset en local :

python -m lerobot.replay \
    --robot.type=so101_follower \
    --robot.port=/dev/ttyUSB0 \
    --robot.id=follower_arm_fan1 \
    --dataset.repo_id=gautz/18650-test1-10ep \
    --dataset.episode=0 # choose the episode you want to replay

Machine Learning

Enregistrer dataset en local :

python -m lerobot.record \
    --robot.type=so101_follower \
    --robot.port=/dev/ttyUSB0 \
    --robot.id=follower_arm_fan1 \
    --robot.cameras="{ top: {type: opencv, index_or_path: 2, width: 640, height: 480, fps: 30},follower: {type: opencv, index_or_path: 4, width: 640, height: 480, fps: 30}}" \
    --teleop.type=so101_leader \
    --teleop.port=/dev/ttyACM0 \
    --teleop.id=leader_arm_fan1 \
    --display_data=true \
    --dataset.repo_id=gautz/18650-test1-10ep \
    --dataset.episode_time_s=10 \
    --dataset.reset_time_s=10 \
    --dataset.num_episodes=10 \
    --dataset.single_task="Pick red 18650 battery place black box" \
    --dataset.push_to_hub=False

Entrainer en local avec le CPU

python lerobot/scripts/train.py \
  --dataset.repo_id=gautz/18650-test1-10ep \
  --policy.type=act \
  --output_dir=outputs/train/act_so101_18650-test1-10ep \
  --job_name=act_so101_18650-test1-10ep \
  --policy.device=cpu # \
  --wandb.enable=false # true

Entrainer en local avec le GPU NVidia

python lerobot/scripts/train.py \
  --dataset.repo_id=gautz/18650-test1-10ep \
  --policy.type=act \
  --output_dir=outputs/train/act_so101_18650-test1-10ep \
  --job_name=act_so101_18650-test1-10ep \
  --policy.device=cuda \
  --wandb.enable=false

Enregistrer un dataset d'évaluation d'un modèle à un checkpoint donné :

python -m lerobot.record  \
--robot.type=so101_follower \
--robot.port=/dev/ttyUSB0 \
--robot.cameras="{ top: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 4, width: 800, height: 600, fps: 30}}" \
--robot.id=follower_arm_fan1 \
--display_data=false \
--dataset.repo_id=gautz/eval_act_18650-test2-100ep \
--dataset.single_task="Pick red 18650 battery place black box" \
--policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model \
--dataset.push_to_hub=False

Utilisation de LeRobot avec Anaconda Powershell Prompt

Calibration des robots

python -m lerobot.setup_motors --robot.type=so101_follower --robot.port=COM13
python -m lerobot.setup_motors --robot.type=so101_leader --robot.port=COM14

Machine Learning

Collecte de données :

Uploader les données vers le Hub HuggingFace :

https://huggingface.co/docs/lerobot/en/il_robots#dataset-upload 

huggingface-cli.exe upload gautz/so101_pick_red_18650_drop_black_box_test2_100ep ..\.cache\huggingface\lerobot\gautz\18650-test2-100ep\ --repo-type dataset

Entrainer un modèle sur un Dataset (sur IHA-QLIOVR-1, compte admin) :

cd ..\gauthier.hentz\lerobot\
conda activate lerobot
cd .\lerobot\
conda create -y -n lerobot python=3.10
conda activate lerobot
conda install ffmpeg -c conda-forge
ffmpeg -encoders
conda install ffmpeg=7.1.1 -c conda-forge
pip install av poetry-core 
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -e .
python lerobot/scripts/train.py --dataset.repo_id=gautz/18650-test2-100ep --policy.type=act --output_dir=outputs/train/act_so101_18650-test2-100ep --job_name=act_so101_18650-test2-100ep --policy.device=cuda --wandb.enable=false

Enregistrer un dataset d'évaluation d'un modèle à un checkpoint donné :

python -m lerobot.record  --robot.type=so101_follower --robot.port=/dev/ttyUSB0 --robot.cameras="{ top: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 4, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False

Uploader un modèle vers HuggingFace

https://github.com/huggingface/lerobot/?tab=readme-ov-file#add-a-pretrained-policy 

Historique du Terminal complet

wget "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" -outfile ".\Downloads\Miniconda3-latest-Windows-x86_64.exe"
cd .\github\lerobot\
conda create -y -n lerobot python=3.10
conda activate lerobot
conda install ffmpeg -c conda-forge
conda install ffmpeg=7.1.1 -c conda-forge
wsl --shutdown
pip install -e .
pip install -e ".[feetech]" # or "[dynamixel]" for example
python lerobot/find_port.py
python lerobot/find_cameras.py opencv 
python -m lerobot.setup_motors --robot.type=so101_follower --robot.port=COM13`
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM13 --robot.cameras="{ top: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 4, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False
python -m lerobot.calibrate     --teleop.type=so101_leader  --teleop.port=COM14 --teleop.id=leader_arm_fan1`
python -m lerobot.calibrate     --robot.type=so101_follower  --robot.port=COM13 --robot.id=follower_arm_fan1
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM13   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 640, height: 480, fps: 30},follower: {type: opencv, index_or_path: 2, width: 640, height: 480, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
python lerobot/find_cameras.py opencv 
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM13   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
pip install -e .
python lerobot/find_cameras.py opencv 
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM13   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM13 --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False
python lerobot/scripts/display_sys_info.py
python -m torch.utils.collect_env
python -c "import torch; print(torch.cuda.is_available())" && nvcc -V
python -c "import torch; print(torch.cuda.is_available())"
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM13 --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False --wandb.enable=false
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM13 --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False     --dataset.episode_time_s=10  --dataset.reset_time_s=10    --dataset.num_episodes=10
exit
cd .\github\lerobot\
conda activate lerobot
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM13 --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False     --dataset.episode_time_s=15  --dataset.reset_time_s=10    --dataset.num_episodes=10
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM13   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
exit
cd .\github\lerobot\
conda activate lerobot
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM13   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
python lerobot/find_port.py
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM15   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
python lerobot/find_cameras.py opencv 
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM15   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM15 --robot.cameras="{ top: {type: opencv, index_or_path: 1, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False     --dataset.episode_time_s=15  --dataset.reset_time_s=10    --dataset.num_episodes=10
python -m lerobot.record  --robot.type=so101_follower --robot.port=COM15 --robot.cameras="{ top: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30}}" --robot.id=follower_arm_fan1 --display_data=false --dataset.repo_id=gautz/eval_act_18650-test2-100ep --dataset.single_task="Pick red 18650 battery place black box" --policy.path=outputs/train/act_so101_18650-test2-100ep/checkpoints/last/pretrained_model --dataset.push_to_hub=False     --dataset.episode_time_s=15  --dataset.reset_time_s=10    --dataset.num_episodes=10
python -m lerobot.teleoperate   --robot.type=so101_follower   --robot.port=COM15   --robot.id=follower_arm_fan1   --robot.cameras="{ top: {type: opencv, index_or_path: 0, width: 800, height: 600, fps: 30},follower: {type: opencv, index_or_path: 2, width: 800, height: 600, fps: 30}}"   --teleop.type=so101_leader   --teleop.port=COM14   --teleop.id=leader_arm_fan1   --display_data=true
cd .\github\lerobot\
cd ..
cd .\.cache\
cd .\huggingface\ls
cd .\huggingface\lerobot\calibration\cd ..
cd .\huggingface\lerobot\
cd .\gautz\
cd ..
cd .\github\lerobot\
cd .\outputs\train\
cd .\act_so101_18650-test2-100ep\
cd .\checkpoints\

Migration dataset  v2.1 to v3

https://github.com/huggingface/lerobot/blob/main/docs/source/lerobot-dataset-v3.mdx#migrate-v21--v30 

Sources

https://wiki.seeedstudio.com/lerobot_so100m/ 

https://huggingface.co/spaces/lerobot/visualize_dataset?path=%2Fsebastiandavidlee%2Fbimanual-so101-handover-plushie%2Fepisode_40 

https://huggingface.co/blog/sherryxychen/train-act-on-so-101 

https://github.com/sherrychen1120/so101_bench 

https://www.linkedin.com/posts/sherryxychen_robotics-machinelearning-ai-ugcPost-7378831270207954944-WsI5?utm_source=share&utm_medium=member_desktop&rcm=ACoAAA1icaQBkYXRoM1Oslzrh8psuL0MmHpaT_4 

0 - Robotique et physical AI

Démo AICA YOLO Portes Ouvertes 2026

Mise en place

Après avoir récupéré le robot UR5e et l'armoire à roulettes qui contient le PC AICA :

Sur le teach panel du robot :

Sur le PC AICA :

Déroulement de la démo

Ce qu'on peut montrer en plus :

Ranger la démo

Si le programme AICA ne veut plus se stopper :

Programme YOLO avec UR5e

vérifier l'adresse IP du robot

schema: 2-0-6
dependencies:
  core: v5.1.0
on_start:
  load:
    - hardware: hardware
    - component: camera_streamer
components:
  yolo_executor:
    component: advanced_perception::object_detection::YoloExecutor
    display_name: YOLO Executor
    events:
      transitions:
        on_load:
          lifecycle:
            component: yolo_executor
            transition: configure
        on_configure:
          lifecycle:
            component: yolo_executor
            transition: activate
        on_activate:
          load:
            component: bounding_box_tracker
    parameters:
      model_file:
        value: /yolo-example-data/yolo12n.onnx
        type: string
      classes_file:
        value: /yolo-example-data/coco.yaml
        type: string
      object_class:
        value:
          - scissors
        type: string_array
      conf_threshold:
        value: 0.4
        type: double
      num_threads:
        value: 2
        type: int
    inputs:
      image: /camera_streamer/image
    outputs:
      detections: /yolo_executor/detections
  camera_streamer:
    component: core_vision_components::image_streaming::CameraStreamer
    display_name: Camera Streamer
    events:
      transitions:
        on_load:
          lifecycle:
            component: camera_streamer
            transition: configure
        on_configure:
          lifecycle:
            component: camera_streamer
            transition: activate
        on_activate:
          load:
            component: yolo_executor
    parameters:
      camera_frame:
        value: tool0
        type: string
    outputs:
      image: /camera_streamer/image
  bounding_box_tracker:
    component: object_detection_utils::BoundingBoxTracker
    display_name: Bounding box tracker
    events:
      transitions:
        on_load:
          lifecycle:
            component: bounding_box_tracker
            transition: configure
        on_configure:
          lifecycle:
            component: bounding_box_tracker
            transition: activate
    parameters:
      rate:
        value: 500
        type: double
    inputs:
      detections: /yolo_executor/detections
    outputs:
      twist: /yolo_to_marker/twist
hardware:
  hardware:
    display_name: Hardware Interface
    urdf: Universal Robots 5e
    rate: 500
    events:
      transitions:
        on_load:
          load:
            - controller: robot_state_broadcaster
              hardware: hardware
            - controller: joint_trajectory_controller
              hardware: hardware
            - controller: ur_dashboard_controller
              hardware: hardware
            - controller: ik_velocity_controller
              hardware: hardware
    parameters:
      headless_mode: "true"
      robot_ip: 192.168.0.10
      script_filename: /ws/install/ur_client_library/share/ur_client_library/resources/external_control.urscript
    controllers:
      robot_state_broadcaster:
        plugin: aica_core_controllers/RobotStateBroadcaster
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: robot_state_broadcaster
      joint_trajectory_controller:
        plugin: aica_core_controllers/trajectory/JointTrajectoryController
        events:
          predicates:
            has_trajectory_succeeded:
              call_service:
                controller: ur_dashboard_controller
                hardware: hardware
                service: hand_back_control
          transitions:
            on_activate:
              sequence:
                start: sequence
      ur_dashboard_controller:
        plugin: aica_ur_controllers/URDashboardController
        events:
          predicates:
            program_running:
              switch_controllers:
                hardware: hardware
                activate: joint_trajectory_controller
            hand_back_control_success:
              application: stop
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: ur_dashboard_controller
      ik_velocity_controller:
        plugin: aica_core_controllers/velocity/IKVelocityController
        inputs:
          command: /yolo_to_marker/twist
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: ik_velocity_controller
graph:
  positions:
    on_start:
      x: -20
      y: -360
    stop:
      x: -20
      y: -260
    components:
      yolo_executor:
        x: 740
        y: -180
      camera_streamer:
        x: 200
        y: -300
      bounding_box_tracker:
        x: 1400
        y: 180
    hardware:
      hardware:
        x: 1940
        y: -360
  edges:
    yolo_to_marker_marker_pose_signal_point_attractor_attractor:
      path:
        - x: 1360
          y: 520
        - x: 1360
          y: 680
    yolo_executor_detections_yolo_to_marker_json_input:
      path:
        - x: 1160
          y: 120
        - x: 1160
          y: 220
        - x: 860
          y: 220
        - x: 860
          y: 520
    yolo_to_marker_twist_hardware_hardware_ik_velocity_controller_command:
      path:
        - x: 1820
          y: 380
        - x: 1820
          y: 420
    yolo_executor_detections_yolo_to_marker_detections:
      path:
        - x: 1200
          y: 120
        - x: 1200
          y: 380
    on_start_on_start_camera_streamer_camera_streamer:
      path:
        - x: 140
          y: -300
        - x: 140
          y: -240
    yolo_executor_on_activate_bounding_box_tracker_bounding_box_tracker:
      path:
        - x: 1300
          y: 0
        - x: 1300
          y: 240
    hardware_hardware_joint_trajectory_controller_has_trajectory_succeeded_hardware_hardware_ur_dashboard_controller_hand_back_control:
      path:
        - x: 1920
          y: 400
        - x: 1920
          y: 900
    hardware_hardware_ur_dashboard_controller_program_running_hardware_hardware_joint_trajectory_controller:
      path:
        - x: 1920
          y: 820
        - x: 1920
          y: 240
    hardware_hardware_ur_dashboard_controller_hand_back_control_success_on_stop_on_stop:
      path:
        - x: -40
          y: 780
        - x: -40
          y: -200
    camera_streamer_image_yolo_executor_image:
      path:
        - x: 640
          y: -40
        - x: 640
          y: 120
    yolo_executor_detections_bounding_box_tracker_detections:
      path:
        - x: 1220
          y: 120
        - x: 1220
          y: 400
    bounding_box_tracker_twist_hardware_hardware_ik_velocity_controller_command:
      path:
        - x: 1860
          y: 400
        - x: 1860
          y: 1120

Programme UR5e avec YOLO et Bounding Box

schema: 2-0-6
dependencies:
  core: v4.0.0
frames:
  start:
    reference_frame: world
    position:
      x: 0.016268
      y: 0.460877
      z: 0.574409
    orientation:
      w: 0.000502
      x: 0.999979
      y: -0.005594
      z: -0.003165
on_start:
  load:
    - component: frame_broadcaster
    - hardware: hardware
  sequence:
    start: sequence
sequences:
  sequence:
    display_name: Sequence
    steps:
      - check:
          condition:
            controller: joint_trajectory_controller
            hardware: hardware
            predicate: has_trajectory_succeeded
          wait_forever: true
      - call_service:
          controller: ur_dashboard_controller
          hardware: hardware
          service: zero_ftsensor
      - check:
          condition:
            controller: ur_dashboard_controller
            hardware: hardware
            predicate: zero_ftsensor_success
          wait_forever: true
      - switch_controllers:
          hardware: hardware
          deactivate: joint_trajectory_controller
components:
  frame_broadcaster:
    component: aica_core_components::ros::StaticFrameBroadcaster
    display_name: Frame Broadcaster
    parameters:
      frame:
        value: camera_link
        type: string
      reference_frame:
        value: ur_tool0
        type: string
      pose_values:
        value:
          - -0.02
          - -0.11752
          - 0.032
          - 1
          - 0
          - 0
          - 0
        type: double_array
      broadcast_periodically:
        value: true
        type: bool
  yolo_executor:
    component: advanced_perception::object_detection::YoloExecutor
    display_name: YOLO Executor
    events:
      transitions:
        on_load:
          lifecycle:
            component: yolo_executor
            transition: configure
        on_configure:
          lifecycle:
            component: yolo_executor
            transition: activate
        on_activate:
          load:
            component: bounding_box_tracker
    parameters:
      rate:
        value: 30
        type: double
      model_file:
        value: /data/models/yolo12n.onnx
        type: string
      classes_file:
        value: /data/models/coco.yaml
        type: string
      object_class:
        value:
          - scissors
        type: string_array
      conf_threshold:
        value: 0.4
        type: double
    inputs:
      image: /camera_streamer/image
    outputs:
      detections: /yolo_executor/detections
  bounding_box_tracker:
    component: object_detection_utils::BoundingBoxTracker
    display_name: Bounding box tracker
    events:
      transitions:
        on_load:
          lifecycle:
            component: bounding_box_tracker
            transition: configure
        on_configure:
          lifecycle:
            component: bounding_box_tracker
            transition: activate
    parameters:
      rate:
        value: 100
        type: double
      gains:
        value:
          - 0.008
          - 0.008
        type: double_array
      decay_rate:
        value: 8
        type: double
      reference_frame:
        value: world
        type: string
    inputs:
      detections: /yolo_executor/detections
    outputs:
      twist: /bounding_box_tracker/twist
  box_collider:
    component: aica_core_components::utility::BoxCollider
    display_name: Box Collider
    events:
      predicates:
        is_out_of_bounds:
          set:
            parameter: gains
            value:
              - 0
              - 0
            type: double_array
            component: bounding_box_tracker
        is_in_bounds:
          set:
            parameter: gains
            value:
              - 0.008
              - 0.008
            type: double_array
            component: bounding_box_tracker
      transitions:
        on_load:
          lifecycle:
            component: box_collider
            transition: configure
        on_configure:
          lifecycle:
            component: box_collider
            transition: activate
    parameters:
      x_size:
        value: 0.8
        type: double
      y_size:
        value: 0.3
        type: double
      z_size:
        value: 0.5
        type: double
    inputs:
      target: /hardware/robot_state_broadcaster/cartesian_state
      center: /frame_to_signal/pose
  frame_to_signal:
    component: aica_core_components::ros::TfToSignal
    display_name: Frame to Signal
    events:
      transitions:
        on_load:
          lifecycle:
            component: frame_to_signal
            transition: configure
        on_configure:
          lifecycle:
            component: frame_to_signal
            transition: activate
        on_activate:
          load:
            component: box_collider
    parameters:
      frame:
        value: start
        type: string
    outputs:
      pose: /frame_to_signal/pose
  camera_streamer:
    component: core_vision_components::image_streaming::CameraStreamer
    display_name: Camera Streamer
    events:
      transitions:
        on_load:
          load:
            - component: yolo_executor
            - component: frame_to_signal
          lifecycle:
            component: camera_streamer
            transition: configure
        on_configure:
          lifecycle:
            component: camera_streamer
            transition: activate
    outputs:
      image: /camera_streamer/image
hardware:
  hardware:
    display_name: Hardware Interface
    urdf: Universal Robots 5e
    rate: 500
    events:
      transitions:
        on_load:
          load:
            - controller: robot_state_broadcaster
              hardware: hardware
            - controller: joint_trajectory_controller
              hardware: hardware
            - controller: ur_impedance_controller
              hardware: hardware
            - controller: ur_dashboard_controller
              hardware: hardware
    parameters:
      robot_ip: 192.168.56.101
    controllers:
      ur_dashboard_controller:
        plugin: aica_ur_controllers/URDashboardController
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: ur_dashboard_controller
      joint_trajectory_controller:
        plugin: aica_core_controllers/trajectory/JointTrajectoryController
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: joint_trajectory_controller
            on_deactivate:
              load:
                component: camera_streamer
              switch_controllers:
                hardware: hardware
                activate: ur_impedance_controller
            on_activate:
              call_service:
                controller: joint_trajectory_controller
                hardware: hardware
                service: set_trajectory
                payload: |-
                  frames:
                    - start
                  durations:
                    - 2.0
      robot_state_broadcaster:
        plugin: aica_core_controllers/RobotStateBroadcaster
        outputs:
          cartesian_state: /hardware/robot_state_broadcaster/cartesian_state
          ft_sensor: /hardware/robot_state_broadcaster/ft_sensor
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: robot_state_broadcaster
      ur_impedance_controller:
        plugin: aica_ur_controllers/URImpedanceController
        parameters:
          selection_vector:
            value:
              - 1
              - 1
              - 1
              - 0
              - 0
              - 1
            type: int_array
          force_limit:
            value:
              - 40
              - 40
              - 40
              - 30
              - 30
              - 30
            type: vector
          stiffness:
            value:
              - 500
              - 500
              - 500
              - 400
              - 400
              - 400
            type: vector
          damping:
            value:
              - 50
              - 50
              - 50
              - 10
              - 10
              - 10
            type: vector
        inputs:
          command: /bounding_box_tracker/twist
graph:
  positions:
    on_start:
      x: -740
      y: -360
    stop:
      x: -740
      y: -260
    components:
      frame_broadcaster:
        x: -420
        y: -580
      yolo_executor:
        x: 760
        y: 480
      bounding_box_tracker:
        x: 1300
        y: 600
      box_collider:
        x: 840
        y: 1020
      frame_to_signal:
        x: 280
        y: 1140
      camera_streamer:
        x: 180
        y: 520
    hardware:
      hardware:
        x: 1880
        y: -360
    sequences:
      sequence:
        x: -420
        y: -280
  edges:
    yolo_to_marker_marker_pose_signal_point_attractor_attractor:
      path:
        - x: 1360
          y: 520
        - x: 1360
          y: 680
    yolo_executor_detections_yolo_to_marker_json_input:
      path:
        - x: 1160
          y: 120
        - x: 1160
          y: 220
        - x: 860
          y: 220
        - x: 860
          y: 520
    yolo_to_marker_twist_hardware_hardware_ik_velocity_controller_command:
      path:
        - x: 1740
          y: 680
        - x: 1740
          y: 920
    yolo_to_marker_twist_hardware_hardware_velocity_impedance_controller_command:
      path:
        - x: 1740
          y: 680
        - x: 1740
          y: 920
    hardware_hardware_robot_state_broadcaster_ft_sensor_hardware_hardware_velocity_impedance_controller_ft_sensor:
      path:
        - x: 1840
          y: 700
        - x: 1840
          y: 960
    hardware_hardware_ur_dashboard_controller_zero_ftsensor_success_sequence_sequence_condition_input_2:
      path:
        - x: -60
          y: 80
    yolo_to_marker_on_activate_hardware_hardware_ur_impedance_controller:
      path:
        - x: 1840
          y: 700
        - x: 1840
          y: 1060
    yolo_to_marker_twist_hardware_hardware_ur_impedance_controller_command:
      path:
        - x: 1740
          y: 780
        - x: 1740
          y: 1220
    orbbec_camera_on_load_yolo_executor_yolo_executor:
      path:
        - x: 680
          y: 620
        - x: 680
          y: 540
    orbbec_camera_on_load_frame_to_signal_frame_to_signal:
      path:
        - x: 680
          y: 620
        - x: 680
          y: 1020
        - x: 240
          y: 1020
        - x: 240
          y: 1200
    orbbec_camera_color_image_yolo_executor_image:
      path:
        - x: 640
          y: 700
        - x: 640
          y: 780
    on_start_on_start_frame_broadcaster_frame_broadcaster:
      path:
        - x: -540
          y: -300
        - x: -540
          y: -520
    on_start_on_start_sequence_sequence:
      path:
        - x: -540
          y: -300
        - x: -540
          y: -220
    hardware_joint_trajectory_controller_has_trajectory_succeeded_condition_sequence_sequence_condition_input_0:
      path:
        - x: -380
          y: 440
    sequence_sequence_event_trigger_1_hardware_hardware_ur_dashboard_controller_zero_ftsensor:
      path:
        - x: -220
          y: 140
    hardware_ur_dashboard_controller_zero_ftsensor_success_condition_sequence_sequence_condition_input_2:
      path:
        - x: -60
          y: 60
    sequence_sequence_event_trigger_3_hardware_hardware_joint_trajectory_controller:
      path:
        - x: 100
          y: 200
    box_collider_is_out_of_bounds_bounding_box_tracker_bounding_box_tracker:
      path:
        - x: 1400
          y: 1280
        - x: 1400
          y: 1000
        - x: 1280
          y: 1000
        - x: 1280
          y: 660
    box_collider_is_in_bounds_bounding_box_tracker_bounding_box_tracker:
      path:
        - x: 1360
          y: 1240
        - x: 1360
          y: 1040
        - x: 1260
          y: 1040
        - x: 1260
          y: 660
    frame_to_signal_on_activate_box_collider_box_collider:
      path:
        - x: 800
          y: 1320
        - x: 800
          y: 1080
    camera_streamer_on_load_yolo_executor_yolo_executor:
      path:
        - x: 620
          y: 700
        - x: 620
          y: 540
    camera_streamer_on_load_frame_to_signal_frame_to_signal:
      path:
        - x: 620
          y: 700
        - x: 620
          y: 1060
        - x: 260
          y: 1060
        - x: 260
          y: 1200
    hardware_hardware_joint_trajectory_controller_on_deactivate_camera_streamer_camera_streamer:
      path:
        - x: 100
          y: 360
        - x: 100
          y: 580
    hardware_hardware_joint_trajectory_controller_on_deactivate_hardware_hardware_ur_impedance_controller:
      path:
        - x: 1820
          y: 360
        - x: 1820
          y: 1040
    hardware_hardware_joint_trajectory_controller_on_activate_hardware_hardware_joint_trajectory_controller_set_trajectory:
      path:
        - x: 1800
          y: 320
        - x: 1800
          y: 520
    yolo_executor_detections_bounding_box_tracker_detections:
      path:
        - x: 1240
          y: 780
        - x: 1240
          y: 820
    bounding_box_tracker_twist_hardware_hardware_ur_impedance_controller_command:
      path:
        - x: 1760
          y: 820
        - x: 1760
          y: 1200
    hardware_hardware_robot_state_broadcaster_cartesian_state_box_collider_target:
      path:
        - x: 740
          y: 940
        - x: 740
          y: 1360

Programme UR5e avec Point Attractor et Bounding Box

schema: 2-0-6
dependencies:
  core: v4.0.0
frames:
  start:
    reference_frame: world
    position:
      x: 0.016268
      y: 0.460877
      z: 0.574409
    orientation:
      w: 0.000502
      x: 0.999979
      y: -0.005594
      z: -0.003165
on_start:
  load:
    - component: frame_broadcaster
    - hardware: hardware
  sequence:
    start: sequence
sequences:
  sequence:
    display_name: Sequence
    steps:
      - check:
          condition:
            controller: joint_trajectory_controller
            hardware: hardware
            predicate: has_trajectory_succeeded
          wait_forever: true
      - call_service:
          controller: ur_dashboard_controller
          hardware: hardware
          service: zero_ftsensor
      - check:
          condition:
            controller: ur_dashboard_controller
            hardware: hardware
            predicate: zero_ftsensor_success
          wait_forever: true
      - switch_controllers:
          hardware: hardware
          deactivate: joint_trajectory_controller
components:
  frame_broadcaster:
    component: aica_core_components::ros::StaticFrameBroadcaster
    display_name: Frame Broadcaster
    parameters:
      frame:
        value: camera_link
        type: string
      reference_frame:
        value: ur_tool0
        type: string
      pose_values:
        value:
          - -0.02
          - -0.11752
          - 0.032
          - 1
          - 0
          - 0
          - 0
        type: double_array
      broadcast_periodically:
        value: true
        type: bool
  yolo_executor:
    component: advanced_perception::object_detection::YoloExecutor
    display_name: YOLO Executor
    events:
      transitions:
        on_load:
          lifecycle:
            component: yolo_executor
            transition: configure
        on_configure:
          lifecycle:
            component: yolo_executor
            transition: activate
        on_activate:
          load:
            component: bounding_box_tracker
    parameters:
      rate:
        value: 30
        type: double
      model_file:
        value: /data/models/yolo12n.onnx
        type: string
      classes_file:
        value: /data/models/coco.yaml
        type: string
      object_class:
        value:
          - scissors
        type: string_array
      conf_threshold:
        value: 0.4
        type: double
    inputs:
      image: /camera_streamer/image
    outputs:
      detections: /yolo_executor/detections
  bounding_box_tracker:
    component: object_detection_utils::BoundingBoxTracker
    display_name: Bounding box tracker
    events:
      transitions:
        on_load:
          lifecycle:
            component: bounding_box_tracker
            transition: configure
        on_configure:
          lifecycle:
            component: bounding_box_tracker
            transition: activate
    parameters:
      rate:
        value: 100
        type: double
      gains:
        value:
          - 0.008
          - 0.008
        type: double_array
      decay_rate:
        value: 8
        type: double
      reference_frame:
        value: world
        type: string
    inputs:
      detections: /yolo_executor/detections
    outputs:
      twist: /bounding_box_tracker/twist
  box_collider:
    component: aica_core_components::utility::BoxCollider
    display_name: Box Collider
    events:
      predicates:
        is_out_of_bounds:
          set:
            parameter: gains
            value:
              - 0
              - 0
            type: double_array
            component: bounding_box_tracker
        is_in_bounds:
          set:
            parameter: gains
            value:
              - 0.008
              - 0.008
            type: double_array
            component: bounding_box_tracker
      transitions:
        on_load:
          lifecycle:
            component: box_collider
            transition: configure
        on_configure:
          lifecycle:
            component: box_collider
            transition: activate
    parameters:
      x_size:
        value: 0.8
        type: double
      y_size:
        value: 0.3
        type: double
      z_size:
        value: 0.5
        type: double
    inputs:
      target: /hardware/robot_state_broadcaster/cartesian_state
      center: /frame_to_signal/pose
  frame_to_signal:
    component: aica_core_components::ros::TfToSignal
    display_name: Frame to Signal
    events:
      transitions:
        on_load:
          lifecycle:
            component: frame_to_signal
            transition: configure
        on_configure:
          lifecycle:
            component: frame_to_signal
            transition: activate
        on_activate:
          load:
            component: box_collider
    parameters:
      frame:
        value: start
        type: string
    outputs:
      pose: /frame_to_signal/pose
  camera_streamer:
    component: core_vision_components::image_streaming::CameraStreamer
    display_name: Camera Streamer
    events:
      transitions:
        on_load:
          load:
            - component: yolo_executor
            - component: frame_to_signal
          lifecycle:
            component: camera_streamer
            transition: configure
        on_configure:
          lifecycle:
            component: camera_streamer
            transition: activate
    outputs:
      image: /camera_streamer/image
hardware:
  hardware:
    display_name: Hardware Interface
    urdf: Universal Robots 5e
    rate: 500
    events:
      transitions:
        on_load:
          load:
            - controller: robot_state_broadcaster
              hardware: hardware
            - controller: joint_trajectory_controller
              hardware: hardware
            - controller: ur_impedance_controller
              hardware: hardware
            - controller: ur_dashboard_controller
              hardware: hardware
    parameters:
      robot_ip: 192.168.56.101
    controllers:
      ur_dashboard_controller:
        plugin: aica_ur_controllers/URDashboardController
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: ur_dashboard_controller
      joint_trajectory_controller:
        plugin: aica_core_controllers/trajectory/JointTrajectoryController
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: joint_trajectory_controller
            on_deactivate:
              load:
                component: camera_streamer
              switch_controllers:
                hardware: hardware
                activate: ur_impedance_controller
            on_activate:
              call_service:
                controller: joint_trajectory_controller
                hardware: hardware
                service: set_trajectory
                payload: |-
                  frames:
                    - start
                  durations:
                    - 2.0
      robot_state_broadcaster:
        plugin: aica_core_controllers/RobotStateBroadcaster
        outputs:
          cartesian_state: /hardware/robot_state_broadcaster/cartesian_state
          ft_sensor: /hardware/robot_state_broadcaster/ft_sensor
        events:
          transitions:
            on_load:
              switch_controllers:
                hardware: hardware
                activate: robot_state_broadcaster
      ur_impedance_controller:
        plugin: aica_ur_controllers/URImpedanceController
        parameters:
          selection_vector:
            value:
              - 1
              - 1
              - 1
              - 0
              - 0
              - 1
            type: int_array
          force_limit:
            value:
              - 40
              - 40
              - 40
              - 30
              - 30
              - 30
            type: vector
          stiffness:
            value:
              - 500
              - 500
              - 500
              - 400
              - 400
              - 400
            type: vector
          damping:
            value:
              - 50
              - 50
              - 50
              - 10
              - 10
              - 10
            type: vector
        inputs:
          command: /bounding_box_tracker/twist
graph:
  positions:
    on_start:
      x: -740
      y: -360
    stop:
      x: -740
      y: -260
    components:
      frame_broadcaster:
        x: -420
        y: -580
      yolo_executor:
        x: 760
        y: 480
      bounding_box_tracker:
        x: 1300
        y: 600
      box_collider:
        x: 840
        y: 1020
      frame_to_signal:
        x: 280
        y: 1140
      camera_streamer:
        x: 180
        y: 520
    hardware:
      hardware:
        x: 1880
        y: -360
    sequences:
      sequence:
        x: -420
        y: -280
  edges:
    yolo_to_marker_marker_pose_signal_point_attractor_attractor:
      path:
        - x: 1360
          y: 520
        - x: 1360
          y: 680
    yolo_executor_detections_yolo_to_marker_json_input:
      path:
        - x: 1160
          y: 120
        - x: 1160
          y: 220
        - x: 860
          y: 220
        - x: 860
          y: 520
    yolo_to_marker_twist_hardware_hardware_ik_velocity_controller_command:
      path:
        - x: 1740
          y: 680
        - x: 1740
          y: 920
    yolo_to_marker_twist_hardware_hardware_velocity_impedance_controller_command:
      path:
        - x: 1740
          y: 680
        - x: 1740
          y: 920
    hardware_hardware_robot_state_broadcaster_ft_sensor_hardware_hardware_velocity_impedance_controller_ft_sensor:
      path:
        - x: 1840
          y: 700
        - x: 1840
          y: 960
    hardware_hardware_ur_dashboard_controller_zero_ftsensor_success_sequence_sequence_condition_input_2:
      path:
        - x: -60
          y: 80
    yolo_to_marker_on_activate_hardware_hardware_ur_impedance_controller:
      path:
        - x: 1840
          y: 700
        - x: 1840
          y: 1060
    yolo_to_marker_twist_hardware_hardware_ur_impedance_controller_command:
      path:
        - x: 1740
          y: 780
        - x: 1740
          y: 1220
    orbbec_camera_on_load_yolo_executor_yolo_executor:
      path:
        - x: 680
          y: 620
        - x: 680
          y: 540
    orbbec_camera_on_load_frame_to_signal_frame_to_signal:
      path:
        - x: 680
          y: 620
        - x: 680
          y: 1020
        - x: 240
          y: 1020
        - x: 240
          y: 1200
    orbbec_camera_color_image_yolo_executor_image:
      path:
        - x: 640
          y: 700
        - x: 640
          y: 780
    on_start_on_start_frame_broadcaster_frame_broadcaster:
      path:
        - x: -540
          y: -300
        - x: -540
          y: -520
    on_start_on_start_sequence_sequence:
      path:
        - x: -540
          y: -300
        - x: -540
          y: -220
    hardware_joint_trajectory_controller_has_trajectory_succeeded_condition_sequence_sequence_condition_input_0:
      path:
        - x: -380
          y: 440
    sequence_sequence_event_trigger_1_hardware_hardware_ur_dashboard_controller_zero_ftsensor:
      path:
        - x: -220
          y: 140
    hardware_ur_dashboard_controller_zero_ftsensor_success_condition_sequence_sequence_condition_input_2:
      path:
        - x: -60
          y: 60
    sequence_sequence_event_trigger_3_hardware_hardware_joint_trajectory_controller:
      path:
        - x: 100
          y: 200
    box_collider_is_out_of_bounds_bounding_box_tracker_bounding_box_tracker:
      path:
        - x: 1400
          y: 1280
        - x: 1400
          y: 1000
        - x: 1280
          y: 1000
        - x: 1280
          y: 660
    box_collider_is_in_bounds_bounding_box_tracker_bounding_box_tracker:
      path:
        - x: 1360
          y: 1240
        - x: 1360
          y: 1040
        - x: 1260
          y: 1040
        - x: 1260
          y: 660
    frame_to_signal_on_activate_box_collider_box_collider:
      path:
        - x: 800
          y: 1320
        - x: 800
          y: 1080
    camera_streamer_on_load_yolo_executor_yolo_executor:
      path:
        - x: 620
          y: 700
        - x: 620
          y: 540
    camera_streamer_on_load_frame_to_signal_frame_to_signal:
      path:
        - x: 620
          y: 700
        - x: 620
          y: 1060
        - x: 260
          y: 1060
        - x: 260
          y: 1200
    hardware_hardware_joint_trajectory_controller_on_deactivate_camera_streamer_camera_streamer:
      path:
        - x: 100
          y: 360
        - x: 100
          y: 580
    hardware_hardware_joint_trajectory_controller_on_deactivate_hardware_hardware_ur_impedance_controller:
      path:
        - x: 1820
          y: 360
        - x: 1820
          y: 1040
    hardware_hardware_joint_trajectory_controller_on_activate_hardware_hardware_joint_trajectory_controller_set_trajectory:
      path:
        - x: 1800
          y: 320
        - x: 1800
          y: 520
    yolo_executor_detections_bounding_box_tracker_detections:
      path:
        - x: 1240
          y: 780
        - x: 1240
          y: 820
    bounding_box_tracker_twist_hardware_hardware_ur_impedance_controller_command:
      path:
        - x: 1760
          y: 820
        - x: 1760
          y: 1200
    hardware_hardware_robot_state_broadcaster_cartesian_state_box_collider_target:
      path:
        - x: 740
          y: 940
        - x: 740
          y: 1360
0 - Robotique et physical AI

Machine Learning LeRobot avec SO-ARM101 - Legacy

Essai de déploiement sur Windows via WSL2, Docker, et Dev Container

Pour l'instant pas de test satisfaisant pour l'exécution d'un modèle sur le vrai robot. Passer au WSL2 les ports USB où sont connectés les robots et caméras fait crasher le conteneur. Probablement que la communication série n'est pas supporté.

Tentatives pour faire passer le port série à WSL2 : 

wsl --shutdown
winget install --interactive --exact dorssel.usbipd-win
usbipd list
wmic diskdrive list brief
wsl --mount \\.\PHYSICALDRIVE1
wsl.exe --version
wsl --mount \\.\PHYSICALDRIVE1 --bare
wsl --mount \\.\PHYSICALDRIVE1 --partition 2 --type ext4
wsl --shutdown
ipconfig
net localgroup docker-users "gauthier.hentz" /ADD
wsl --set-default ubuntu
wsl --shutdown
usbipd list
usbipd bind --busid 1-1
usbipd list
usbipd attach --wsl --busid 1-1
usbipd attach --wsl --busid 2-1

 

Visualiser et rejouer des DataSets (avant hardware refactor)

python lerobot/scripts/visualize_dataset.py     --repo-id lerobot/pusht     --root ./my_local_data_dir     --local-files-only 1     --episode-index 0

python lerobot/scripts/visualize_dataset_html.py \
  --repo-id cadene/act_so100_5_lego_test_080000 \
  --local-files-only 1
python lerobot/scripts/control_robot.py \
  --robot.type=so101 \
  --control.type=replay \
  --control.fps=30 \
  --control.repo_id=cadene/act_so100_5_lego_test_080000 \
  --control.episode=0
python lerobot/scripts/control_robot.py \
  --robot.type=so101 \
  --control.type=record \
  --control.fps=30 \
  --control.single_task="Grasp a lego block and put it in the bin." \
  --control.repo_id=outputs/eval/act_so100_5_lego_test_080000_haguenau \
  --control.tags='["tutorial"]' \
  --control.warmup_time_s=5 \
  --control.episode_time_s=30 \
  --control.reset_time_s=30 \
  --control.num_episodes=10 \
  --control.push_to_hub=false \
  --control.policy.path=cadene/act_so100_5_lego_test_080000