Table des matières

Installation sur VGG

Installation ROS Kinetic

Setup your computer to accept software from packages.ros.org:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Set up your keys:

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

Installation:

sudo apt-get update

Recommended:

sudo apt-get install ros-kinetic-desktop-full

Other:

sudo apt-get install ros-kinetic-desktop
sudo apt-get install ros-kinetic-ros-base

To find available packages, use:

apt-cache search ros-kinetic

Init rosdep:

sudo rosdep init
rosdep update

Environement setup:

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Dependencies for building packages:

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

Create a ROS Workspace:

mkdir -p ~/catkin_ws
cd ~/catkin_ws
catkin_make

Source your new setup.*sh file:

source devel/setup.bash
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc (not sure)

Create your workspace (Non-admin users)

Before you begin, make sure that ROS Kinetic is properly installed on computer:

export | grep ROS
result.txt
declare -x ROSLISP_PACKAGE_DIRECTORIES="/home/tdedieu/catkin_ws/devel/share/common-lisp"
declare -x ROS_DISTRO="kinetic"
declare -x ROS_ETC_DIR="/opt/ros/kinetic/etc/ros"
declare -x ROS_MASTER_URI="http://localhost:11311"
declare -x ROS_PACKAGE_PATH="/home/tdedieu/catkin_ws/src:/opt/ros/kinetic/share"
declare -x ROS_ROOT="/opt/ros/kinetic/share/ros"
declare -x ROS_VERSION="1"

Environement setup:

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Create your Workspace:

mkdir -p ~/catkin_ws
cd ~/catkin_ws
mkdir src
catkin_make

Source your new setup.*sh file:

source devel/setup.bash
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc

Note: Last command allows to avoid making the previous command at each new open terminal.

Now you can do this to go directly to package folder:

roscd <mypackage>

Copy your ros package in src/:

cp -r <your_path>/<your_package> ~/catkim_ws/src/

Example:

cp -r ~/Documents/mypackage/ ~/catkin_ws/src/

Compile your packages:

catkin_make

Paquets pour python

sudo apt-get install python3-pip idle3 idle-python3.5  
sudo pip3 install matplotlib scipy

Pour l'affichage des legendes avec matplotlib:

 sudo apt-get install dvipng 

Driver ueye

mkdir -p ~/Download
cd ~/Download
wget https://bvdp.inetdoc.net/files/ueye/uEye-Linux-4.90.06-64.tgz
mkdir -p uEye-Linux-4.90.06-64
cd uEye-Linux-4.90.06-64
tar xvf ../uEye-Linux-4.90.06-64.tgz
sudo ./ueyesdk-setup-4.90.06-usb-amd64.gz.run
result.txt
  Reload and retrigger udev to apply uEye rules...
***************************************************************************
Successfully installed ueyeusbd. Start (as root) with:
     /etc/init.d/ueyeusbdrc start
 
If ueyeusbd hangs and does not terminate on rc 'stop' command,
run (as root)
     /etc/init.d/ueyeusbdrc force-stop
 
NOTE that the daemon refuses to terminate if there are clients connected!
To uninstall, run '/usr/local/share/ueye/bin/ueyed_install-usb uninstall'.
 
If a graphical desktop environment is available, one may use the
uEye Camera Manager to configure cameras and services. To start
it, type idscameramanager on the command line or in the graphical application
launcher. If idscameramanager shall be used for daemon configuration and service
control, it _must_ be started as root.

Démarrage du driver (utilisateur tdedieu autorisé via visudo):

sudo /etc/init.d/ueyeusbdrc start

Arrêt du driver (utilisateur tdedieu autorisé via visudo):

sudo /etc/init.d/ueyeusbdrc stop

Problème

Camera de la marque IDS, uEye SE USB 3.1 Gen 1 (Model: UI320xSE-M).

Free-run mode

Ueyedemo avec la configuration suivante:

image size: 4104x3006
subsampling: 1
binning:1
sensor_scaling: 1.0
pixel clock: 395 Mhz
exposure: 10 ms
framerate: 24,35 fps

Résultats:

fps: 24.35, failed:0

Ueye_cam avec la configuration suivante:

result.txt
  <param name="color_mode" type="str" value="rgb8" /> <!-- valid options: 'rgb8', 'mono8', 'bayer_rggb8' -->
 
  <param name="image_width" type="int" value="4104" />
  <param name="image_height" type="int" value="3006" />
 
  <param name="subsampling" type="int" value="1" /> <!-- supported by only some UEye cameras -->
  <param name="binning" type="int" value="1" /> <!-- supported by only some UEye cameras -->
  <param name="sensor_scaling" type="double" value="1.0" /> <!-- supported by only some UEye cameras -->
 
  <param name="auto_exposure" type="bool" value="False" />
  <param name="exposure" type="int" value="10" /> <!-- in ms -->
 
  <param name="auto_frame_rate" type="bool" value="False" />
  <param name="frame_rate" type="double" value="24.0" />
  <param name="pixel_clock" type="int" value="395" />

