Main Content

readHeight

Read current height of Parrot drone

Add-On Required: This feature requires the MATLAB Support Package for Parrot Drones add-on.

Description

[height,time] = readHeight(parrotObj) returns the current height above the takeoff surface in meters along with the time stamp of the Parrot® drone, specified as a parrot object. The function returns the height only after the drone has taken off. For a Parrot Mambo drone, before takeoff, the function returns a zero.

example

Examples

collapse all

Connect to a Parrot drone.

parrotObj = parrot('Mambo')
parrotObj = 
          parrot with properties:

                    Name: "Mambo"
                      ID: "Mambo_564853"
                   State: "landed"
            BatteryLevel: 50%
        AvailableCameras: ["FPV"]

Use the parrot object to initiate takeoff of the Parrot drone.

takeoff(parrotObj)

While the Parrot drone is in flight, read the height from the takeoff surface.

[height,time] = readHeight(parrotObj)
height = 
        0.8600
time = 
       datetime
       15-Mar-2019 14:07:19

Input Arguments

collapse all

Parrot drone connection object, specified as a parrot object.

Output Arguments

collapse all

The current height of the Parrot drone above the takeoff surface, specified in meters.

Data Types: double

The time at which the drone sends the measured height, specified as a datetime.

Data Types: datetime

Version History

Introduced in R2019a