## Would it not be possible to estimate height with just on-board sensors?

Firmware/software/electronics/mechanics
mnjn
Beginner
Posts: 4
Joined: Sun May 17, 2020 1:06 am

### Would it not be possible to estimate height with just on-board sensors?

So I've been digging through the Crazyflie 2.1 source code recently as I'm trying to build my own (much simpler haha) flight controller, and wondered about height estimation. I bought the Flow v2 deck as the website stated autonomous flying would not be possible without it as the deck provides data for the firmware to correctly estimate height.

But then I started thinking...

The on-board IMUs and pressure sensors seem perfectly capable (at least to me) of providing enough data to estimate height. For example, the IMU can measure acceleration and attitude, so just by itself (along with the microcontroller's timers) shouldn't you theoretically be able to get, say, the amount of acceleration in the y-axis (defined as the axis going up), take the derivative to get velocity, then another derivative to get position? You could also factor in the pressure sensor too, right? Doesn't it measure altitude? Or is it not good at measuring small altitude changes, like 20 cm or less.

With all this real-time info, wouldn't you just have to keep a history of position changes to know how far you are from your starting position (taken to be 0,0,0)?

I understand that sensors included in the Flow v2 deck would certainly help the estimation of height and position, but is it really necessary? Could I feasibly build firmware (using only the IMU and pressure sensor) that could take in commands such as "go up 10 cm", "go right 1 m", "go to relative position (1, 1, 1) (units: metres)"? And if not, why? What's preventing the calculation of derivatives and such? Is it just not accurate enough?

kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

### Re: Would it not be possible to estimate height with just on-board sensors?

Hi!

In theory you are right but the problem is that the accelerometers are too noisy. You can easily try it out with the normal firmware by switching to the kalman estimator without a deck (set param kalman.resetEstimation = 1). The kalman filter fuses information from the sensors that are available, including accelerometers and gyros, and if you don't have any deck attached this is all that will be used. The Crazyflie can typically fly like this a few seconds without drifting too far away.

In a small platform like the Crazyflie, vibrations from the motors add noise to the sensors since they are close and the platform is light weight. With good motors and well balanced propellers, the performance is a bit better.

You may also want to play with the on board barometer for height.

mnjn
Beginner
Posts: 4
Joined: Sun May 17, 2020 1:06 am

### Re: Would it not be possible to estimate height with just on-board sensors?

Awesome, thanks for the response! Totally makes sense that the sensors would be noisy.