Skip to main content

get_height()

Description#

This is a getter function which returns the current height of the drone. The default unit of measurement is centimeters.
This function uses the bottom range sensor to measure distance from the drone to the surface below the drone.

Syntax#

get_height()
get_height(unit="<cm, in, mm, m>)"

Parameters#

unit: The unit of measurement that is chosen for the height distance. Available units are "m" (meter), "cm" (centimeter), "mm" (millimeter), or "in" (inch). If a parameter is not specified cm is chosen by default.

Returns#

The current height calculated by the bottom range sensor (cm default).

Example Code#
Python#
#Python code
from codrone_edu.drone import *
drone = Drone()
drone.pair()
drone.takeoff()
drone.hover(3)
height = drone.get_height()
print(height)
drone.land()
drone.close()