PX4 / flight_review

web application for flight log analysis & review
https://logs.px4.io/
BSD 3-Clause "New" or "Revised" License
202 stars 195 forks source link

More readable angular plots with np.unwrap() #141

Closed pietrodn closed 5 years ago

pietrodn commented 5 years ago

Attitude plots (Roll Angle, Pitch Angle, Yaw Angle) are wrapped from -180° to 180°. This causes poor plots, with weird "jumps", when the drone passes the 180° threshold, e.g., by oscillating in yaw around 180°:

Yaw angle is jumping

By using the numpy.unwrap() method, we can avoid those jumps and obtain a more continuous graph. The following example is the same plot as before, with the patch applied:

With np.unwrap()

bkueng commented 5 years ago

Looks good, but what I don't like so much is that it can 'drift off' by an arbitrary amount, for example when flying circles (especially fixed-wings). E.g. https://logs.px4.io/plot_app?log=6452c397-a8a5-4ab9-a009-ebb6431360bd

pietrodn commented 5 years ago

You're right. However I can't think of a smart way to solve this problem. Would an interactive control to activate or deactivate unwrapping be an acceptable solution?

bkueng commented 5 years ago

However I can't think of a smart way to solve this problem.

I don't have a good solution either - except to check if the min/max exceeds a limit and use the old behavior in that case. But generally I'd like to add as little logic as possible to plots, to keep them simple to interprete.

Would an interactive control to activate or deactivate unwrapping be an acceptable solution?

Preferably not, to keep the interface simple.

We can do the change and then see if there are cases where this behavior is not acceptable.

bkueng commented 5 years ago

Merging now. A possible alternative would be to check if the the tracking error is > PI, and if so only adjust the estimated yaw.