Page 1 of 1

How to get the current height of the drone?

Posted: Fri Mar 15, 2019 3:10 am
by addaa
Looks like the height is just read from the hover height value that we set.
https://github.com/bitcraze/crazyflie-l ... er.py#L450

def get_height(self):
return self._hover_setpoint[self.ABS_Z_INDEX]

Is there a way we can read the height from the sensor data? Also do we need flow deck in order to get the current height? Or flow deck ust improves the height accuracy?

Reason I ask this is I failed to let it hover in a certain height (it always flies to the roof), so I want to debug with the code.

Thanks!

Re: How to get the current height of the drone?

Posted: Fri Mar 15, 2019 10:01 am
by tobias
If you are using the flow deck you can get the laser ranger distance in the log variable range.zrange. There is also a height estimate from the kalman filer which is called stateEstimate.z.

The flow deck measures the distance to the ground and is pretty accurate (cm range). There is also a pressure sensor that can do height estimate but this is not absolute and not that accurate (m range). So most likely you will need the flow deck.