Wednesday, December 4, 2013

Compilando e testando v4l-utils para ardrone

Tutorial adicionando v4l-utils no ardrone



Esse post presume que você já tenha feito todo o setup para compilar o VLC para ardrone.
http://dronespersonalizados.blogspot.com.br/2013/11/cross-compile-vlc-para-ardrone-usando-o.html


> Entrar no ambiente do compilação para ARM e testar a versão do compilador.
root@ubuntu:~# su -
root@ubuntu:~# arm-none-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) 

> Instalar as ferramentas necessárias
root@ubuntu:~# apt-get install git
root@ubuntu:~# apt-get install autoconf
root@ubuntu:~# apt-get install libtool

> Clonar v4l-utils do git
root@ubuntu:~# git clone git://linuxtv.org/v4l-utils.git
Cloning into 'v4l-utils'...
remote: Counting objects: 14446, done.
remote: Compressing objects: 100% (3005/3005), done.
remote: Total 14446 (delta 11375), reused 14397 (delta 11344)
Receiving objects: 100% (14446/14446), 2.34 MiB | 329 KiB/s, done.
Resolving deltas: 100% (11375/11375), done.

> entrar na pasta e rodar o autoconf
root@ubuntu:~# cd v4l-utils/
root@ubuntu:~/v4l-utils# autoreconf --force --install
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/config.guess'
libtoolize: copying file `build-aux/config.sub'
libtoolize: copying file `build-aux/install-sh'
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:48: installing `build-aux/missing'
contrib/test/Makefile.am: installing `build-aux/depcomp'
root@ubuntu:~/v4l-utils# 

> Configurar, compilar e instalar
root@ubuntu:~/v4l-utils# ./configure --prefix=/data/video/v4l-utils-nojpeg --host=arm-none-linux-gnueabi  --without-jpeg
root@ubuntu:~/v4l-utils# make -i
root@ubuntu:~/v4l-utils# make -i install

O -i é para ignorar alguns erros na compilação de uma ferramenta que depende do Xorg, como o ardrone não tem Xorg (ainda não), pode compilar ignorando esse erro.

Próximo passo é copiar a pasta /data/video/v4l-utils-nojpeg para o ardrone usando o filezilla do mesmo jeito que foi feito com o VLC, e entrar no TELNET do ardrone e criar os links para as bibliotecas que foram copiadas pelo FTP / Filezilla

root@ubuntu:~/v4l-utils# telnet 192.168.1.1
BusyBox v1.14.0 (2012-08-20 14:37:54 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

#
# ln -s /data/video/v4l-utils-nojpeg/lib/libv4l2.so.0.0.0 /data/video/v4l-utils-nojpeg/lib/libv4l2.so.0
# ln -s /data/video/v4l-utils-nojpeg/lib/libv4lconvert.so.0.0.0 /data/video/v4l-utils-nojpeg/lib/libv4lconvert.so.0

> Testando na camera horizontal
# /data/video/v4l-utils-nojpeg/bin/v4l2-ctl --all -d /dev/video0
Driver Info (not using libv4l2):
        Driver name   : p6_camif.0
        Card type     : p6_camif
        Bus info      :
        Driver version: 0.0.5
        Capabilities  : 0x04000001
                Video Capture
                Streaming
Video input : 0 (Camera: ok)
Video Standard = 0x00000000
Format Video Capture:
        Width/Height  : 640/480
        Pixel Format  : 'YU12'
        Field         : None
        Bytes per Line: 960
        Size Image    : 460800
        Colorspace    : Unknown (00000000)
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 0, Height 0
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 0, Height 0
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Crop: Left 0, Top 0, Width 640, Height 480
Streaming Parameters Video Capture:
        Frames per second: 25.000 (25/1)
        Read buffers     : 0
#

> Testando na camera vertical
# /data/video/v4l-utils-nojpeg/bin/v4l2-ctl --all -d /dev/video1
Driver Info (not using libv4l2):
        Driver name   : p6_camif.1
        Card type     : p6_camif
        Bus info      :
        Driver version: 0.0.5
        Capabilities  : 0x04000001
                Video Capture
                Streaming
Video input : 0 (Camera: ok)
Video Standard = 0x00000000
Format Video Capture:
        Width/Height  : 176/144
        Pixel Format  : 'YU12'
        Field         : None
        Bytes per Line: 264
        Size Image    : 38016
        Colorspace    : Unknown (00000000)
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 0, Height 0
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 0, Height 0
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Crop: Left 0, Top 0, Width 176, Height 144
Streaming Parameters Video Capture:
        Frames per second: 25.000 (25/1)
        Read buffers     : 0
#






No comments:

Post a Comment