Retreiving anchor positions causes crash

Firmware/software/electronics/mechanics
Post Reply
Hubert
Beginner
Posts: 7
Joined: Wed Sep 02, 2020 3:15 pm

Retreiving anchor positions causes crash

Post by Hubert »

Hi All,

I'm trying to get the positions of the anchors, but calling the locoDeckGetAnchorPosition like this seems o make the software crash. The the console repeats ESTKALMAN: state out of bounds, resetting. Why does retrieving the anchor positions make the kalman filter crash?

Code: Select all

point_t point;
for(uint8_t id = 0; id < 7; id++)
{
    if(locoDeckGetAnchorPosition(id,&point))
    {
        DEBUG_PRINT(" id  returned true ");
    }
}
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Retreiving anchor positions causes crash

Post by kristoffer »

Hi!

The "ESTKALMAN: state out of bounds, resetting" message is displayed when the kalman estimator have an unreasonable view of the where the Crazyflie is or move (weird position or high velocity). It might happen if the kalman estimator don't get any sensor data for instance.

The locoDeckGetAnchorPosition() function uses a mutex to avoid problems when called from the memory sub system. If you call locoDeckGetAnchorPosition() from the task in locodeck.c and the mutex already is taken, you will hang the LPS deck task. Could this be the problem?
If you hang the task in the locodeck.c file, the LPS deck will stop ranging (the LEDs will stop blinking) and no measurements will be sent to the kalman estimator, resulting in a "ESTKALMAN: state out of bounds, resetting".

Where is your code located?
Post Reply