mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
Merge branch 'master' of github.com:paparazzi/paparazzi
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
#
|
||||
# disco.makefile
|
||||
#
|
||||
# http://wiki.paparazziuav.org/wiki/Parrot_Disco
|
||||
#
|
||||
|
||||
BOARD=disco
|
||||
@@ -39,8 +40,8 @@ $(TARGET).srcs += $(SRC_BOARD)/board.c
|
||||
|
||||
# Compile the video specific parts
|
||||
VIDEO_SRC = boards/bebop
|
||||
#$(TARGET).CFLAGS += -DI2C_BUF_LEN=56 -DUSE_I2C0
|
||||
#$(TARGET).srcs += $(VIDEO_SRC)/mt9v117.c $(VIDEO_SRC)/mt9f002.c modules/computer_vision/lib/isp/libisp.c modules/computer_vision/lib/isp/libisp_config.c
|
||||
$(TARGET).CFLAGS += -DI2C_BUF_LEN=56 -DUSE_I2C0
|
||||
$(TARGET).srcs += $(VIDEO_SRC)/mt9v117.c $(VIDEO_SRC)/mt9f002.c modules/computer_vision/lib/isp/libisp.c modules/computer_vision/lib/isp/libisp_config.c
|
||||
|
||||
# Link static (Done for GLIBC)
|
||||
$(TARGET).CFLAGS += -DLINUX_LINK_STATIC
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</doc>
|
||||
<autoload name="imu_common"/>
|
||||
<autoload name="imu_nps"/>
|
||||
<!--autoload name="sonar_bebop"/-->
|
||||
<autoload name="sonar_bebop"/>
|
||||
<header>
|
||||
<file name="imu_disco.h" dir="subsystems/imu"/>
|
||||
</header>
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
<conf>
|
||||
<aircraft
|
||||
name="Disco"
|
||||
ac_id="241"
|
||||
airframe="airframes/OPENUAS/openuas_parrot_disco.xml"
|
||||
radio="radios/spektrum.xml"
|
||||
telemetry="telemetry/default_fixedwing_imu.xml"
|
||||
flight_plan="flight_plans/versatile.xml"
|
||||
settings="settings/fixedwing_basic.xml"
|
||||
settings_modules="modules/digital_cam_video.xml modules/video_rtp_stream.xml modules/video_capture.xml modules/nav_smooth.xml modules/nav_survey_poly_osam.xml modules/geo_mag.xml modules/air_data.xml modules/gps.xml modules/nav_basic_fw.xml modules/guidance_full_pid_fw.xml modules/stabilization_adaptive_fw.xml modules/ahrs_float_cmpl_quat.xml modules/tune_airspeed.xml modules/airspeed_ms45xx_i2c.xml modules/imu_common.xml"
|
||||
gui_color="#f39cf39cf39c"
|
||||
/>
|
||||
<aircraft
|
||||
name="EFlite-T28"
|
||||
ac_id="230"
|
||||
@@ -41,7 +52,7 @@
|
||||
telemetry="telemetry/default_rotorcraft.xml"
|
||||
flight_plan="flight_plans/rotorcraft_survey.xml"
|
||||
settings="settings/rotorcraft_basic.xml settings/estimation/ahrs_secondary.xml"
|
||||
settings_modules="modules/digital_cam_video.xml modules/video_capture.xml modules/nav_survey_poly_rotorcraft.xml modules/nav_survey_rectangle_rotorcraft.xml modules/video_rtp_stream.xml modules/cv_blob_locator.xml modules/air_data.xml modules/geo_mag.xml modules/ins_extended.xml modules/ahrs_int_cmpl_quat.xml modules/stabilization_indi_simple.xml modules/nav_basic_rotorcraft.xml modules/guidance_rotorcraft.xml modules/gps.xml modules/imu_common.xml"
|
||||
settings_modules="modules/digital_cam_video.xml modules/video_capture.xml modules/nav_survey_poly_rotorcraft.xml modules/nav_survey_rectangle_rotorcraft.xml modules/video_rtp_stream.xml modules/cv_blob_locator.xml modules/air_data.xml modules/geo_mag.xml modules/guidance_indi.xml modules/ins_extended.xml modules/ahrs_int_cmpl_quat.xml modules/stabilization_indi_simple.xml modules/nav_basic_rotorcraft.xml modules/guidance_rotorcraft.xml modules/gps.xml modules/imu_common.xml"
|
||||
gui_color="#ffffe8b36503"
|
||||
/>
|
||||
<aircraft
|
||||
|
||||
@@ -37,39 +37,39 @@
|
||||
#include "boards/bebop/mt9f002.h"
|
||||
|
||||
/* Initialize MT9F002 chipset (Front camera) */
|
||||
//struct mt9f002_t mt9f002 = {
|
||||
// // Precomputed values to go from InputCLK of (26/2)MHz to 96MH
|
||||
// .interface = MT9F002_PARALLEL,
|
||||
// .input_clk_freq = (26 / 2),
|
||||
// .vt_pix_clk_div = 7,
|
||||
// .vt_sys_clk_div = 1,
|
||||
// .pre_pll_clk_div = 1,
|
||||
// .pll_multiplier = 59,
|
||||
// .op_pix_clk_div = 8,
|
||||
// .op_sys_clk_div = 1,
|
||||
// .shift_vt_pix_clk_div = 1,
|
||||
// .rowSpeed_2_0 = 1,
|
||||
// .row_speed_10_8 = 1,
|
||||
//
|
||||
// // Initial values
|
||||
// .target_fps = MT9F002_TARGET_FPS,
|
||||
// .target_exposure = MT9F002_TARGET_EXPOSURE,
|
||||
// .gain_green1 = MT9F002_GAIN_GREEN1,
|
||||
// .gain_blue = MT9F002_GAIN_BLUE,
|
||||
// .gain_red = MT9F002_GAIN_RED,
|
||||
// .gain_green2 = MT9F002_GAIN_GREEN2,
|
||||
// .output_width = MT9F002_OUTPUT_WIDTH,
|
||||
// .output_height = MT9F002_OUTPUT_HEIGHT,
|
||||
// .output_scaler = MT9F002_OUTPUT_SCALER,
|
||||
// .offset_x = MT9F002_INITIAL_OFFSET_X,
|
||||
// .offset_y = MT9F002_INITIAL_OFFSET_Y,
|
||||
//
|
||||
// .x_odd_inc = MT9F002_X_ODD_INC_VAL,
|
||||
// .y_odd_inc = MT9F002_Y_ODD_INC_VAL,
|
||||
//
|
||||
// // I2C connection port
|
||||
// .i2c_periph = &i2c0
|
||||
//};
|
||||
struct mt9f002_t mt9f002 = {
|
||||
// Precomputed values to go from InputCLK of (26/2)MHz to 96MH
|
||||
.interface = MT9F002_PARALLEL,
|
||||
.input_clk_freq = (26 / 2),
|
||||
.vt_pix_clk_div = 7,
|
||||
.vt_sys_clk_div = 1,
|
||||
.pre_pll_clk_div = 1,
|
||||
.pll_multiplier = 59,
|
||||
.op_pix_clk_div = 8,
|
||||
.op_sys_clk_div = 1,
|
||||
.shift_vt_pix_clk_div = 1,
|
||||
.rowSpeed_2_0 = 1,
|
||||
.row_speed_10_8 = 1,
|
||||
|
||||
// Initial values
|
||||
.target_fps = MT9F002_TARGET_FPS,
|
||||
.target_exposure = MT9F002_TARGET_EXPOSURE,
|
||||
.gain_green1 = MT9F002_GAIN_GREEN1,
|
||||
.gain_blue = MT9F002_GAIN_BLUE,
|
||||
.gain_red = MT9F002_GAIN_RED,
|
||||
.gain_green2 = MT9F002_GAIN_GREEN2,
|
||||
.output_width = MT9F002_OUTPUT_WIDTH,
|
||||
.output_height = MT9F002_OUTPUT_HEIGHT,
|
||||
.output_scaler = MT9F002_OUTPUT_SCALER,
|
||||
.offset_x = MT9F002_INITIAL_OFFSET_X,
|
||||
.offset_y = MT9F002_INITIAL_OFFSET_Y,
|
||||
|
||||
.x_odd_inc = MT9F002_X_ODD_INC_VAL,
|
||||
.y_odd_inc = MT9F002_Y_ODD_INC_VAL,
|
||||
|
||||
// I2C connection port
|
||||
.i2c_periph = &i2c0
|
||||
};
|
||||
|
||||
static int kill_gracefull(char *process_name)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ static int kill_gracefull(char *process_name)
|
||||
void board_init(void)
|
||||
{
|
||||
/*
|
||||
* Process running by default for firmware >= v1.98
|
||||
* Process running by default for firmware >= v1.0.5
|
||||
*
|
||||
* - /bin/sh - /usr/bin/DragonStarter.sh -out2null
|
||||
* - //usr/bin/dragon-prog
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015
|
||||
* Copyright (C) 2015 The Paparazzi Team
|
||||
*
|
||||
* This file is part of Paparazzi.
|
||||
*
|
||||
@@ -26,7 +26,6 @@
|
||||
// Own header
|
||||
#include "modules/computer_vision/video_thread.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -42,11 +41,11 @@
|
||||
|
||||
#include "mcu_periph/sys_time.h"
|
||||
|
||||
// include board for bottom_camera and front_camera on ARDrone2 and Bebop
|
||||
// include board for bottom_camera and front_camera on ARDrone2, Bebop and Disco
|
||||
#include BOARD_CONFIG
|
||||
|
||||
// Bebop uses ISP
|
||||
#ifdef BOARD_BEBOP
|
||||
// Bebop and Disco can use the ISP (Image Signal Processors) to speed up thing
|
||||
#if defined(BOARD_BEBOP) || defined(BOARD_DISCO)
|
||||
#include "lib/isp/libisp.h"
|
||||
#endif
|
||||
|
||||
@@ -79,7 +78,6 @@ void video_thread_periodic(void)
|
||||
/* currently no direct periodic functionality */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles all the video streaming and saving of the image shots
|
||||
* This is a separate thread, so it needs to be thread safe!
|
||||
@@ -95,7 +93,7 @@ static void *video_thread_function(void *data)
|
||||
|
||||
// create the images
|
||||
if (vid->filters & VIDEO_FILTER_DEBAYER) {
|
||||
// fixme: don't hardcode size, works for bebop front camera for now
|
||||
// fixme: don't hardcode size, works for Bebop front camera for now
|
||||
#define IMG_FLT_SIZE 272
|
||||
image_create(&img_color, IMG_FLT_SIZE, IMG_FLT_SIZE, IMAGE_YUV422);
|
||||
}
|
||||
@@ -106,14 +104,14 @@ static void *video_thread_function(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BOARD_BEBOP
|
||||
#if defined(BOARD_BEBOP) || defined(BOARD_DISCO)
|
||||
// Configure ISP if needed
|
||||
if (vid->filters & VIDEO_FILTER_ISP) {
|
||||
configure_isp(vid->thread.dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
// be nice to the more important stuff
|
||||
// Be nice to the more important stuff
|
||||
set_nice_level(VIDEO_THREAD_NICE_LEVEL);
|
||||
fprintf(stdout, "[%s] Set nice level to %i.\n", print_tag, VIDEO_THREAD_NICE_LEVEL);
|
||||
|
||||
@@ -126,7 +124,7 @@ static void *video_thread_function(void *data)
|
||||
vid->thread.is_running = true;
|
||||
while (vid->thread.is_running) {
|
||||
|
||||
// get time in us since last run
|
||||
// Get time in us since last run
|
||||
clock_gettime(CLOCK_MONOTONIC, &time_now);
|
||||
uint32_t dt_us = sys_time_elapsed_us(&time_prev, &time_now);
|
||||
time_prev = time_now;
|
||||
@@ -145,10 +143,10 @@ static void *video_thread_function(void *data)
|
||||
struct image_t img;
|
||||
v4l2_image_get(vid->thread.dev, &img);
|
||||
|
||||
// pointer to the final image to pass for saving and further processing
|
||||
// Pointer to the final image to pass for saving and further processing
|
||||
struct image_t *img_final = &img;
|
||||
|
||||
// run selected filters
|
||||
// Run selected filters
|
||||
if (vid->filters & VIDEO_FILTER_DEBAYER) {
|
||||
BayerToYUV(&img, &img_color, 0, 0);
|
||||
// use color image for further processing
|
||||
@@ -171,7 +169,7 @@ static bool initialize_camera(struct video_config_t *camera)
|
||||
{
|
||||
// Initialize the V4L2 subdevice if needed
|
||||
if (camera->subdev_name != NULL) {
|
||||
// FIXME! add subdev format to config, only needed on bebop front camera so far
|
||||
// FIXME! add subdev format to config, only needed on Bebop/Disco(?) front camera so far
|
||||
if (!v4l2_init_subdev(camera->subdev_name, 0, camera->subdev_format, camera->sensor_size)) {
|
||||
printf("[video_thread] Could not initialize the %s subdevice.\n", camera->subdev_name);
|
||||
return false;
|
||||
@@ -185,7 +183,7 @@ static bool initialize_camera(struct video_config_t *camera)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize OK
|
||||
// Initialized just fine
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -278,7 +276,6 @@ void video_thread_start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stops the streaming of all cameras
|
||||
* This could take some time, because the thread is stopped asynchronous.
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
/** @file modules/loggers/file_logger.c
|
||||
* @brief File logger for Linux based autopilots
|
||||
* This module purpose is for debugging airframest
|
||||
*/
|
||||
|
||||
#include "file_logger.h"
|
||||
@@ -30,7 +31,17 @@
|
||||
#include "std.h"
|
||||
|
||||
#include "subsystems/imu.h"
|
||||
|
||||
/* Ugly fix until Fixedwing and rotorcraft are uniofied in a nice way
|
||||
* COMMAND_THRUST only and always defined in ROTORCRAFT
|
||||
* A gliding Rotorcraft is an ecxeption ;) */
|
||||
#ifdef COMMAND_THRUST
|
||||
#include "firmwares/rotorcraft/stabilization.h"
|
||||
#else
|
||||
/* adaptive also an option */
|
||||
#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
|
||||
#endif
|
||||
|
||||
#include "state.h"
|
||||
|
||||
/** Set the default File logger path to the USB drive */
|
||||
@@ -61,7 +72,12 @@ void file_logger_start(void)
|
||||
if (file_logger != NULL) {
|
||||
fprintf(
|
||||
file_logger,
|
||||
/* Add and removed values here as wished to log */
|
||||
#ifdef COMMAND_THRUST
|
||||
"counter,gyro_unscaled_p,gyro_unscaled_q,gyro_unscaled_r,accel_unscaled_x,accel_unscaled_y,accel_unscaled_z,mag_unscaled_x,mag_unscaled_y,mag_unscaled_z,COMMAND_THRUST,COMMAND_ROLL,COMMAND_PITCH,COMMAND_YAW,qi,qx,qy,qz\n"
|
||||
#else
|
||||
"counter,gyro_unscaled_p,gyro_unscaled_q,gyro_unscaled_r,accel_unscaled_x,accel_unscaled_y,accel_unscaled_z,mag_unscaled_x,mag_unscaled_y,mag_unscaled_z,qi,qx,qy,qz\n"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -75,7 +91,7 @@ void file_logger_stop(void)
|
||||
}
|
||||
}
|
||||
|
||||
/** Log the values to a csv file */
|
||||
/** Log the values to a CSV file */
|
||||
void file_logger_periodic(void)
|
||||
{
|
||||
if (file_logger == NULL) {
|
||||
@@ -84,6 +100,8 @@ void file_logger_periodic(void)
|
||||
static uint32_t counter;
|
||||
struct Int32Quat *quat = stateGetNedToBodyQuat_i();
|
||||
|
||||
/* Add and removed values here as wished to log */
|
||||
#ifdef COMMAND_THRUST
|
||||
fprintf(file_logger, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
counter,
|
||||
imu.gyro_unscaled.p,
|
||||
@@ -96,6 +114,7 @@ void file_logger_periodic(void)
|
||||
imu.mag_unscaled.y,
|
||||
imu.mag_unscaled.z,
|
||||
stabilization_cmd[COMMAND_THRUST],
|
||||
stabilization_cmd[COMMAND_THROTTLE],
|
||||
stabilization_cmd[COMMAND_ROLL],
|
||||
stabilization_cmd[COMMAND_PITCH],
|
||||
stabilization_cmd[COMMAND_YAW],
|
||||
@@ -104,5 +123,36 @@ void file_logger_periodic(void)
|
||||
quat->qy,
|
||||
quat->qz
|
||||
);
|
||||
#else
|
||||
fprintf(file_logger, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
counter,
|
||||
imu.gyro_unscaled.p,
|
||||
imu.gyro_unscaled.q,
|
||||
imu.gyro_unscaled.r,
|
||||
imu.accel_unscaled.x,
|
||||
imu.accel_unscaled.y,
|
||||
imu.accel_unscaled.z,
|
||||
imu.mag_unscaled.x,
|
||||
imu.mag_unscaled.y,
|
||||
imu.mag_unscaled.z,
|
||||
/* imu.gyro_scaled.p,
|
||||
imu.gyro_scaled.q,
|
||||
imu.gyro_scaled.r,
|
||||
imu.accel_scaled.x,
|
||||
imu.accel_scaled.y,
|
||||
imu.accel_scaled.z,
|
||||
imu.mag_scaled.x,
|
||||
imu.mag_scaled.y,
|
||||
imu.mag_scaled.z, */
|
||||
//stabilization_cmd[COMMAND_THROTTLE],
|
||||
//stabilization_cmd[COMMAND_ROLL],
|
||||
//stabilization_cmd[COMMAND_PITCH],
|
||||
////stabilization_cmd[COMMAND_PITCH], //for time being...
|
||||
quat->qi,
|
||||
quat->qx,
|
||||
quat->qy,
|
||||
quat->qz
|
||||
);
|
||||
#endif
|
||||
counter++;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,16 @@ PRINT_CONFIG_VAR(DISCO_MPU_I2C_DEV)
|
||||
#define DISCO_LOWPASS_FILTER MPU60X0_DLPF_42HZ
|
||||
#define DISCO_SMPLRT_DIV 9
|
||||
PRINT_CONFIG_MSG("Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
|
||||
#elif PERIODIC_FREQUENCY == 512
|
||||
/* Accelerometer: Bandwidth 260Hz, Delay 0ms
|
||||
* Gyroscope: Bandwidth 256Hz, Delay 0.98ms sampling 8kHz
|
||||
*/
|
||||
#define DISCO_LOWPASS_FILTER MPU60X0_DLPF_256HZ
|
||||
#define DISCO_SMPLRT_DIV 3
|
||||
PRINT_CONFIG_MSG("Gyro/Accel output rate is 2kHz at 8kHz internal sampling")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PRINT_CONFIG_VAR(DISCO_SMPLRT_DIV)
|
||||
PRINT_CONFIG_VAR(DISCO_LOWPASS_FILTER)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user