Switching altitude measurement from downward ranger to upward

Firmware/software/electronics/mechanics
Post Reply
ricardo.halfeld
Beginner
Posts: 20
Joined: Tue May 22, 2018 1:40 pm

Switching altitude measurement from downward ranger to upward

Post by ricardo.halfeld » Wed Apr 03, 2019 11:54 am

Greetings,

in the continued attempt to fly the CF over non-flat grounds, I had a new idea. This occurred to me after acquiring a multiranger deck. In the vast majority of places we fly our CFs, the ceiling is much flatter and bump-free than our floors. My idea is to use the upward ranger on the multiranger deck to feed the EKF wherever the ground is non-flat or non-inertial.

My intent is to do so by changing a parameter. The firmware would be adapted to check for that parameter whenever trying to enqueue zranger or multiranger data into the Kalman filter. When toggling to upward, the first measurement would be used to define the absolute position of the ceiling, and the following measurements would be corrected with that value.

Any further thoughts?

arnaud
Bitcraze
Posts: 1928
Joined: Tue Feb 06, 2007 12:36 pm

Re: Switching altitude measurement from downward ranger to upward

Post by arnaud » Thu Apr 04, 2019 8:25 am

In principle I think that this should work fine. Practically though you might need two parameters: one to disable pushing the zranger to the EKF: https://github.com/bitcraze/crazyflie-f ... #L139-L147 and one to enable pushing the up-measurement into the EKF, all ranges from the multiranger end-up in range.c: https://github.com/bitcraze/crazyflie-f ... ange.c#L39.

This makes me think that pushing data to the EKF could be moved completely to range.c, and then a "up/down" parameter could be added there. The algorithm you describe for acquiring the offset to the ceiling, can be applied to get an initial ground sample as well.

ricardo.halfeld
Beginner
Posts: 20
Joined: Tue May 22, 2018 1:40 pm

Re: Switching altitude measurement from downward ranger to upward

Post by ricardo.halfeld » Thu Apr 11, 2019 1:46 pm

The code isn't decent. I essentially took every shortcut I could find. :p

That's why I won't post it.

But it seems to work just fine!

coreysnipes
Beginner
Posts: 14
Joined: Mon Jan 21, 2019 3:09 am
Location: Cleveland, OH, USA
Contact:

Re: Switching altitude measurement from downward ranger to upward

Post by coreysnipes » Fri Apr 12, 2019 4:02 pm

Very clever!

ricardo.halfeld
Beginner
Posts: 20
Joined: Tue May 22, 2018 1:40 pm

Re: Switching altitude measurement from downward ranger to upward

Post by ricardo.halfeld » Mon Apr 15, 2019 2:00 pm

arnaud wrote:
Thu Apr 04, 2019 8:25 am
This makes me think that pushing data to the EKF could be moved completely to range.c...
I'm trying my best to incorporate your suggestion into this branch, but there's so much to learn and so little time available to work on this...

FreeRTOS is very unfamiliar to me, but from what I gather I'll need to create an xTask (as in here and here) to push data into the estimator from range.c, right?
coreysnipes wrote:
Fri Apr 12, 2019 4:02 pm
Very clever!
Thanks! :D

Post Reply