Difference between revisions of "Aitana-TFM-kinect-ROS05"
(→Conexión entre sistemas) |
|||
(40 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | * '''Project Name:''' | + | * '''Project Name:''' Human tracking and recognition OpenNI tracker |
* '''Authors:''' Aitana Alonso Nogueira | * '''Authors:''' Aitana Alonso Nogueira | ||
− | * '''Dates:''' September 2013 | + | * '''Dates:''' September 2013 |
* '''Degree:''' Master | * '''Degree:''' Master | ||
− | * '''Tags:''' | + | * '''Tags:''' ROS, kinect, ROS, tracking |
− | * '''Technologies:''' ROS, | + | * '''Technologies:''' ROS, opennni |
* '''Status:''' Finished | * '''Status:''' Finished | ||
+ | =Instalación= | ||
+ | Lo primero que vamos a decir es como configurar el entorno para poder trabajar con la librería skeleton tracking, para ello vamos a trabajar con ROS, la versión fuerte, para instalarlo: | ||
− | + | <syntaxhighlight>sudo apt-get install ros-fuerte-desktop-full</syntaxhighlight> | |
− | |||
− | + | Después de eso, para poder trabajar con la kinect, debemos instalar los drivers de openni, recordar que estamos trabajando con la versión fuerte de ros: | |
− | |||
− | |||
− | + | <syntaxhighlight>sudo apt-get install ros-fuerte-openni-camera ros-fuerte-openni-launch</syntaxhighlight> | |
− | + | La librería skeleton tracking, que es la que vamos a utilizar se encuentra en el paquete NITE, que puedes encontrar en el siguiente enlace: [http://www.openni.org/openni-sdk/openni-sdk-history-2/], debemos descargarnos la versión 1.5, ya que a partir de la versión 2.0 da problemas de compatibilidad y no conseguiremos hacer funcionar la librería skeleton tracking. | |
− | |||
− | |||
− | |||
− | |||
− | + | Una vez descargado lo descomprimimos y ejecutamos el fichero ''install.sh''. | |
− | y | ||
− | |||
− | |||
− | + | <syntaxhighlight>sudo ./install.sh</syntaxhighlight> | |
− | |||
− | + | Debemos obtener lo siguiente: | |
− | + | <syntaxhighlight>Installing NITE | |
+ | *************** | ||
− | + | Copying shared libraries... OK | |
− | + | Copying includes... OK | |
+ | Installing java bindings... OK | ||
+ | Installing module 'Features_1_3_0'... | ||
+ | Registering module 'libXnVFeatures_1_3_0.so'... OK | ||
+ | Installing module 'Features_1_3_1'... | ||
+ | Registering module 'libXnVFeatures_1_3_1.so'... OK | ||
+ | Installing module 'Features_1_4_1'... | ||
+ | Registering module 'libXnVFeatures_1_4_1.so'... OK | ||
+ | Installing module 'Features_1_4_2'... | ||
+ | Registering module 'libXnVFeatures_1_4_2.so'... OK | ||
+ | Installing module 'Features_1_5_2'... | ||
+ | Registering module 'libXnVFeatures_1_5_2.so'... OK | ||
+ | Copying XnVSceneServer... OK | ||
+ | Installing module 'Features_1_5_2' | ||
+ | registering module 'libXnVHandGenerator_1_3_0.so'...OK | ||
+ | Installing module 'Features_1_5_2' | ||
+ | registering module 'libXnVHandGenerator_1_3_1.so'...OK | ||
+ | Installing module 'Features_1_5_2' | ||
+ | registering module 'libXnVHandGenerator_1_4_1.so'...OK | ||
+ | Installing module 'Features_1_5_2' | ||
+ | registering module 'libXnVHandGenerator_1_4_2.so'...OK | ||
+ | Installing module 'Features_1_5_2' | ||
+ | registering module 'libXnVHandGenerator_1_5_2.so'...OK | ||
+ | Adding license.. OK | ||
− | + | *** DONE *** | |
− | + | </syntaxhighlight> | |
− | |||
− | + | Por último, solo nos falta instalar el paquete en cuestión ''openni_tracker ''. | |
− | + | <syntaxhighlight>sudo apt-get install ros-fuerte-openni-tracker</syntaxhighlight> | |
− | + | =Ejecutando Skeleton Tracking= | |
− | + | Debemos abrir 3 terminales diferentes: | |
− | * | + | * En el primero, ejecutaremos ROS, para ello escribimos en linea de comandos: |
+ | <syntaxhighlight>roscore</syntaxhighlight> | ||
+ | y nos debe aparecer algo como esto: | ||
+ | <syntaxhighlight>... logging to /home/aitana/.ros/log/f3ff128e-5c2a-11e3-8ee4-0c6076187d47/roslaunch-aitana-laptop-3492.log | ||
+ | Checking log directory for disk usage. This may take awhile. | ||
+ | Press Ctrl-C to interrupt | ||
+ | Done checking log file disk usage. Usage is <1GB. | ||
+ | started roslaunch server http://aitana-laptop:60613/ | ||
+ | ros_comm version 1.8.11 | ||
− | |||
− | + | SUMMARY | |
+ | ======== | ||
− | + | PARAMETERS | |
− | + | * /rosdistro | |
+ | * /rosversion | ||
− | + | NODES | |
− | + | auto-starting new master | |
+ | process[master]: started with pid [3508] | ||
+ | ROS_MASTER_URI=http://aitana-laptop:11311/ | ||
− | + | setting /run_id to f3ff128e-5c2a-11e3-8ee4-0c6076187d47 | |
− | + | process[rosout-1]: started with pid [3521] | |
− | + | started core service [/rosout] | |
− | + | </syntaxhighlight> | |
− | |||
− | + | Lo dejamos corriendo en segundo plano. | |
+ | * En el segundo terminal, debemos lanzar los drivers openni para la kinect | ||
− | + | <syntaxhighlight>roslaunch openni_launch openni.launch</syntaxhighlight> | |
− | + | Y una vez más, nos debe aparecer algo como lo que se muestra a continuación: | |
− | + | <syntaxhighlight>... logging to /home/aitana/.ros/log/f3ff128e-5c2a-11e3-8ee4-0c6076187d47/roslaunch-aitana-laptop-3614.log | |
+ | Checking log directory for disk usage. This may take awhile. | ||
+ | Press Ctrl-C to interrupt | ||
+ | Done checking log file disk usage. Usage is <1GB. | ||
− | + | started roslaunch server http://aitana-laptop:58367/ | |
− | |||
− | + | SUMMARY | |
+ | ======== | ||
− | * | + | PARAMETERS |
− | * | + | * /camera/depth/rectify_depth/interpolation |
− | * | + | * /camera/depth_registered/rectify_depth/interpolation |
− | * | + | * /camera/disparity_depth/max_range |
− | * | + | * /camera/disparity_depth/min_range |
+ | * /camera/disparity_depth_registered/max_range | ||
+ | * /camera/disparity_depth_registered/min_range | ||
+ | * /camera/driver/depth_camera_info_url | ||
+ | * /camera/driver/depth_frame_id | ||
+ | * /camera/driver/depth_registration | ||
+ | * /camera/driver/device_id | ||
+ | * /camera/driver/rgb_camera_info_url | ||
+ | * /camera/driver/rgb_frame_id | ||
+ | * /rosdistro | ||
+ | * /rosversion | ||
− | + | NODES | |
+ | /camera/depth/ | ||
+ | metric (nodelet/nodelet) | ||
+ | metric_rect (nodelet/nodelet) | ||
+ | points (nodelet/nodelet) | ||
+ | rectify_depth (nodelet/nodelet) | ||
+ | /camera/rgb/ | ||
+ | debayer (nodelet/nodelet) | ||
+ | rectify_color (nodelet/nodelet) | ||
+ | rectify_mono (nodelet/nodelet) | ||
+ | / | ||
+ | camera_base_link (tf/static_transform_publisher) | ||
+ | camera_base_link1 (tf/static_transform_publisher) | ||
+ | camera_base_link2 (tf/static_transform_publisher) | ||
+ | camera_base_link3 (tf/static_transform_publisher) | ||
+ | camera_nodelet_manager (nodelet/nodelet) | ||
+ | /camera/ | ||
+ | disparity_depth (nodelet/nodelet) | ||
+ | disparity_depth_registered (nodelet/nodelet) | ||
+ | driver (nodelet/nodelet) | ||
+ | points_xyzrgb_depth_rgb (nodelet/nodelet) | ||
+ | register_depth_rgb (nodelet/nodelet) | ||
+ | /camera/ir/ | ||
+ | rectify_ir (nodelet/nodelet) | ||
+ | /camera/depth_registered/ | ||
+ | metric (nodelet/nodelet) | ||
+ | metric_rect (nodelet/nodelet) | ||
+ | rectify_depth (nodelet/nodelet) | ||
− | = | + | ROS_MASTER_URI=http://localhost:11311 |
− | + | core service [/rosout] found | |
− | + | process[camera_nodelet_manager-1]: started with pid [3634] | |
− | + | process[camera/driver-2]: started with pid [3635] | |
− | + | process[camera/rgb/debayer-3]: started with pid [3636] | |
− | + | process[camera/rgb/rectify_mono-4]: started with pid [3637] | |
− | + | process[camera/rgb/rectify_color-5]: started with pid [3677] | |
− | + | process[camera/ir/rectify_ir-6]: started with pid [3700] | |
− | + | process[camera/depth/rectify_depth-7]: started with pid [3726] | |
− | + | process[camera/depth/metric_rect-8]: started with pid [3754] | |
− | + | process[camera/depth/metric-9]: started with pid [3793] | |
− | + | process[camera/depth/points-10]: started with pid [3830] | |
− | + | process[camera/register_depth_rgb-11]: started with pid [3868] | |
− | + | process[camera/depth_registered/rectify_depth-12]: started with pid [3913] | |
+ | process[camera/depth_registered/metric_rect-13]: started with pid [3953] | ||
+ | process[camera/depth_registered/metric-14]: started with pid [4002] | ||
+ | process[camera/points_xyzrgb_depth_rgb-15]: started with pid [4055] | ||
+ | process[camera/disparity_depth-16]: started with pid [4106] | ||
+ | process[camera/disparity_depth_registered-17]: started with pid [4151] | ||
+ | process[camera_base_link-18]: started with pid [4281] | ||
+ | process[camera_base_link1-19]: started with pid [4344] | ||
+ | process[camera_base_link2-20]: started with pid [4396] | ||
+ | process[camera_base_link3-21]: started with pid [4434] | ||
+ | [ INFO] [1386082671.833888617]: Initializing nodelet with 2 worker threads. | ||
+ | [ERROR] [1386082676.174882681]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/compressedDepth/set_parameters] | ||
+ | [ERROR] [1386082676.193015430]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/compressed/set_parameters] | ||
+ | [ERROR] [1386082676.216452698]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/theora/set_parameters] | ||
+ | [ INFO] [1386082676.733259757]: No devices connected.... waiting for devices to be connected | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Y que no cunda en pánico, que el error es normal. | |
− | |||
+ | * Por último, abrimos un nuevo terminal y en este ejecutamos por fin: | ||
+ | <syntaxhighlight>rosrun openni_tracker openni_tracker</syntaxhighlight> | ||
+ | Una vez que se está ejecutando, nos pondremos enfrente de la kinect en pose PSI [[File:PsiPose.gif|thumb|left|Pose PSI]], de esta forma nos aparecerán los siguientes mensajes: | ||
+ | <syntaxhighlight>New User 1 | ||
+ | Pose Psi detected for user 1 | ||
+ | Calibration started for user 1 | ||
+ | Calibration complete, start tracking user 1 | ||
+ | Lost User 1</syntaxhighlight> | ||
− | + | Lo primero que hace es detectar que hay una persona, a continuación, detecta que tiene la posición PSI y entonces comienza la calibración, si nos apartamos de la cámara entonces mostrará el mensaje que indica que ha perdido al usuario. | |
− | + | =Visualización= | |
− | + | Lo primero para ver la imagen real que ve la kinect utilizamos: | |
− | + | <syntaxhighlight>rosrun image_view image_view image:=/camera/rgb/image_color</syntaxhighlight> | |
− | = | ||
− | |||
− | + | Para visualizar la ejecución del openni_tracker utilizaremos Rviz. Rviz es una herramienta de visualización 3D para ROS. Ahora que hemos logrado detectar y calibrar personas, ¿Cómo podemos ver lo que está viendo la cámara kinect? para ello usaremos Rviz. Para ponerlo en marcha abriremos un cuarto terminal y teclearemos: | |
+ | <syntaxhighlight>rosrun rviz rviz</syntaxhighlight> | ||
− | + | y se abrirá la aplicación, tendremos que configurarlo: Añadir TF y desde la opción fixed frame podrás elegir que parte del cuerpo visionar. Las diferentes transformaciones \tf se pueden ver en el enlace [http://wiki.ros.org/openni_tracker] En las siguientes capturas se puede ver el resultado: | |
+ | [[File:CapRviz2.png| 520px|left|]] | ||
+ | [[File:CapRviz1.png| 520px|right|]] |
Latest revision as of 21:09, 10 October 2014
- Project Name: Human tracking and recognition OpenNI tracker
- Authors: Aitana Alonso Nogueira
- Dates: September 2013
- Degree: Master
- Tags: ROS, kinect, ROS, tracking
- Technologies: ROS, opennni
- Status: Finished
Instalación
Lo primero que vamos a decir es como configurar el entorno para poder trabajar con la librería skeleton tracking, para ello vamos a trabajar con ROS, la versión fuerte, para instalarlo:
sudo apt-get install ros-fuerte-desktop-full
Después de eso, para poder trabajar con la kinect, debemos instalar los drivers de openni, recordar que estamos trabajando con la versión fuerte de ros:
sudo apt-get install ros-fuerte-openni-camera ros-fuerte-openni-launch
La librería skeleton tracking, que es la que vamos a utilizar se encuentra en el paquete NITE, que puedes encontrar en el siguiente enlace: [1], debemos descargarnos la versión 1.5, ya que a partir de la versión 2.0 da problemas de compatibilidad y no conseguiremos hacer funcionar la librería skeleton tracking.
Una vez descargado lo descomprimimos y ejecutamos el fichero install.sh.
sudo ./install.sh
Debemos obtener lo siguiente:
Installing NITE
***************
Copying shared libraries... OK
Copying includes... OK
Installing java bindings... OK
Installing module 'Features_1_3_0'...
Registering module 'libXnVFeatures_1_3_0.so'... OK
Installing module 'Features_1_3_1'...
Registering module 'libXnVFeatures_1_3_1.so'... OK
Installing module 'Features_1_4_1'...
Registering module 'libXnVFeatures_1_4_1.so'... OK
Installing module 'Features_1_4_2'...
Registering module 'libXnVFeatures_1_4_2.so'... OK
Installing module 'Features_1_5_2'...
Registering module 'libXnVFeatures_1_5_2.so'... OK
Copying XnVSceneServer... OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_3_0.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_3_1.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_4_1.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_4_2.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_5_2.so'...OK
Adding license.. OK
*** DONE ***
Por último, solo nos falta instalar el paquete en cuestión openni_tracker .
sudo apt-get install ros-fuerte-openni-tracker
Ejecutando Skeleton Tracking
Debemos abrir 3 terminales diferentes:
- En el primero, ejecutaremos ROS, para ello escribimos en linea de comandos:
roscore
y nos debe aparecer algo como esto:
... logging to /home/aitana/.ros/log/f3ff128e-5c2a-11e3-8ee4-0c6076187d47/roslaunch-aitana-laptop-3492.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://aitana-laptop:60613/
ros_comm version 1.8.11
SUMMARY
========
PARAMETERS
* /rosdistro
* /rosversion
NODES
auto-starting new master
process[master]: started with pid [3508]
ROS_MASTER_URI=http://aitana-laptop:11311/
setting /run_id to f3ff128e-5c2a-11e3-8ee4-0c6076187d47
process[rosout-1]: started with pid [3521]
started core service [/rosout]
Lo dejamos corriendo en segundo plano.
- En el segundo terminal, debemos lanzar los drivers openni para la kinect
roslaunch openni_launch openni.launch
Y una vez más, nos debe aparecer algo como lo que se muestra a continuación:
... logging to /home/aitana/.ros/log/f3ff128e-5c2a-11e3-8ee4-0c6076187d47/roslaunch-aitana-laptop-3614.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://aitana-laptop:58367/
SUMMARY
========
PARAMETERS
* /camera/depth/rectify_depth/interpolation
* /camera/depth_registered/rectify_depth/interpolation
* /camera/disparity_depth/max_range
* /camera/disparity_depth/min_range
* /camera/disparity_depth_registered/max_range
* /camera/disparity_depth_registered/min_range
* /camera/driver/depth_camera_info_url
* /camera/driver/depth_frame_id
* /camera/driver/depth_registration
* /camera/driver/device_id
* /camera/driver/rgb_camera_info_url
* /camera/driver/rgb_frame_id
* /rosdistro
* /rosversion
NODES
/camera/depth/
metric (nodelet/nodelet)
metric_rect (nodelet/nodelet)
points (nodelet/nodelet)
rectify_depth (nodelet/nodelet)
/camera/rgb/
debayer (nodelet/nodelet)
rectify_color (nodelet/nodelet)
rectify_mono (nodelet/nodelet)
/
camera_base_link (tf/static_transform_publisher)
camera_base_link1 (tf/static_transform_publisher)
camera_base_link2 (tf/static_transform_publisher)
camera_base_link3 (tf/static_transform_publisher)
camera_nodelet_manager (nodelet/nodelet)
/camera/
disparity_depth (nodelet/nodelet)
disparity_depth_registered (nodelet/nodelet)
driver (nodelet/nodelet)
points_xyzrgb_depth_rgb (nodelet/nodelet)
register_depth_rgb (nodelet/nodelet)
/camera/ir/
rectify_ir (nodelet/nodelet)
/camera/depth_registered/
metric (nodelet/nodelet)
metric_rect (nodelet/nodelet)
rectify_depth (nodelet/nodelet)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
process[camera_nodelet_manager-1]: started with pid [3634]
process[camera/driver-2]: started with pid [3635]
process[camera/rgb/debayer-3]: started with pid [3636]
process[camera/rgb/rectify_mono-4]: started with pid [3637]
process[camera/rgb/rectify_color-5]: started with pid [3677]
process[camera/ir/rectify_ir-6]: started with pid [3700]
process[camera/depth/rectify_depth-7]: started with pid [3726]
process[camera/depth/metric_rect-8]: started with pid [3754]
process[camera/depth/metric-9]: started with pid [3793]
process[camera/depth/points-10]: started with pid [3830]
process[camera/register_depth_rgb-11]: started with pid [3868]
process[camera/depth_registered/rectify_depth-12]: started with pid [3913]
process[camera/depth_registered/metric_rect-13]: started with pid [3953]
process[camera/depth_registered/metric-14]: started with pid [4002]
process[camera/points_xyzrgb_depth_rgb-15]: started with pid [4055]
process[camera/disparity_depth-16]: started with pid [4106]
process[camera/disparity_depth_registered-17]: started with pid [4151]
process[camera_base_link-18]: started with pid [4281]
process[camera_base_link1-19]: started with pid [4344]
process[camera_base_link2-20]: started with pid [4396]
process[camera_base_link3-21]: started with pid [4434]
[ INFO] [1386082671.833888617]: Initializing nodelet with 2 worker threads.
[ERROR] [1386082676.174882681]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/compressedDepth/set_parameters]
[ERROR] [1386082676.193015430]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/compressed/set_parameters]
[ERROR] [1386082676.216452698]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/theora/set_parameters]
[ INFO] [1386082676.733259757]: No devices connected.... waiting for devices to be connected
Y que no cunda en pánico, que el error es normal.
- Por último, abrimos un nuevo terminal y en este ejecutamos por fin:
rosrun openni_tracker openni_tracker
New User 1
Pose Psi detected for user 1
Calibration started for user 1
Calibration complete, start tracking user 1
Lost User 1
Lo primero que hace es detectar que hay una persona, a continuación, detecta que tiene la posición PSI y entonces comienza la calibración, si nos apartamos de la cámara entonces mostrará el mensaje que indica que ha perdido al usuario.
Visualización
Lo primero para ver la imagen real que ve la kinect utilizamos:
rosrun image_view image_view image:=/camera/rgb/image_color
Para visualizar la ejecución del openni_tracker utilizaremos Rviz. Rviz es una herramienta de visualización 3D para ROS. Ahora que hemos logrado detectar y calibrar personas, ¿Cómo podemos ver lo que está viendo la cámara kinect? para ello usaremos Rviz. Para ponerlo en marcha abriremos un cuarto terminal y teclearemos:
rosrun rviz rviz
y se abrirá la aplicación, tendremos que configurarlo: Añadir TF y desde la opción fixed frame podrás elegir que parte del cuerpo visionar. Las diferentes transformaciones \tf se pueden ver en el enlace [2] En las siguientes capturas se puede ver el resultado: