# Flight Log Analysis

Reference: Dronecode Documentation

In this unit we will learn how to analyze post-flight telemetry data which is a crucial skill for debugging when things go wrong or the UAV doesn’t behave as expected.

The above reference list several software tools that can be used to analyze flight data from a PX4-based UAV. We will use our own version of the online tool Flight Review (Data Analysis Site, Documentation). If above site is not operational, you can use PX4’s Site (SEE WARNING BELOW)

## Analyze Pre-recorded Flight

To practice using FlightPlot we have recorded data from a test flight that you will download (i.e. clone from GitHub) and analyze.

### Import/Open Data

Clone the prerecorded flight data from the laboratory repository on GitHub: laboratory/flight_log_analysis/example_flight_log.ulg. Assuming you have already cloned this repo to your computer, make sure you are up to date by running git pull upstream master.

### Inspecting Data

Warning:

By using these online tools for flight data review, you will be uploading flight data to a server. If you use jupyter.beaver.works:9000, then the server is internal to MIT. If you use https://review.px4.io/, then you uploading to an external server.

To inspect the flight data:

1. open a internet browser and navigate to jupyter.beaver.works:9000. Alternatively, if the previous link does not work, you can use https://review.px4.io/. SEE WARNING ABOVE

2. Click “Choose File” next to ULog File

3. Use the pop-up to navigate to laboratory/flight_log_analysis/example_flight_log.ulg

4. Click Upload (you can leave all other fields blank). SEE WARNING ABOVE

5. Wait for the plots to load. Browse the various plots using the tools on the side of each plot to zoom in on areas of interest

6. Plots include data on:

• Local Position estimates and setpoints

• Velocity estimates and setpoints

• Yaw Angle and Yaw Angular rate estimates and setpoints

• RC inputs

• Parameter values

• Accelerometer data

• etc

### Problem Set

• At what time did the mode switch from Manual to Position Control?

• What was the maximum velocity?

• What was the maximum deviation between the estimate position and the target position in x, y, z?

• Can you describe the pattern or shape of the flight path during the Position Control portion of the flight?

• What is the maximum acceleration?

• At what time did the drone take off? At what time did it land?

• What is the maximum discrepancy between the estimate z-position and the height sensor reading?

• What are the parameter values for COM_POS_FS_EPH, EKF2_AID_MASK, and EKF2_HGT_MODE

Now that you know how to use a flight log analysis tool, take a look at one of your flights.

Your drone stores flight logs onboard in the location: /var/lib/mavlink-router/

You will need to first copy the flight log from the drone to your computer in order to analyze it. To do this, we will use secure copy (scp). From your laptop run the following, replacing <your-drone-name> and <timestamped-log-file-name> with the name of your drone and the flight log name, respectively.

scp uav@<your-drone-name>.beaver.works:/var/lib/mavlink-router/<timestamped-log-file-name>.ulg ~/laboratory/flight_log_analysis/


When you are done analyzing the the pre-recorded flight and your own flight, the team’s research specialist is to document the answers to the problem set in a markdown file (for example, you could call it flight_log_analysis_answers.md), add, commit, and push to your team’s documents repository.
[ ]: