Outils pour utilisateurs

Outils du site


rosueyesvo

Installation ROS

d'après: http://wiki.ros.org/indigo/Installation/Ubuntu

ROS Indigo ONLY supports Saucy (13.10) and Trusty (14.04) for debian packages.

mais d'apres: http://answers.ros.org/question/189033/can-you-run-indigo-on-ubuntu-1204/ on peut installer indigo sur 12.04

Prérequis OPENCV

sudo add-apt-repository ppa:gezakovacs/lz4
sudo apt-get update
sudo apt-get install liblz4-dev liblz4-tool liblz4-0.0
wget http://skylink.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip 
cd opencv-2.4.9/
mkdir build
cd build/
cmake  ..

ou pour des machines du LAAS pour specifier un dossier d installation sur lequel sudo a les droits, A TESTER!!!!

cmake -D CMAKE_INSTALL_PREFIX=/local/opencv  ../

puis

make -j8
sudo make install
sudo ldconfig
  bug compile opencv
  [ 82%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/rgbdodometry.cpp.o
  /home/bvandepo/installros/opencv-2.4.9/modules/contrib/src/rgbdodometry.cpp:65:47: erreur fatale: unsupported/Eigen/MatrixFunctions :   Aucun fichier ou dossier de ce type
 

modification de /home/bvandepo/installros/opencv-2.4.9/modules/contrib/src/rgbdodometry.cpp , ajouter à la ligne 59

#define EIGEN_WORLD_VERSION 1

le sudo make install foire car il veut ecrire en tant que sudo sur des fichiers qui sont stockés sur le réseau… je déplace en locale sur la machine et crée un lien symbolique

cd /local/users/bvandepo
mv ~/installros/ ./
ln -s /local/users/bvandepo/installros ~/installros

ROS Hydro

http://wiki.ros.org/indigo/Installation/Ubuntu

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

ca vire la version fuerte et installe hydro

apt-cache search ros-hydro
rosdep update
sudo rosdep init
bash
echo "source /opt/ros/hydro/setup.bash" >> ~/.bashrc
source ~/.bashrc

####IL FAUT LE METTRE A LA FIN DU .bashrc!!!!!

sudo apt-get install python-rosinstall

liste des paquets ROS dispo sur: http://www.ros.org/debbuild/hydro.html

http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment

printenv | grep ROS
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws/
catkin_make
source devel/setup.bash
echo $ROS_PACKAGE_PATH

http://wiki.ros.org/ROS/Tutorials/NavigatingTheFilesystem

sudo apt-get install ros-hydro-ros-tutorials

pour avoir la version

rosversion -d
apt-cache search ros-hydro | grep -i ueye
sudo apt-get install ros-hydro-ueye ros-hydro-ueye-cam
roscore

Ueye

Installation pilote ueye:

wget https://fr.ids-imaging.com/download-ueye-lin32.html?file=tl_files/downloads/uEye_SDK/driver/uEye_Linux_4.61_32_Bit.tgz

desinstall ancienne version:

sudo /usr/local/share/ueye/bin/ueyed_install-usb uninstall 

install nouvelle:

sudo sh ./ueyesdk-setup-4.61-usb-i686.gz.run

noeud ueye: http://wiki.ros.org/ueye_cam#

This package has been tested with the Software Package for USB and GigE uEye Cameras Version 4.20 64 Bit for Linux, on Ubuntu 12.04 x64 & Ubuntu 13.04 x64, operating with UEye UI122xLE-C USB 2.0 cameras.

sur borderouge j'ai la version 3.9 du driver et en 32bits → je suis passé à la 4.61 pour que ca marche…

créer le catkin workspace

mkdir -p ~/ueye_catkin/src 

initialize and download source code

cd ~/ueye_catkin/src && wstool init && wstool set ueye_cam --git https://github.com/anqixu/ueye_cam && wstool update && cd .. 

Run catkin_make

catkin_make

explication de ce qu'est un catkin: http://wiki.ros.org/catkin/conceptual_overview

exécution ueye sur arm: https://www.youtube.com/watch?v=nU1u6vHoZ-I&feature=youtu.be

rostopic list

lancement d'un script demo:

bash
cd ~/ueye_catkin/src/ueye_cam/launch
roslaunch rgb8.launch

(il faut avoir lancé le démon ueye)

j'ai cette erreur: /opt/ros/hydro/lib/rosout/rosout: error while loading shared libraries: libroscpp.so: cannot open shared object file: No such file or directory

sudo apt-get install  ros-hydro-ros-comm ros-hydro-roscpp ros-hydro-roscpp-core ros-hydro-rostime ros-hydro-rqt-gui-cpp

en cas de probleme il faut refaire:

source /opt/ros/hydro/setup.bash

liste des topics du noeud ueye:

rostopic list
rostopic echo /camera/camera_info
rostopic echo /ueye_cam_nodelet/parameter_descriptions
rostopic echo  /camera/image_raw

camera:=/camera

REMARQUE: le code du noeud ROS fait une copie du buffer d'image (voir http://docs.ros.org/jade/api/ueye_cam/html/ueye__cam__nodelet_8cpp_source.html ) mais il n'y a pas de lock de la zone mémoire donc le driver de la ueye peut écraser les données!

Vu que le pilote ros ueye est bancal, peut être que certaines images sont verrollées (surtout quand je les acquière à 87 fps). Du coup, ca pourrait expliquer certains décrochement de SVO…. il faudra que j'enregistre des séquences vers du ramdisk en utilisant le drivers ros et vérifier quaucune image n'est sectionnée.

étalonnage géométrique

http://wiki.ros.org/camera_calibration et http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration

rosdep install camera_calibration
rosmake camera_calibration

rectification et debayerisation de l'image: http://wiki.ros.org/image_proc

pour lancer l'étalonnage avec une mire contenant 8×6 intersections de coins espacées de 23mm:

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.023 image:=/camera/image_raw 

Bouger la camera jusqu'à ce que le bouton calibrate soit dégrisé et cliquer dessus:

# oST version 5.0 parameters
[image]
width
640
height
480
[narrow_stereo]
camera matrix
666.954335 0.000000 356.801725
0.000000 664.691658 215.604874
0.000000 0.000000 1.000000
distortion
-0.377974 0.145009 -0.000818 -0.001899 0.000000
rectification
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
projection
599.969482 0.000000 363.101026 0.000000
0.000000 626.852661 212.125282 0.000000
0.000000 0.000000 1.000000 0.000000

bouton Save sauve en /tmp/calibrationdata.tar.gz , ce fichier contient les images en png et un fichier ost.txt

bouton Commit génère une erreur: Failed to write camera info to file… :(

TODO: regarder http://wiki.ros.org/ROS/EnvironmentVariables#ROS_PACKAGE_PATH et régler toutes les variables, notamment le ROS_HOME

utiliser: http://wiki.ros.org/camera_calibration_parsers pour convertir le ost.txt en .yml nécessaire à SVO

cd /tmp
tar -zxvf calibrationdata.tar.gz ost.txt
mv ost.txt ost.ini
rosrun  camera_calibration_parsers convert  ost.ini cal.yml

Tutorial simpliste pour hydro

http://jbohren.com/articles/roscpp-hello-world/

Ouvrir 3 consoles:

roscore
cd ~/hello_world_tutorial && ./hello_world_node
rosnode info /hello_world_node

dans une autre fenêtre, on peut afficher le topic /rosout émis par hello_world_node

rostopic echo /rosout

SVO

Installation sans ROS

DIR=~/Téléchargements/svo
 sudo apt-get install libboost-all-dev libeigen3-dev cmake libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-qt4-dev 
cd $DIR
git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff
mkdir build
cd build 
cmake ..
make
cd $DIR
git clone https://github.com/uzh-rpg/fast.git
cd fast
mkdir build
cd build
cmake ..
make
cd $DIR
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o 
mkdir build
cd build
cmake ..
make
sudo make install
cd $DIR
git clone https://github.com/uzh-rpg/rpg_vikit.git
   in rpg_vikit/vikit_common/CMakeLists.txt set the flag USE_ROS to FALSE.
cd rpg_vikit/vikit_common
mkdir build
cd build
cmake ..
make
cd $DIR
git clone https://github.com/uzh-rpg/rpg_svo.git 
cd rpg_svo/svo
    In svo/CMakeLists.txt set the flag USE_ROS to FALSE.
mkdir build
cd build
cmake ..
make

/home/bvandepo/Téléchargements/svo/rpg_svo/svo/src/map.cpp:135:12: erreur: could not convert ‘nullptr’ from ‘std::nullptr_t’ to ‘svo::FramePtr {aka boost::shared_ptr<svo::Frame>}’

voir: http://stackoverflow.com/questions/29125396/building-svo-package-on-raspberry-pi

mais c'est une mauvaise solution, il vaudrait mieux gérer le C++ 11 : http://stackoverflow.com/questions/16886591/how-do-i-enable-c11-in-gcc

dans ./src/rpg_svo/svo/CMakeLists.txt changer

SET(CMAKE_CXX_FLAGS "-Wall -D_LINUX -D_REENTRANT -march=native -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas")

en

SET(CMAKE_CXX_FLAGS "-std=c++11 -Wall -D_LINUX -D_REENTRANT -march=native -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas")

MAIS J OBTIENS:

[ 51%] Built target vikit_ros
[ 55%] [ 55%] Building CXX object rpg_svo/svo/CMakeFiles/svo.dir/src/frame_handler_base.cpp.o
Building CXX object rpg_svo/svo/CMakeFiles/svo.dir/src/frame_handler_mono.cpp.o
cc1plus: erreur: unrecognized command line option ‘-std=c++11’
cc1plus: erreur: unrecognized command line option ‘-std=c++11’
make[2]: *** [rpg_svo/svo/CMakeFiles/svo.dir/src/frame_handler_base.cpp.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
cc1plus: erreur: unrecognized command line option ‘-std=c++11’
cc1plus: erreur: unrecognized command line option ‘-std=c++11’
make[2]: *** [rpg_svo/svo/CMakeFiles/svo.dir/src/frame_handler_mono.cpp.o] Erreur 1
make[1]: *** [rpg_svo/svo/CMakeFiles/svo.dir/all] Erreur 2
make: *** [all] Erreur 2
Invoking "make" failed

D'APRES: https://www.bountysource.com/issues/8218373-ubuntu-12-04-make-fails-cc1plus-error-unrecognized-command-line-option-std-gnu-11 Hi @Bloodyaugust. I've see this issue and as the C++11 support in 4.6 is not as complete as gcc 4.8, you should use gcc 4.8. You can install gcc-4.8 package:

sudo apt-get install g++-4.8

And then, before you run cmake:

export CXX="g++-4.8"

mais g++-4.8 n'est pas dans les paquets ubuntu 12.04

voir: https://gcc.gnu.org/projects/cxx0x.html

exécutables dans :

cd ~/Téléchargements/svo/rpg_svo/svo/bin
./test_depth_filter 

terminate called after throwing an instance of 'std::logic_error'

what():  basic_string::_S_construct null not valid

Abandon (core dumped)

dataset

https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-without-ROS

cd $DIR
mkdir Datasets
export SVO_DATASET_DIR=${DIR}/Datasets
wget http://rpg.ifi.uzh.ch/datasets/sin2_tex2_h1_v8_d.tar.gz -O - | tar -xz
cd $DIR/rpg_svo/svo/bin
./test_pipeline
cd $DIR/Datasets

Installation avec ROS sur machine Borderouge

Probleme avec le nfs, il faut mettre les fichiers d'install en local :(

cd /local/users/bvandepo
mv ~/svo ./
ln -s /local/users/bvandepo/svo ~/svo

 
echo $ROS_PACKAGE_PATH
    /opt/ros/hydro/share:/opt/ros/hydro/stacks

Il faut créer ~/catkin_ws et bien mettre rpg_svo et rpg_vikit dans ~/catkin_ws/src/ puis faire

cd ~/catkin_ws 
catkin_make

corriger l'erreur de nullptr

dataset pour ROS

https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-with-ROS

cd ~/catkin_ws && wget rpg.ifi.uzh.ch/datasets/airground_rig_s3_2013-03-18_21-38-48.bag

pour utiliser rviz, je dois ajouter à .bashrc car ma carte ne supporte pas opengl2.1

export LIBGL_ALWAYS_SOFTWARE=1

Il faut executer en local sur la machine borderouge car le problème vient de l'export display…

Tentative en Live

bvandepo@borderouge:~/catkin_ws/src/rpg_svo/svo_ros/launch$ roslaunch svo_ros ./live.launch

[./live.launch] is neither a launch file in package [svo_ros] nor is [svo_ros] a launch file name

bvandepo@borderouge:~/catkin_ws/src/rpg_svo/svo_ros/launch$ rosrun rqt_svo rqt_svo
[rospack] Error: stack/package rqt_svo not found
bvandepo@borderouge:~/catkin_ws/src/rpg_svo/svo_ros/launch$ rosls rqt_svo
live.launch  live.launch~  test_rig3.launch
bvandepo@borderouge:~/catkin_ws/src/rpg_svo/svo_ros/launch$ roscd rqt_svo
roscd: No such package/stack 'rqt_svo'

D'apres http://answers.ros.org/question/44270/error-stackpackage-nxt_python-not-found/ , c'est un problème de ROS_PACKAGE_PATH environment variable

export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/bvandepo/catkin_ws/
echo $ROS_PACKAGE_PATH

tentative:

rosrun rviz rviz -d /home/bvandepo/catkin_ws/src/rpg_svo/svo_ros/rviz_config.rviz
 

Si en lançant les scrits de launch, on obtient:

ERROR: cannot launch node of type [svo_ros/vo]: can't locate node [vo] in package [svo_ros]

alors charger:

source ~/catkin_ws/devel/setup.bash

même problème de gui svo qui affiche not connected: https://github.com/uzh-rpg/rpg_svo/issues/65

Inspection du fichier .bag:

rqt_bag ~/catkin_ws/airground_rig_s3_2013-03-18_21-38-48.bag 

puis cliquer sur l'image toogle thumbnail (voir http://wiki.ros.org/rxbag )

vrac:

rostopic list
rostopic bw  /camera/image_raw
rostopic echo  /camera/image_raw
rostopic hz  /camera/image_raw
rostopic type  /camera/image_raw
 

analyse des paramètres

rosparam list
rosparam get /svo/cam_cx

pour récupérer tous les paramètres du namespace /svo

rosparam get /svo

les enregistrer vers un fichier dump

rosparam dump test.yaml /svo/

Visualisation des échanges de données entre les noeuds ROS, selectionner Nodes/Topics All et cliquer sur raffraichir dans

rqt_graph 

Affichage et tracé d'un topic

rostopic echo /imu/data
rqt_plot /imu/data/linear_acceleration/x

affichage des messages publiés sur /rosout

rqt_console

probleme

en lancant d'abord

roslaunch svo_ros test_rig3.launch

puis

rosbag play catkin_ws/airground_rig_s3_2013-03-18_21-38-48.bag

le noeud svo plante:

[ INFO] [1443100635.238342952]: SVO initialized
[ INFO] [1443100635.240118679]: Found parameter: svo/cam_topic, value: /camera/image_raw
[ INFO] [1443100658.812386743]: RESET
[svo-2] process has died [pid 8200, exit code -4, cmd /home/bvandepo/catkin_ws/devel/lib/svo_ros/vo __name:=svo __log:=/home/bvandepo/log/9176bd96-62be-11e5-8a0c-00137297c9b4/svo-2.log].
log file: /home/bvandepo/log/9176bd96-62be-11e5-8a0c-00137297c9b4/svo-2*.log
gedit /home/bvandepo/log/9176bd96-62be-11e5-8a0c-00137297c9b4/master.log &
gedit /home/bvandepo/log/9176bd96-62be-11e5-8a0c-00137297c9b4/roslaunch-borderouge-8160.log &

même problème sans réponse: http://answers.ros.org/question/197452/roslaunch-crash-when-launch-rosbag-play-svo/

Tentative d'executer les programmes de test via ros (ils marchent sans): https://github.com/uzh-rpg/rpg_svo/tree/master/svo/test

cd ~/catkin_ws/src/rpg_svo/svo/test

mkdir ~/Datasets

dans ~/.bashrc

export SVO_DATASET_DIR=${HOME}/Datasets
cd ${SVO_DATASET_DIR}
wget http://rpg.ifi.uzh.ch/datasets/sin2_tex2_h1_v8_d.tar.gz -O - | tar -xz
rosrun svo test_pipeline
[ INFO] [1443102370.121357754]: SVO initialized
reading image /home/bvandepo/Datasets/sin2_tex2_h1_v8_d/img/frame_000002_0.png
[ INFO] [1443102370.195465713]: RESET
Instruction non permise (core dumped)
bvandepo@borderouge:~/Datasets/sin2_tex2_h1_v8_d$ display  /home/bvandepo/Datasets/sin2_tex2_h1_v8_d/img/frame_000002_0.png

c'est peut être la modif liée au nullptr

gedit ~/catkin_ws/src/rpg_svo/svo/src/map.cpp & 

Install sur brute

installation ros et ueye

Installation de ros jade au lieu de hydro

il faut télécharger la version 64bits du driver de la ueye:

wget https://fr.ids-imaging.com/download-ueye-lin64.html?file=tl_files/downloads/uEye_SDK/driver/uEye_Linux_4.61_64_Bit.tgz

je met ueye dans le catkin avec svo:

cd ~/catkin_ws/src && wstool init && wstool set ueye_cam --git https://github.com/anqixu/ueye_cam && wstool update && cd .. 
 sudo apt-get install  ros-jade-ros-comm ros-jade-roscpp ros-jade-roscpp-core ros-jade-rostime ros-jade-rqt-gui-cpp

Le paquet libqglviewer-qt4-dev est remplacé par:

sudo apt-get install libqglviewer-dev 

drivers propriétaires carte nvidia

http://doc.ubuntu-fr.org/nvidia

sudo add-apt-repository ppa:xorg-edgers/ppa 
sudo apt-get update 
ubuntu-drivers devices  
sudo apt-get install nvidia-340
sudo reboot 0
sudo apt-get install nvidia-settings
sudo nvidia-settings

http://doc.ubuntu-fr.org/gestionnaire_de_pilotes_proprietaires

exécution

script pour avoir l'image en 752*480 avec la ueye

cp ~/catkin_ws/src/ueye_cam/launch/rgb8.launch  ~/catkin_ws/src/ueye_cam/launch/rgb8752.launch

changer 640 en 752

gedit ~/catkin_ws/src/ueye_cam/launch/rgb8752.launch

étalonnage

cd ~/catkin_ws/src/ueye_cam/launch
roslaunch rgb8752.launch

et dans une autre console:

rosrun camera_calibration cameracalibrator.py --size 8x8 --square 0.022 image:=/camera/image_raw

calibrate, save et commit

cd /tmp
tar -zxvf calibrationdata.tar.gz ost.txt
mv ost.txt ost.ini
rosrun  camera_calibration_parsers convert  ost.ini cal.yml
cp cal.yml ~/catkin_ws/

Ce n'est pas le même format yaml que celui attendu par svo!!!! voir: https://github.com/uzh-rpg/rpg_svo/wiki/Camera-Calibration

cd ~/catkin_ws/src
find .| grep param
  ./rpg_vikit/vikit_ros/include/vikit/params_helper.h
  ./rpg_svo/svo_ros/param
  ./rpg_svo/svo_ros/param/camera_pinhole.yaml
  ./rpg_svo/svo_ros/param/vo_fast.yaml
  ./rpg_svo/svo_ros/param/camera_atan.yaml
  ./rpg_svo/svo_ros/param/vo_accurate.yaml

cd /home/bvdp/catkin_ws/src/rpg_svo/svo_ros/param

cp camera_pinhole.yaml camera_pinhole_ueye.yaml 
gedit camera_pinhole_ueye.yaml  ~/catkin_ws/cal.yml &

copier les valeurs de camera_matrix→data et distorsion_coefficients→data

live

cp ~/catkin_ws/src/rpg_svo/svo_ros/launch/live.launch ~/catkin_ws/src/rpg_svo/svo_ros/launch/liveueye.launch  
gedit ~/catkin_ws/src/rpg_svo/svo_ros/launch/liveueye.launch  &

changer en <rosparam file=“$(find svo_ros)/param/camera_pinhole_ueye.yaml" />

===script launch  qui intègre lancement camera + svo===

merger  ~/catkin_ws/src/rpg_svo/svo_ros/launch/ liveueye.launch et ~/catkin_ws/src/ueye_cam/launch/rgb8752.launch  en ~/catkin_ws/src/rpg_svo/svo_ros/launch/ liveueye2.launch 

===optimisation===
script liveueye3.launch qui règle la caméra ueye pour avoir 70fps et des paramètres d'exposition et de gain fixes (déterminés avec ueyedemo)

===exécution===
NB: il ne faut surtout pas donner le chemin devant le nom du fichier launch!!!!

  cd ~/catkin_ws/src/rpg_svo/svo_ros/launch
  roslaunch svo_ros liveueye3.launch

dans la console texte, on peut presser R (reset) S (start) Q (quitter)

normalement, une gui doit s'ouvrir, sinon:
  rosrun rqt_svo rqt_svo

Pour afficher la visu en 3D:
  rosrun rviz rviz
et load du fichier de configuration




<file xml liveueye4.launch>
<launch>

<arg name="nodelet_manager_name" value="nodelet_manager" />
  <arg name="camera_name" value="camera" />

  <node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager_name)” args=“manager” output=“screen” />

<node pkg="nodelet" type="nodelet" name="ueye_cam_nodelet"
      args="load ueye_cam/ueye_cam_nodelet $(arg nodelet_manager_name)">
  <param name="camera_name" type="str" value="$(arg camera_name)" /> <!-- == namespace for topics and services -->
  <param name="camera_topic" type="str" value="image_raw" />
  <param name="camera_id" type="int" value="0" /> <!-- 0 = any camera; 1+: camera ID -->
  <param name="camera_intrinsics_file" type="string" value="" /> <!-- default: ~/.ros/camera_info/<camera_name>.yaml -->
  <param name="camera_parameters_file" type="string" value="" /> <!-- default: ~/.ros/camera_conf/<camera_name>.ini -->
  <param name="ext_trigger_mode" type="bool" value="False" /> <!-- if False, then camera will operate in free-run mode; otherwise, frames need to be triggered by hardware signal (falling-edge) on digital input pin of camera -->
  <!-- the following are optional camera configuration parameters:
       they will be loaded on the camera after the .ini configuration
       file, and before dynamic_reconfigure. That means that any
       (lingering) dynamic parameters from dynamic_reconfigure will
       override these values, and that these will override parameters
       from the .ini file.
       See http://www.ros.org/wiki/ueye_cam for more details. -->
  <param name="color_mode" type="str" value="mono8" /> <!-- valid options: 'rgb8', 'mono8', 'bayer_rggb8' -->
  <!-- WARNING: the following 4 parameters specify dimensions for camera's area of interest. Values for image_width and image_height that are smaller than your camera's maximum values will result in cropped field of view. For typical cases, one should modify values for sensor_scaling / binning / subsampling to downsample the resulting ROS image to the desired dimensions, without losing potential field of view. -->
  <param name="image_width" type="int" value="752" />
  <param name="image_height" type="int" value="480" />
  <param name="image_top" type="int" value="-1" /> <!-- -1: center -->
  <param name="image_left" type="int" value="-1" /> <!-- -1: center -->
  <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_gain" type="bool" value="False" />
  <param name="master_gain" type="int" value="0" />
  <param name="red_gain" type="int" value="0" />
  <param name="green_gain" type="int" value="0" />
  <param name="blue_gain" type="int" value="0" />
  <param name="gain_boost" type="bool" value="False" />
  <param name="auto_exposure" type="bool" value="False" />
  <param name="exposure" type="int" value="3" /> <!-- in ms -->
  <param name="auto_white_balance" type="bool" value="False" />
  <param name="white_balance_red_offset" type="int" value="0" />
  <param name="white_balance_blue_offset" type="int" value="0" />
  
  <param name="flash_delay" type="int" value="0" /> <!-- in us -->
  <param name="flash_duration" type="int" value="1000" /> <!-- in us -->
  
  <param name="auto_frame_rate" type="bool" value="False" />
  <param name="frame_rate" type="double" value="70.0" />
  <param name="pixel_clock" type="int" value="40" />
  <param name="flip_upd" type="bool" value="False" />
  <param name="flip_lr"  type="bool" value="False" />
</node>
  <node pkg="svo_ros" type="vo" name="svo" clear_params="true" output="screen">
      <!-- Camera topic to subscribe to -->
      <param name="cam_topic" value="/camera/image_raw" type="str" />
      <!-- Camera calibration file -->
      <rosparam file="$(find svo_ros)/param/camera_pinhole_ueye.yaml" />
      <!-- <rosparam file="/home/bvdp/catkin_ws/cal.yml" /> -->
      <!-- Default parameter settings: choose between vo_fast and vo_accurate -->
      <rosparam file="$(find svo_ros)/param/vo_accurate.yaml" />
  </node>

</launch> </file>

Pour adapter aux conditions d'éclairage, changer la valeur de <param name=“exposure” type=“int” value=“3” /> <!– in ms –>. Si l'éclairage est de type néon, il faut régler une valeur multiple de 10ms pour intégrer des périodes complètes du 100hz.

camera_pinhole_ueye.yaml
cam_model: Pinhole
cam_width: 752
cam_height: 480
cam_fx: 653.851271
cam_fy: 653.296902
cam_cx: 365.892823
cam_cy: 219.379481
cam_d0: -0.438732
cam_d1: 0.204663
cam_d2: -0.000598
cam_d3: 0.000145

Traitement Séquence aircobot

Extraction d'une séquence de pgm par décimation

script.sh
#!/bin/bash 
 
rm select/image_*.pgm
rm select/image_*.png
rm select/image_*.jpg
rm select/image_*.tif
 
 
IMG_DIR="selecttif/"
mkdir -p $IMG_DIR 
LIST_FILE=$IMG_DIR"list.txt"
rm $LIST_FILE
 
 
 
j=0
for i in  $(seq -w 1 60 3769);   do
 
echo $j
#formate sur 4 digits
jf=`printf "%04.f\n" $j`
echo $jf
#cp image_$i.pgm $IMG_DIR/image_$jf.pgm
convert  image_$i.pgm $IMG_DIR/image_$jf.tif
j=`expr $j + 1` 
done
 
 
for k in  $(seq -w 1 59);   do
#genere des paires
for inc in  $(seq  1 3);   do
l=`expr $k + $inc` 
 
#formate sur 4 digits
kf=`printf "%04.f\n" $k`
lf=`printf "%04.f\n" $l`
echo image_$kf.pgm image_$lf.pgm  >>$LIST_FILE
done
done

Génération d'un bag à partir de séquence d'image pgm

http://answers.ros.org/question/11537/creating-a-bag-file-out-of-a-image-sequence/

img2bag_gray_mono.py
#adaptation par bvandepo de http://answers.ros.org/question/11537/creating-a-bag-file-out-of-a-image-sequence/
#pour traiter des séquences d'images en niveaux de gris (pgm ou png) et les trier
import time, sys, os
from ros import rosbag
import roslib
import rospy
roslib.load_manifest('sensor_msgs')
from sensor_msgs.msg import Image
 
import ImageFile
 
def GetFilesFromDir(dir):
    '''Generates a list of files from the directory'''
    print( "Searching directory %s" % dir )
    all = []
    if os.path.exists(dir):
        for path, names, files in os.walk(dir):
            for f in files:
                if os.path.splitext(f)[1] in ['.png','.pgm']:
                    all.append( os.path.join( path, f ) )
    return all
 
def CreateMonoBag(imgs,bagname):
    '''Creates a bag file with camera images'''
    bag =rosbag.Bag(bagname, 'w')
#tri des images par nom croissant
    imgs=sorted(imgs)
    try:
        for i in range(len(imgs)):
            print("Adding %s" % imgs[i])
 
            fp = open( imgs[i], "r" )
            p = ImageFile.Parser()
 
            while 1:
                s = fp.read(1024)
                if not s:
                    break
                p.feed(s)
 
            im = p.close()
 
            Stamp = rospy.rostime.Time.from_sec(time.time())
            Img = Image()
            Img.header.stamp = Stamp
            Img.width = im.size[0]
            Img.height = im.size[1]
            Img.encoding = "mono8"
            Img.header.frame_id = "camera"
            #Img_data = [pix for pixdata in im.getdata() for pix in pixdata]
            Img_data = [pix for pix in im.getdata()] 
            Img.data = Img_data
            bag.write('camera/image_raw', Img, Stamp)
 
    finally:
        bag.close()       
 
 
def CreateBag(args):
    '''Creates the actual bag file by successively adding images'''
    all_imgs= GetFilesFromDir(args[0])
    if len(all_imgs) <= 0:
        print("No images found in %s" % args[0])
        exit()
 
    # create bagfile with mono camera image stream
    CreateMonoBag(all_imgs, args[1])        
 
if __name__ == "__main__":
    if len( sys.argv ) == 3:
        CreateBag( sys.argv[1:])
    else:
        print( "Usage: img2bag_gray_mono imagedir bagfilename")

Extraction d'images contenues dans un bag

http://wiki.ros.org/rosbag/Tutorials/Exporting%20image%20and%20video%20data

<launch>
  <node pkg="rosbag" type="play" name="rosbag" args="-d 2 /home/bvdp/catkin_ws/airground_rig_s3_2013-03-18_21-38-48.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
    <remap from="image" to="/camera/image_raw"/>
  </node>
</launch>

Paramètres caméra

CAMERA_TYPE: 0
CAMERA_DEVICE: 0x00b09d010063565b
IMG_WIDTH: 640
IMG_HEIGHT: 480
INTRINSIC: [4](327.3508, 249.9982, 622.0489, 621.6159)
DISTORTION: [3](-0.3270245, 0.1944629, -0.09558001)

mais les images fournies sont déjà rectifiées, faire un fichier:

camera_pinhole_aircobot.yaml
cam_model: Pinhole
cam_width: 640
cam_height: 480
cam_fx: 622.0489
cam_fy: 621.6159
cam_cx: 327.3508
cam_cy: 249.9982
cam_d0: 0
cam_d1: 0
cam_d2: 0
cam_d3: 0

Pour connaître les paramètres des images publiées sur le topic /camera/image_raw

rostopic echo /camera/image_raw | grep width -A 3 -B 2

http://wiki.ros.org/rosbag/Tutorials/Recording%20and%20playing%20back%20data

rosbag info aircobot1.bag 
  path:        aircobot1.bag
  version:     2.0
  duration:    17.9s
  start:       Sep 30 2015 14:30:48.06 (1443616248.06)
  end:         Sep 30 2015 14:31:05.99 (1443616265.99)
  size:        88.0 MB
  messages:    300
  compression: none [100/100 chunks]
  types:       sensor_msgs/Image [060021388200f6f0f447d0fcd9c64743]
  topics:      camera/image_raw   300 msgs    : sensor_msgs/Image

A faire

rosueyesvo.txt · Dernière modification: 2016/11/05 00:59 par bvandepo