Commande:

rostopic hz /scene/image_raw
result.txt
average rate: 7.381
	min: 0.121s max: 0.147s std dev: 0.00565s window: 183
average rate: 7.376
	min: 0.121s max: 0.147s std dev: 0.00559s window: 190
average rate: 7.373
	min: 0.121s max: 0.147s std dev: 0.00559s window: 198
average rate: 7.369
	min: 0.121s max: 0.149s std dev: 0.00564s window: 200

Pourquoi les images par seconde (ips) ne sont pas environ égales (facteur < 2), alors que les paramètres sont les mêmes ? Il semble que se soit l'appelle à la fonction startFrameGrabber() dans le fichier ueye_cam_nodelet.cpp qui est trop lente. Le problème a été identifié, il s'agit de la fonction std::copy qui est exécuté en 0.25 secondes en moyenne. Dans un premier temps l'utilisation de la fonction memcpy a fait augmenter les ips jusqu'à 14 contre 7 avec std::copy. De plus, plusieurs copies de tampon d'image ralentissait l'exécution du programme. Ensuite pour éviter une nouvelle copie lors d'une souscrition à un topic (ici des images de 2048*2048 ou 4104*3006) nous utilisons un nodelet manager. Il permet l'utilisation de ressource mémoire commun a tous les nodelets qui dépendent du manager. Ce qui permet de ne pas faire une copie lorsqu'on souscrit à un topic publié dans le nodelet manager. Cette méthode est utilisé pour les flux vidéo et image de grandes tailles.

Remarques

Trigger-mode

Lorsque la configuration maître-escalves est mise en place. Il est important de savoir que les ips peuvent être réduite. Par exemple, au temps d'exposition maximum, la fréquence d'image est environ moitié moins élevée qu'en mode freerun.

De plus, pour ne pas perdre des images, il faut régler les paramètres en fonction de la caméra la plus lente pour qu'elle arrive à suivre.

Lorsque vous voulez visualiser les images des caméras:

roscore
rosrun image_view image_view image:=/<nom_topic>/image_raw (maître)
rosrun image_view image_view image:=/<nom_topic>/image_raw (esclave1)  
rosrun image_view image_view image:=/<nom_topic>/image_raw (esclave2)
...

Important: Lancez la visualisation du maître avant les esclaves.

Il est possible de faire également:

roslaunch ueye_cam view_me.launch (caméras gauche, droite et scène)
roslaunch ueye_cam view_stereo.launch (caméras gauche et droite)
roslaunch ueye_cam view_scene.launch (caméra scène)

Installation editeur atom

mkdir -p ~/Download
cd ~/Download
wget https://bvdp.inetdoc.net/files/ueye/atom-amd64.deb
sudo dpkg -i atom-amd64.deb

Installation AprilTag

https://april.eecs.umich.edu/software/apriltag.html

mkdir -p ~/Download
cd ~/Download
wget https://april.eecs.umich.edu/media/apriltag/apriltag-2016-12-01.tgz
tar -xvzf apriltag-2016-12-01.tgz
cd apriltag-2016-12-01
make -j4

Il y a des problèmes de droits d'accès, sudo n'a pas certains droits pour appliquer les règles du makefile

sudo make install

patch à mettre dans le dossier ~/Download/apriltag-2016-12-01

makefile_april.patch
--- Makefile	2018-07-02 10:32:59.653346000 +0200
+++ Makefile	2018-07-02 10:44:08.476560000 +0200
@@ -16,11 +16,13 @@
 	@$(MAKE) -C example all
 
 .PHONY: install
-install: libapriltag.so
+preinstall:
 	@chmod +x install.sh
+	@sed 's:^prefix=$$:prefix=$(PREFIX):' < apriltag.pc.in > apriltag.pc
+
+install: libapriltag.so
 	@./install.sh $(PREFIX)/lib libapriltag.so
 	@./install.sh $(PREFIX)/include/apriltag $(APRILTAG_HEADERS)
-	@sed 's:^prefix=$$:prefix=$(PREFIX):' < apriltag.pc.in > apriltag.pc
 	@./install.sh $(PREFIX)/lib/pkgconfig apriltag.pc
 	@rm apriltag.pc
 	@ldconfig

la règle d'install a été coupée en 2, preinstall à faire par l'utilisateur, et install à faire par sudo

wget https://bvdp.inetdoc.net/files/ueye/makefile_april.patch
patch Makefile <makefile_april.patch
make preinstall
sudo make install

Utilisation Ros de Thomas

compilation de tous les noeuds

cd /home/tdedieu/catkin_ws/
catkin_make

noeud camera:

roscd ueye_cam/

pour banc stereo + camera scene

roslaunch ueye_cam master_slaves_tdedieu.launch

ou pour camera scene seule

