Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[log] start support of flight recorder
- Loading branch information
1 parent
fe2db94
commit dd19ecd
Showing
7 changed files
with
282 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE telemetry SYSTEM "telemetry.dtd"> | ||
<telemetry> | ||
<process name="Ap"> | ||
<mode name="default"> | ||
<message name="AUTOPILOT_VERSION" period="11.1"/> | ||
<message name="AIRSPEED" period="1"/> | ||
<message name="ALIVE" period="5.1"/> | ||
<message name="GPS" period="0.25"/> | ||
<message name="NAVIGATION" period="1."/> | ||
<message name="ATTITUDE" period="0.1"/> | ||
<message name="ESTIMATOR" period="0.5"/> | ||
<message name="ENERGY" period="2.4"/> | ||
<message name="WP_MOVED" period="0.5"/> | ||
<message name="CIRCLE" period="1.05"/> | ||
<message name="DESIRED" period="0.2"/> | ||
<message name="BAT" period="1.1"/> | ||
<message name="SEGMENT" period="1.2"/> | ||
<message name="CALIBRATION" period="2.1"/> | ||
<message name="NAVIGATION_REF" period="9."/> | ||
<message name="PPRZ_MODE" period="4.9"/> | ||
<message name="SETTINGS" period="5."/> | ||
<message name="STATE_FILTER_STATUS" period="2.2"/> | ||
<message name="DATALINK_REPORT" period="5.1"/> | ||
<message name="DL_VALUE" period="1.5"/> | ||
<message name="IR_SENSORS" period="1.2"/> | ||
<message name="SURVEY" period="2.1"/> | ||
<message name="GPS_SOL" period="2.0"/> | ||
<message name="IMU_ACCEL" period=".8"/> | ||
<message name="IMU_GYRO" period=".6"/> | ||
<message name="IMU_MAG" period="1.3"/> | ||
<message name="CAM" period="0.5"/> | ||
<message name="CAM_POINT" period="1.0"/> | ||
<message name="COMMANDS" period="5"/> | ||
<message name="FBW_STATUS" period="2"/> | ||
<message name="AIR_DATA" period="1.3"/> | ||
</mode> | ||
<mode name="minimal"> | ||
<message name="ALIVE" period="5"/> | ||
<message name="ATTITUDE" period="4"/> | ||
<message name="GPS" period="1.05"/> | ||
<message name="ESTIMATOR" period="1.3"/> | ||
<message name="WP_MOVED" period="1.4"/> | ||
<message name="CIRCLE" period="3.05"/> | ||
<message name="DESIRED" period="4.05"/> | ||
<message name="BAT" period="1.1"/> | ||
<message name="SEGMENT" period="3.2"/> | ||
<message name="CALIBRATION" period="5.1"/> | ||
<message name="NAVIGATION_REF" period="9."/> | ||
<message name="NAVIGATION" period="3."/> | ||
<message name="PPRZ_MODE" period="5."/> | ||
<message name="STATE_FILTER_STATUS" period="5."/> | ||
<message name="DATALINK_REPORT" period="5.1"/> | ||
<message name="DL_VALUE" period="1.5"/> | ||
<message name="IR_SENSORS" period="5.2"/> | ||
<message name="SURVEY" period="2.1"/> | ||
<message name="GPS_SOL" period="5.0"/> | ||
</mode> | ||
<mode name="extremal"> | ||
<message name="ALIVE" period="5"/> | ||
<message name="GPS" period="5.1"/> | ||
<message name="ESTIMATOR" period="5.3"/> | ||
<message name="BAT" period="10.1"/> | ||
<message name="DESIRED" period="10.2"/> | ||
<message name="NAVIGATION" period="5.4"/> | ||
<message name="PPRZ_MODE" period="7.5"/> | ||
<message name="STATE_FILTER_STATUS" period="8."/> | ||
<message name="DATALINK_REPORT" period="5.7"/> | ||
</mode> | ||
<mode name="raw_sensors"> | ||
<message name="DL_VALUE" period="0.5"/> | ||
<message name="ALIVE" period="2.1"/> | ||
<message name="IMU_ACCEL_RAW" period=".05"/> | ||
<message name="IMU_GYRO_RAW" period=".05"/> | ||
<message name="IMU_MAG_RAW" period=".05"/> | ||
<message name="BARO_RAW" period="0.5"/> | ||
</mode> | ||
<mode name="scaled_sensors"> | ||
<message name="DL_VALUE" period="0.5"/> | ||
<message name="ALIVE" period="2.1"/> | ||
<message name="IMU_GYRO" period=".075"/> | ||
<message name="IMU_ACCEL" period=".075"/> | ||
<message name="IMU_MAG" period=".1"/> | ||
</mode> | ||
<mode name="debug_imu"> | ||
<message name="ATTITUDE" period="0.1"/> | ||
<message name="ALIVE" period="5"/> | ||
<message name="GPS" period="5.1"/> | ||
<message name="ESTIMATOR" period="5.3"/> | ||
<message name="BAT" period="10.1"/> | ||
<message name="DESIRED" period="10.2"/> | ||
<message name="NAVIGATION" period="5.4"/> | ||
<message name="PPRZ_MODE" period="5.5"/> | ||
<message name="STATE_FILTER_STATUS" period="5."/> | ||
<message name="DATALINK_REPORT" period="5.7"/> | ||
<message name="IMU_ACCEL" period=".5"/> | ||
<message name="IMU_GYRO" period=".5"/> | ||
<message name="IMU_MAG" period=".5"/> | ||
<message name="IMU_ACCEL_RAW" period=".5"/> | ||
<message name="IMU_GYRO_RAW" period=".5"/> | ||
<message name="IMU_MAG_RAW" period=".5"/> | ||
</mode> | ||
</process> | ||
<process name="Fbw"> | ||
<mode name="default"> | ||
<message name="COMMANDS" period="5"/> | ||
<message name="FBW_STATUS" period="2"/> | ||
<message name="ACTUATORS" period="5"/> <!-- For trimming --> | ||
</mode> | ||
<mode name="debug"> | ||
<message name="PPM" period="0.5"/> | ||
<message name="RC" period="0.5"/> | ||
<message name="COMMANDS" period="0.5"/> | ||
<message name="FBW_STATUS" period="1"/> | ||
<message name="ACTUATORS" period="5"/> <!-- For trimming --> | ||
</mode> | ||
</process> | ||
<process name="FlightRecorder"> | ||
<mode name="default"> | ||
<message name="BAT" period="0.5"/> | ||
<message name="ENERGY" period="0.5"/> | ||
<message name="GPS" period="0.2"/> | ||
<message name="ATTITUDE" period="0.05"/> | ||
<message name="DESIRED" period="0.05"/> | ||
<message name="IMU_ACCEL" period=".02"/> | ||
<message name="IMU_GYRO" period=".02"/> | ||
<message name="IMU_MAG" period=".02"/> | ||
<message name="AIR_DATA" period="0.5"/> | ||
<message name="RC" period="0.05"/> | ||
<message name="COMMANDS" period="0.05"/> | ||
<message name="ACTUATORS" period="0.05"/> | ||
<message name="PPRZ_MODE" period="1.0"/> | ||
<message name="FBW_MODE" period="1.0"/> | ||
<message name="NAVIGATION" period="1.0"/> | ||
<message name="DATALINK_REPORT" period="1.0"/> | ||
</mode> | ||
</process> | ||
</telemetry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (C) 2015 Gautier Hattenberger <gautier.hattenberger@enac.fr> | ||
* | ||
* 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 "modules/loggers/flight_recorder.c" | ||
* @author Gautier Hattenberger <gautier.hattenberger@enac.fr> | ||
* Record flight data according to your telemetry file | ||
*/ | ||
|
||
#define PERIODIC_C_FLIGHTRECORDER | ||
|
||
#include "modules/loggers/flight_recorder.h" | ||
|
||
#include "subsystems/datalink/telemetry.h" | ||
#include "subsystems/datalink/pprzlog_transport.h" | ||
|
||
#if FLIGHTRECORDER_SDLOG | ||
|
||
#include "sdLog.h" | ||
#include "subsystems/chibios-libopencm3/chibios_sdlog.h" | ||
static struct chibios_sdlog flightrecorder_sdlog; | ||
#ifndef FLIGHTRECORDER_DEVICE | ||
#define FLIGHTRECORDER_DEVICE flightrecorder_sdlog | ||
#else | ||
#warning "SD log is activated, but FLIGHTRECORDER_DEVICE is alreay set (should not be defined)" | ||
#endif | ||
|
||
// Functions for the generic device API | ||
static int sdlog_check_free_space(struct chibios_sdlog* p __attribute__((unused)), uint8_t len __attribute__((unused))) | ||
{ | ||
return TRUE; | ||
} | ||
|
||
static void sdlog_transmit(struct chibios_sdlog* p __attribute__((unused)), uint8_t byte) | ||
{ | ||
sdLogWriteByte(&flightRecorderLogFile, byte); | ||
} | ||
|
||
static void sdlog_send(struct chibios_sdlog* p __attribute__((unused))) { } | ||
|
||
#else | ||
// include downlink for other devices | ||
#include "subsystems/datalink/downlink.h" | ||
#endif | ||
|
||
void flight_recorder_init() | ||
{ | ||
#if FLIGHTRECORDER_SDLOG | ||
flightrecorder_sdlog.device.periph = (void *)(&flightrecorder_sdlog); | ||
flightrecorder_sdlog.device.check_free_space = (check_free_space_t) sdlog_check_free_space; | ||
flightrecorder_sdlog.device.transmit = (transmit_t) sdlog_transmit; | ||
flightrecorder_sdlog.device.send_message = (send_message_t) sdlog_send; | ||
#endif | ||
} | ||
|
||
void flight_recorder_periodic() | ||
{ | ||
#if FLIGHTRECORDER_SDLOG | ||
// test if sd log is ready | ||
if (flightRecorderLogFile.fs == NULL) return; | ||
#endif | ||
|
||
#if PERIODIC_TELEMETRY | ||
periodic_telemetry_send_FlightRecorder(DefaultPeriodic, &pprzlog_tp.trans_tx, &(FLIGHTRECORDER_DEVICE).device); | ||
#endif | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (C) 2015 Gautier Hattenberger <gautier.hattenberger@enac.fr> | ||
* | ||
* 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 "modules/loggers/flight_recorder.h" | ||
* @author Gautier Hattenberger <gautier.hattenberger@enac.fr> | ||
* Record flight data according to your telemetry file | ||
*/ | ||
|
||
#ifndef FLIGHT_RECORDER_H | ||
#define FLIGHT_RECORDER_H | ||
|
||
/** Init function | ||
*/ | ||
extern void flight_recorder_init(void); | ||
|
||
/** Periodic function | ||
* | ||
* should be called at TELEMETRY_FREQUENCY | ||
*/ | ||
extern void flight_recorder_periodic(void); | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters