[video] main idea

This commit is contained in:
Christophe De Wagter
2015-09-04 21:26:09 +02:00
committed by Felix Ruess
parent bbe3144961
commit f94ccb8c89
6 changed files with 98 additions and 1 deletions
+21
View File
@@ -34,6 +34,27 @@
#warning No battery voltage measurement available! Please add <load name="bat_voltage_ardrone2.xml"/> to your modules.
#endif
#include "peripherals/video_device.h"
struct video_device_t front_camera = {
.w = 1280,
.h = 720,
.dev_name = "/dev/video1",
.subdev_name = NULL,
.format = V4L2_PIX_FMT_UYVY,
.filters = NULL
};
struct video_device_t bottom_camera = {
.w = 320,
.h = 240,
.dev_name = "/dev/video2",
.subdev_name = NULL,
.format = V4L2_PIX_FMT_UYVY,
.filters = NULL
};
void board_init(void)
{
// First we try to kill the program.elf and its respawner if it is running
+6
View File
@@ -3,10 +3,16 @@
#define BOARD_ARDRONE2
#include "peripherals/video_device.h"
#ifndef UART1_DEV
#define UART1_DEV /dev/ttyUSB0
#endif
/* Cameras */
extern struct video_device_t bottom_camera;
extern struct video_device_t front_camera;
/* Default actuators driver */
#define DEFAULT_ACTUATORS "boards/ardrone/actuators.h"
#define ActuatorDefaultSet(_x,_y) ActuatorArdroneSet(_x,_y)
+5
View File
@@ -25,6 +25,8 @@
#define BOARD_BEBOP
#include "peripherals/video_device.h"
/** uart connected to GPS internally */
#define UART1_DEV /dev/ttyPA1
@@ -34,6 +36,9 @@
#define ActuatorsDefaultInit() ActuatorsBebopInit()
#define ActuatorsDefaultCommit() ActuatorsBebopCommit()
/* Cameras */
extern struct video_device_t bottom_camera;
extern struct video_device_t front_camera;
/* by default activate onboard baro */
#ifndef USE_BARO_BOARD
+20
View File
@@ -37,6 +37,26 @@
#include <linux/i2c-dev.h>
#include <linux/types.h>
#include "boards/bebop.h"
struct video_device_t bottom_camera = {
.w = 640,
.h = 480,
.dev_name = "/dev/video0",
.subdev_name = NULL,
.format = V4L2_PIX_FMT_UYVY,
.filters = NULL
};
struct video_device_t front_camera = {
.w = 1408,
.h = 2112,
.dev_name = "/dev/video1",
.subdev_name = "/dev/v4l-subdev1",
.format = V4L2_PIX_FMT_SGBRG10,
.filters = NULL //{DeMosaic, AEC, ABW}
};
static bool_t write_reg(int fd, char *addr_val, uint8_t cnt)
{
char resp[cnt - 2];
@@ -33,7 +33,7 @@
#include <sys/time.h>
#include "std.h"
#include "lib/vision/image.h"
#include "modules/computer_vision/lib/vision/image.h"
#define V4L2_IMG_NONE 255 ///< There currently no image available
+45
View File
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2015
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
/**
* @file peripherals/video_device.h
* @brief v4l2 video device settings interface
* Works on Linux platforms
*/
#ifndef VIDEO_DEVICE_H
#define VIDEO_DEVICE_H
#include "std.h"
#include "modules/computer_vision/lib/v4l/v4l2.h"
/** V4L2 device settings */
struct video_device_t {
int w; ///< Width
int h; ///< Height
char* dev_name; ///< path to device
char* subdev_name; ///< path to sub device
uint32_t format; ///< Video format
void* filters; ///< filters to use
};
#endif /* VIDEO_DEVICE_H */