Get position crazyflie for output uart

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

Get position crazyflie for output uart

Post 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!
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Get position crazyflie for output uart

Post 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.
Hubert
Beginner
Posts: 7
Joined: Wed Sep 02, 2020 3:15 pm

Re: Get position crazyflie for output uart

Post 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 ");
    }
}
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Get position crazyflie for output uart

Post by kristoffer »

Hi!

Could you please post this as a new thread to avoid multiple questions in one thread?
Hubert
Beginner
Posts: 7
Joined: Wed Sep 02, 2020 3:15 pm

Re: Get position crazyflie for output uart

Post by Hubert »

Sure!

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