[ahrs] actually save ahrs_x_last_stamp for imu lost detection

This commit is contained in:
Felix Ruess
2015-03-06 21:38:44 +01:00
parent 7e7a7a6f82
commit 708ab50660
5 changed files with 20 additions and 16 deletions
@@ -28,6 +28,8 @@
#include "subsystems/ahrs.h"
#include "subsystems/abi.h"
static uint32_t ahrs_fc_last_stamp;
#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
@@ -58,7 +60,6 @@ static void send_geo_mag(struct transport_tx *trans, struct link_device *dev)
#ifndef AHRS_FC_FILTER_ID
#define AHRS_FC_FILTER_ID 5
#endif
static uint32_t ahrs_fc_last_stamp;
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
{
@@ -90,9 +91,9 @@ static abi_event gps_ev;
static void gyro_cb(uint8_t __attribute__((unused)) sender_id,
uint32_t __attribute__((unused)) stamp,
struct Int32Rates *gyro)
uint32_t stamp, struct Int32Rates *gyro)
{
ahrs_fc_last_stamp = stamp;
#if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY)
PRINT_CONFIG_MSG("Calculating dt for AHRS_FC propagation.")
/* timestamp in usec when last callback was received */
@@ -28,6 +28,8 @@
#include "subsystems/ahrs.h"
#include "subsystems/abi.h"
static uint32_t ahrs_dcm_last_stamp;
#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
@@ -35,7 +37,6 @@
#ifndef AHRS_DCM_FILTER_ID
#define AHRS_DCM_FILTER_ID 6
#endif
static uint32_t ahrs_dcm_last_stamp;
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
{
@@ -65,9 +66,9 @@ static abi_event gps_ev;
static void gyro_cb(uint8_t __attribute__((unused)) sender_id,
uint32_t __attribute__((unused)) stamp,
struct Int32Rates *gyro)
uint32_t stamp, struct Int32Rates *gyro)
{
ahrs_dcm_last_stamp = stamp;
#if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY)
PRINT_CONFIG_MSG("Calculating dt for AHRS dcm propagation.")
/* timestamp in usec when last callback was received */
@@ -29,6 +29,8 @@
#include "subsystems/ahrs.h"
#include "subsystems/abi.h"
static uint32_t ahrs_mlkf_last_stamp;
#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
@@ -42,7 +44,6 @@ static void send_geo_mag(struct transport_tx *trans, struct link_device *dev)
#ifndef AHRS_MLKF_FILTER_ID
#define AHRS_MLKF_FILTER_ID 6
#endif
static uint32_t ahrs_mlkf_last_stamp;
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
{
@@ -73,9 +74,9 @@ static abi_event geo_mag_ev;
static void gyro_cb(uint8_t __attribute__((unused)) sender_id,
uint32_t __attribute__((unused)) stamp,
struct Int32Rates *gyro)
uint32_t stamp, struct Int32Rates *gyro)
{
ahrs_mlkf_last_stamp = stamp;
#if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY)
PRINT_CONFIG_MSG("Calculating dt for AHRS_MLKF propagation.")
/* timestamp in usec when last callback was received */
@@ -28,6 +28,8 @@
#include "subsystems/ahrs.h"
#include "subsystems/abi.h"
static uint32_t ahrs_ice_last_stamp;
#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
@@ -74,7 +76,6 @@ static void send_bias(struct transport_tx *trans, struct link_device *dev)
#ifndef AHRS_ICE_FILTER_ID
#define AHRS_ICE_FILTER_ID 4
#endif
static uint32_t ahrs_ice_last_stamp;
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
{
@@ -103,13 +104,12 @@ static abi_event body_to_imu_ev;
static void gyro_cb(uint8_t sender_id __attribute__((unused)),
uint32_t stamp __attribute__((unused)),
struct Int32Rates *gyro)
uint32_t stamp, struct Int32Rates *gyro)
{
ahrs_ice_last_stamp = stamp;
if (ahrs_ice.is_aligned) {
ahrs_ice_propagate(gyro);
}
}
static void accel_cb(uint8_t sender_id __attribute__((unused)),
@@ -28,6 +28,8 @@
#include "subsystems/ahrs.h"
#include "subsystems/abi.h"
static uint32_t ahrs_icq_last_stamp;
#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"
#include "mcu_periph/sys_time.h"
@@ -81,7 +83,6 @@ static void send_geo_mag(struct transport_tx *trans, struct link_device *dev)
#ifndef AHRS_ICQ_FILTER_ID
#define AHRS_ICQ_FILTER_ID 3
#endif
static uint32_t ahrs_icq_last_stamp;
static void send_filter_status(struct transport_tx *trans, struct link_device *dev)
{
@@ -113,9 +114,9 @@ static abi_event gps_ev;
static void gyro_cb(uint8_t __attribute__((unused)) sender_id,
uint32_t __attribute__((unused)) stamp,
struct Int32Rates *gyro)
uint32_t stamp, struct Int32Rates *gyro)
{
ahrs_icq_last_stamp = stamp;
#if USE_AUTO_AHRS_FREQ || !defined(AHRS_PROPAGATE_FREQUENCY)
PRINT_CONFIG_MSG("Calculating dt for AHRS_ICQ propagation.")
/* timestamp in usec when last callback was received */