Page 1 of 1

Get position crazyflie for output uart

Posted: Mon Sep 07, 2020 3:43 pm
by Hubert
Hi all,

This might be a very simple question, but how/where can I get the current position as estimated by the crazyflie?
I need to print this over the serial port about every second, and I'm getting kind of lost in the kalman filter.

(ps. I'm using the loco uwb deck for the positioning)


Thanks!

Re: Get position crazyflie for output uart

Posted: Wed Sep 09, 2020 1:59 pm
by kristoffer
Hi!

I think the easiest way to do this is to create an app in the firmware. You can find some (still very few) examples in https://github.com/bitcraze/crazyflie-f ... 9/examples. This way you will not have to modify the firmware and your app will be easy to port to new releases of the firmware.

The push demo should be a good starting point and inspiration.

This https://github.com/bitcraze/crazyflie-f ... ush.c#L112 shows how to read a log variable. The current position estimate is available as log variables here https://github.com/bitcraze/crazyflie-f ... #L637-L640

The UARTs are available in https://github.com/bitcraze/crazyflie-f ... ce/uart1.h and uart2.h. If you search for uart1Init you will find a bunch of examples of how they are used elsewhere.

Re: Get position crazyflie for output uart

Posted: Mon Sep 14, 2020 12:03 pm
by Hubert
Thanks! That is exactly what I needed.

I am still having one other is now though, I'm also 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 ");
    }
}

Re: Get position crazyflie for output uart

Posted: Tue Sep 15, 2020 2:52 pm
by kristoffer
Hi!

Could you please post this as a new thread to avoid multiple questions in one thread?

Re: Get position crazyflie for output uart

Posted: Tue Sep 15, 2020 7:11 pm
by Hubert
Sure!

The thread can be found here:
viewtopic.php?f=6&t=4454&p=20314#p20314