Page 1 of 1

Problems with Kalman Filter

Posted: Thu Jul 20, 2017 10:05 am
by suarez_ramon
I am using the controller made by Mike Hamer ( ... controller). Everything seems to be setup the correct way, the only problem I am having is that the output of the Kalman Filter implemented on board is very bad and diverges quickly after take off. Has anybody had this problem?

Re: Problems with Kalman Filter

Posted: Thu Jul 20, 2017 10:10 am
by arnaud
Since you are sending position update using the external position update port, you can look at the external position log variables to make sure the position really makes it to the Crazyflie. The log variables are defined there: ... #L194-L198, they are named ext_pos.X/Y/Z.

It means the the estimated position is correct before takeoff? Do you start the crazyflie with the front facing X? (like so: ... m/#intro18)

Re: Problems with Kalman Filter

Posted: Thu Oct 25, 2018 4:51 pm
by RozDavid
Hi @arnaud, @suarez_ramon,

I have been stopped with the very same problem as Suarez did a year before. Did you managed to somehow solve the problem? I checked that the external position is send to the subscribed topic, but after logging the ext_pos.x/y/z variables I always get a constant zero for all of them.... FYI onboard imu measurement works well, but with constant drift that is why I would need the external update for the kalman filter.
An other detail, that I use the latest commit from Mike's custom firmware.

Do you have an idea where can the error hide? Suarez, did you managed to solve the problem?
Your answer would help me a lot!!

Re: Problems with Kalman Filter

Posted: Fri Oct 26, 2018 5:32 am
by arnaud
Since you are talking of topic I assume you are using Crazyflie with the ROS driver?

What topic are you using to send the position? As part of Crazyswarm there has been a full-pose update packet that is not compatible with the non-crazyswarm firmware, it might be that you are sending this packet instead of the position-only update packet that updates the extpos.x/y/z log variables.

Re: Problems with Kalman Filter

Posted: Sat Oct 27, 2018 11:06 pm
by RozDavid
Yes I am using the ROS driver, but instead of the Crazyswarm I use Michael Hamers branch for the crazyflie_ros package: ... controller

If the crazyflie is accessed and added to the server for example under the name "cf", than I am sending the latest transform (at ros::Time(0) and not now) transforms from the Optitrack system through VRPN to the topic "cf/external_position".

As I echo the topic the data is streaming, but can not update the kalman filter measurement because, the ext_pos variable is still without value somehow in the firmware.

Do you have an idea, where can the root of the problem lie?
Could that be a problem, that with ros::time(0) the transform is not valid enough?
I mean this line in the control: ... new.c#L536

Thanks for your kind answer!

Re: Problems with Kalman Filter

Posted: Tue Oct 30, 2018 4:47 pm
by whoenig
Which ROS package are you using? The first link points to Mike's firmware, but not a fork of crazyflie_ros. It seems to me that perhaps there are some versioning issues (i.e., the data that is sent from the PC uses a different format than what's expected on the firmware side).