How to get the current height of the drone?

Discussions about all things Bitcraze
Post Reply
addaa
Beginner
Posts: 2
Joined: Thu Mar 14, 2019 11:31 pm

How to get the current height of the drone?

Post by addaa » Fri Mar 15, 2019 3:10 am

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!

tobias
Bitcraze
Posts: 1818
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

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

Post by tobias » Fri Mar 15, 2019 10:01 am

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.

Post Reply