roslaunch ueye_cam master_slaves_rgb8.launch
rostopic list
listtopic.txt
/rosout
/rosout_agg
/scene/camera_info
/scene/image_raw
/scene/image_raw/compressed
/scene/image_raw/compressed/parameter_descriptions
/scene/image_raw/compressed/parameter_updates
/scene/image_raw/compressedDepth
/scene/image_raw/compressedDepth/parameter_descriptions
/scene/image_raw/compressedDepth/parameter_updates
/scene/image_raw/theora
/scene/image_raw/theora/parameter_descriptions
/scene/image_raw/theora/parameter_updates
/stereo/left/camera_info
/stereo/left/image_raw
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressed/parameter_descriptions
/stereo/left/image_raw/compressed/parameter_updates
/stereo/left/image_raw/compressedDepth
/stereo/left/image_raw/compressedDepth/parameter_descriptions
/stereo/left/image_raw/compressedDepth/parameter_updates
/stereo/left/image_raw/theora
/stereo/left/image_raw/theora/parameter_descriptions
/stereo/left/image_raw/theora/parameter_updates
/stereo/right/camera_info
/stereo/right/image_raw
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressed/parameter_descriptions
/stereo/right/image_raw/compressed/parameter_updates
/stereo/right/image_raw/compressedDepth
/stereo/right/image_raw/compressedDepth/parameter_descriptions
/stereo/right/image_raw/compressedDepth/parameter_updates
/stereo/right/image_raw/theora
/stereo/right/image_raw/theora/parameter_descriptions
/stereo/right/image_raw/theora/parameter_updates
/ueye_cam_nodelet_left/parameter_descriptions
/ueye_cam_nodelet_left/parameter_updates
/ueye_cam_nodelet_right/parameter_descriptions
/ueye_cam_nodelet_right/parameter_updates
/ueye_cam_nodelet_scene/parameter_descriptions
/ueye_cam_nodelet_scene/parameter_updates

pour visualiser /scene/image_raw

roslaunch ueye_cam view_scene.launch 
roslaunch ueye_cam view_stereo.launch  
roslaunch ueye_cam view_me.launch 

roscd eye_tracker/ pwd

/home/tdedieu/catkin_ws/src/eye_tracker
roslaunch eye_tracker eye_tracker_dedieu_stereo.launch 

cd src/

atom eye_tracker_nodelet.cpp &

eye_tracker echoue si image trop sombre: augmenter la duree d'exposition et/ou baisser le frame rate dans le script launch:

master_slaves_tdedieu.launch
  <param name="exposure" type="double" value="100.0" />
<param name="frame_rate" type="double" value="30.0" /> <!-- frame rate settings are ignored in camera_ext_trigger_mode -->

pour visualiser les ellipses extraites

 roslaunch eye_tracker view_pupils.launch

pour detection des tags:

roslaunch camera_scene_detection scene.launch

roscd camera_scene_detection/

cd src/  
atom camera_scene_detection_nodelet.cpp &

noeud optimisation stereo: (dans le paquet eye_tracker) eye_tracker →MainTriangulatePupils les messages pupilles sont connus grace a import pupil2D as p2d definis dans /home/tdedieu/catkin_ws/src/eye_tracker/msg/Pupil_2D.msg

actuellement le noeuds attend 1 message par camera →probleme de synchro → il faudra faire un nodelets qui recupere les pixels candidats pour les 2 cameras et les met dans un seul message.

roslaunch eye_tracker eye_tracker_dedieu_stereo.launch 

et

roslaunch eye_tracker tri_eye_tracker_stereo.launch

pour la synchronisation des messages:

ajouter en sudo nano /opt/ros/kinetic/lib/python2.7/dist-packages/message_filters/__init__.py
__init__.py
"""
Message Filter Objects
======================
"""
 
 
from functools import reduce

catkin

workspace dans /mnt/share/catkin_ws/ mais envv | grep catkin

ROS_PACKAGE_PATH=/opt/ros/kinetic/share:/home/bvandepo/catkin_ws/
LD_LIBRARY_PATH=/home/bvandepo/catkin_ws/devel/lib:/opt/ros/hydro/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/home/bvandepo/openrobots/lib/gearbox
CATKIN_TEST_RESULTS_DIR=/home/bvandepo/catkin_ws/build/test_results
CPATH=/home/bvandepo/catkin_ws/devel/include:/opt/ros/hydro/include
ROS_TEST_RESULTS_DIR=/home/bvandepo/catkin_ws/build/test_results
PATH=/home/bvandepo/catkin_ws/devel/bin:/opt/ros/hydro/bin:/usr/local/matlab/bin:/home/bvandepo/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:.:/usr/local/X11_Contrib/bin/unknown:/home/bvandepo/scripts/:/home/bvandepo/openrobots/bin:/home/bvandepo/scripts
PYTHONPATH=/home/bvandepo/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/hydro/lib/python2.7/dist-packages
PKG_CONFIG_PATH=/home/bvandepo/catkin_ws/devel/lib/pkgconfig:/opt/ros/hydro/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig
CMAKE_PREFIX_PATH=/home/bvandepo/catkin_ws/devel:/opt/ros/hydro

Il faut faire overlay http://wiki.ros.org/catkin/Tutorials/workspace_overlaying