Skip to content

Commit

Permalink
[fixedwing] temporary fix for AHRS_TRIGGERED_ATTITUDE_LOOP
Browse files Browse the repository at this point in the history
should be a temporary fix for runing attitude_loop on a new AHRS estimate for now.
This *should* work under the conditions that the ABI callback that binds to a message first,
is actually called last when the message is sent.
So when a new GYRO message is sent, it should first run the AHRS callbacks
(and update the state interface with the new estimate) and then set new_ins_attitude.

This should be properly implemented or removed before the stable release...
  • Loading branch information
flixr committed Apr 22, 2015
1 parent ec8a400 commit 1535a96
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions sw/airborne/firmwares/fixedwing/main_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ tid_t monitor_tid; ///< id for monitor_task() timer
tid_t baro_tid; ///< id for baro_periodic() timer
#endif


/// @todo, properly implement or remove
#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
volatile uint8_t new_ins_attitude = 0;
static abi_event new_att_ev;
static void new_att_cb(uint8_t sender_id __attribute__((unused)),
uint32_t stamp __attribute__((unused)),
struct Int32Rates *gyro __attribute__((unused)))
{
new_ins_attitude = 1;
}
#endif


void init_ap(void)
{
#ifndef SINGLE_MCU /** init done in main_fbw in single MCU */
Expand All @@ -181,6 +195,11 @@ void init_ap(void)
ahrs_aligner_init();
#endif

///@todo: properly implement/fix a triggered attitude loop
#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
AbiBindMsgIMU_GYRO_INT32(ABI_BROADCAST, &new_att_ev, &new_att_cb);
#endif

#if USE_AHRS
ahrs_init();
#endif
Expand Down Expand Up @@ -534,10 +553,6 @@ void navigation_task(void)
}


#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
volatile uint8_t new_ins_attitude = 0;
#endif

void attitude_loop(void)
{

Expand Down

0 comments on commit 1535a96

Please sign in to comment.