While flying, the Parrot Bebop Quadcopter (and the Bebop 2 Quadcopter) stores all flight information in a log file. This is a so called pud file and has a json structure.
This pud file includes the detailed flight information which is also used by Parrot to store the flights in their cloud (formerly known as ARDrone Academy, Drone Academy) and to perfrom the flight analysis, such as generating battery plot, speed plot and altitude plot.
The python library presented in this article allows to extract important flight information from the pud file. The data from the pud file (flight log) is processed and can be returned for further flight analysis.
This library takes the pud file as an input and is able to perform the following operations:
- Print (and return) necessary information about the Drone/Quadcopter such as serial number, software version, product version, steering device (Skycontroller, Skycontroller 2, iPhone, Tablet, etc.), flight duration, flight location, pilot location, hours of operation
- Additionally the library is able to determine the following: battery usage (%), nearest city for this flight, flight duration (min), max altitude (m), average speed (m/s), distance traveled (great circle in meters), distance traveled (vincenty in meters)
- This library is able to export the flight as a csv and gpx file. The gpx export is not perfect yet, it exports the gpx track including altitude and timestamp, speed is not implemented yet. Exporting as kml is planned but not yet implemented.
- The flight raw data can be exported, this may be helpful when doing further flight analysis such as generating plots and graphs, etc.
[code start:1lang:python]#Import the library
import DroneDataConversion # alt.:from DroneDataConversion import DroneDataConversion
#Get instance from it
flightManager = DroneDataConversion.BebopFlightDataManager(‘path/to/pud-file’)
calculate_distance_traveled_vincenty() —> calculates the vincenty distance the drone covered for this flight, please note that the altitude is not yet part of the calculation; it returns the distance in meter
calculate_distance_traveled_gc() —> calculates the great circle distance the drone covered for this flight, please note that the altitude is not yet part of the calculation; it returns the distance in meter, (for more information about great circle and vincenty distance: https://en.wikipedia.org/wiki/Great-circle_distance, https://en.wikipedia.org/wiki/Vincenty%27s_formulae)
Display_diagnostic_information_debug() —> prints diagnostic flight information and returns them as s list
Display_diagnostic_information_raw()—> same as above but without the data field description
determine_avg_speed() —> calculates the average speed for this flight and returns it (in m/s)
determine_max_altitude() —> determines the maximum altitude and returns it (in m)
get_nearest_city() —> does a request to an OSM database and returns the nearest city for this flight
get_battery_percentage() —> returns the battery usage for this flight (in %)
export_as_csv(‘/path/to/destination.csv’) —> converts the whole pud file to a csv file
export_as_gpx(‘/path/to/destination.gpx’, ‘myFlight’) —> converts the flight to a gpx track, the second parameter is optional and the track’s name
export_as_kml(‘/path/to/destination.kml’) —> converts the flight to kml, this is not implemented yet
takeoff_location_as_csv(‘/path/to/destination.csv’, waypoint_name=None) —> exports the takeoff location as csv containting the waypoint
takeoff_location_as_gpx(‘/path/to/destination.gpx’, waypoint_name=None) —> exports the takeoff location as gpx containting the waypoint
pass_flight_data() —> returns every data field as an array
[code start:1lang:python]# Passes flight data as arrays for further processing; Passing:
#seconds_airborne, latitude, longitude, altitude, speed, battery
sec, lat, lon, alt, spe, bat = flightManager.passFlightData()[/code]
The library can be used with pud files of the Bebop 2 (tested), as the Bebop 1 has the same firmware it seems compatible. I don’t know about the Disco Drone but hopefully Parrot will stick to the same data format.
This library requires/uses packages from the following libraries:
- https://pypi.python.org/pypi/gpxpy —> generating the GPX track
- https://pypi.python.org/pypi/geopy/ —> measuring the distance traveled (gc and vincenty); getting the nearest address for the flight location
This library is licensed under the Apache License Version 2, and is available via PyPI: https://pypi.python.org/pypi/DroneDataConversion
The source code is hosted on Bitbucket: https://bitbucket.org/flightreportmanagerteam/dronedataconversion