Commit 077f0e28 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

erp5_wendelin_drone: work with floats

parent 4d1d87b5
......@@ -122,7 +122,7 @@ for name in not_seen_list:
splitted_filename = name[:-4].split('_')
distance_list_tuple = ([],[], [], [], [])
simulated_flight = nparray_to_dataframe(sim_array.get(name))
simulated_flight = simulated_flight.applymap(lambda value: np.format_float_scientific(float(value)) if isinstance(value, str) and 'e' in value else value)
simulated_flight = simulated_flight.applymap(float)
simulated_flight_list.append(simulated_flight)
timestamp_diff = simulated_flight['timestamp (ms)'].min() - real_flight['timestamp (ms)'].min()
max_simulator_timestamp = simulated_flight['timestamp (ms)'].max() - timestamp_diff
......@@ -139,24 +139,23 @@ for name in not_seen_list:
except IndexError:
continue
over_timestamp = simulated_flight[simulated_flight['timestamp (ms)'] - timestamp_diff >= row['timestamp (ms)']].head(1)
rate = (float(over_timestamp["timestamp (ms)"]) - timestamp_diff - row["timestamp (ms)"])/(float(over_timestamp["timestamp (ms)"]) - float(under_timestamp["timestamp (ms)"]))
rate = (over_timestamp["timestamp (ms)"] - timestamp_diff - row["timestamp (ms)"])/(over_timestamp["timestamp (ms)"] - under_timestamp["timestamp (ms)"])
for criterion in distance_criterion_tuple:
tmp_sim[criterion].append(rated_value(float(over_timestamp[criterion]), float(under_timestamp[criterion]), rate))
tmp_sim[criterion].append(rated_value(over_timestamp[criterion], under_timestamp[criterion], rate))
tmp_real[criterion].append(row[criterion])
for index, value in enumerate((
row['timestamp (ms)'] / 1000,
distance(row['latitude ()'],
row['longitude ()'],
tmp_sim['latitude ()'][-1],
tmp_sim['longitude ()'][-1],
),
tmp_sim['AMSL (m)'][-1],
tmp_sim['ground speed (m/s)'][-1],
tmp_real['climb rate (m/s)'][-1]
)):
row['timestamp (ms)'] / 1000,
distance(row['latitude ()'],
row['longitude ()'],
tmp_sim['latitude ()'][-1],
tmp_sim['longitude ()'][-1],
),
tmp_sim['AMSL (m)'][-1],
tmp_sim['ground speed (m/s)'][-1],
tmp_real['climb rate (m/s)'][-1],
)):
distance_list_tuple[index].append(value)
# If we have at least 100 entries (timestamps) analysed, add the filename to the list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment