Skip to main content

get_altitude()

Description#

This is a getter function which returns the current altitude of the drone.
It uses air pressure from the barometer sensor to estimate the altitude. This function returns the absolute altitude between the drone's current position and "sea level", not the floor.

Syntax#

get_height()

Parameters#

None

Returns#

The current height calculated by the difference between the current and the floor altitude(cm).

Example Code#
Python#
#Python code
import CoDrone_mini
drone = CoDrone_mini.CoDrone()
drone.pair()
altitude = drone.get_altitude()
print(altitude)
drone.close()