Open mrpollo opened 6 years ago
Probably filtering them out is best.
I wasn't sure if that was feasible, I don't think I grasp 100% of the math here, and I wasn't sure if filtering out NaN
would even be a problem.
I'll submit a PR shortly.
Tried filtering but I noticed setpoints on maps are not displayed correctly with the following change
+ a = sin_anchor_lat * sin_lat + cos_anchor_lat * cos_lat * cos_d_lon
+ arg = np.array([index for index in a if np.isfinite(index)])
Any ideas?
with filter
no filter
Not sure if this is related, but the following plots show NaN
regardless of this change
Can you provide the log(s)? It should not contain NaNs.
I randomly picked a log out of logs.px4.io/browse, I lost track of which one it was and since I'm not the original author I won't be re-uploading it to the site, instead here's a link to download that will probably remain available for a few weeks (sorry if you are reading this and the file is no longer available)
Thanks, I'll have a look. Log is here btw (the ID was still in the filename): https://logs.px4.io/plot_app?log=ba165f7d-113d-4c5d-b479-1fcf21e99175
For the lat
, lon
issue, you need to filter earlier, like this:
diff --git a/plot_app/helper.py b/plot_app/helper.py
index c2018eb..a26184c 100644
--- a/plot_app/helper.py
+++ b/plot_app/helper.py
@@ -218,6 +218,11 @@ def WGS84_to_mercator(lon, lat):
def map_projection(lat, lon, anchor_lat, anchor_lon):
""" convert lat, lon in [rad] to x, y in [m] with an anchor position """
+
+ # filter NaN values
+ lat = lat[~np.isnan(lat)]
+ lon = lon[~np.isnan(lon)]
+
sin_lat = np.sin(lat)
cos_lat = np.cos(lat)
cos_d_lon = np.cos(lon - anchor_lon)
The NaN's in attitude are valid and fixed in https://github.com/PX4/flight_review/pull/140.
In plot_app/helper.py#227-229
Consider the following conditionals
for the following example value of
arg
of typeNumpy.Array
Looks like we either filter
nan
values or learn how to deal with themErrors: