mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 14:18:00 +08:00
cf7c8b3797
* updated distance measurement script. - automatically shows which ids are available - filter out big jumps - plot_summary.py shows distance over time with recording regions * Adding config file for radiomaster pocket joystick ble/usb (#108) * added radiomaster tx16s xml (#123) Co-authored-by: Wiebe van der Knaap <wkvanderknaap@tudelft.nl> * Fix joystick device argument parsed as single token in control panel sessions (#118) The `-d 0` joystick device flag was passed as a single `flag` attribute, causing the joystick program to receive it as one token instead of two separate arguments. This prevented the device number from being recognized, breaking joystick input in the Simulation - Gazebo and Flight UDP sessions. Fixed by splitting into `<arg flag="-d" constant="0"/>`. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> * fixed names of variables and resolution bugs, added documentation (#113) Co-authored-by: macoman <macoman@student.tudelft.nl> * Update Gazebo Models: Gate, Plants, Logo * Added some (math) tests (#114) * added a test for paparazzi's math librarie's int sqrt function and int quaternion normalization function * Keep essential tests Reduced the number of tests planned from 9 to 6 and removed tests for int32_sqrt. --------- Co-authored-by: LSSchef <l.s.scheffer@student.tudelft.nl> Co-authored-by: AniketBehura <aniketbehura1023@gmail.com> Co-authored-by: diaa <D.abbasi@student.tudelft.nl> * Feat: readme update for submodule installation (#115) * feat: readme update for submodule installation * Rename README to README.md --------- Co-authored-by: Christophe De Wagter <dewagter@gmail.com> --------- Co-authored-by: robinferede <robinferede@tudelft.nl> Co-authored-by: Robin Euger <robin.euger@gmail.com> Co-authored-by: Wiebe van der Knaap <wkvanderknaap@tudelft.nl> Co-authored-by: EAbbenhuis <113993394+EAbbenhuis@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Mihai Coman <127535163+miki133@users.noreply.github.com> Co-authored-by: macoman <macoman@student.tudelft.nl> Co-authored-by: Swayam Kuckreja <110131770+swayamkuckreja@users.noreply.github.com> Co-authored-by: LSSchef <l.s.scheffer@student.tudelft.nl> Co-authored-by: AniketBehura <aniketbehura1023@gmail.com> Co-authored-by: diaa <D.abbasi@student.tudelft.nl> Co-authored-by: Douwe-Rijs <Douwe@standofl.nl>
66 lines
2.1 KiB
Python
66 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Plot summary of a dist.py recording: distance over time, recording regions, totals."""
|
|
import csv
|
|
import argparse
|
|
import matplotlib.pyplot as plt
|
|
import matplotlib.patches as mpatches
|
|
|
|
|
|
def main(csvfile):
|
|
times = []
|
|
distances = []
|
|
recording = []
|
|
|
|
with open(csvfile) as f:
|
|
reader = csv.reader(f)
|
|
next(reader) # skip header
|
|
for row in reader:
|
|
times.append(float(row[0]))
|
|
distances.append(float(row[1]))
|
|
recording.append(row[5].strip() == 'True')
|
|
|
|
# Compute total distance and total time spent recording
|
|
total_distance = distances[-1] if distances else 0.0
|
|
total_rec_time = 0.0
|
|
for i in range(1, len(times)):
|
|
if recording[i]:
|
|
total_rec_time += times[i] - times[i - 1]
|
|
|
|
print(f"File: {csvfile}")
|
|
print(f"Total distance: {total_distance:.2f} m")
|
|
print(f"Total recording time: {total_rec_time:.1f} s")
|
|
print(f"Total session time: {times[-1]:.1f} s")
|
|
|
|
fig, ax = plt.subplots()
|
|
ax.plot(times, distances, 'b-', linewidth=1.5)
|
|
ax.set_xlabel('Time (s)')
|
|
ax.set_ylabel('Distance (m)')
|
|
ax.set_title(f'{csvfile}\nTotal distance: {total_distance:.2f} m | Recording time: {total_rec_time:.1f} s')
|
|
|
|
# Shade recording regions
|
|
in_region = False
|
|
region_start = 0
|
|
for i, rec in enumerate(recording):
|
|
if rec and not in_region:
|
|
region_start = times[i]
|
|
in_region = True
|
|
elif not rec and in_region:
|
|
ax.axvspan(region_start, times[i], alpha=0.2, color='red')
|
|
in_region = False
|
|
if in_region:
|
|
ax.axvspan(region_start, times[-1], alpha=0.2, color='red')
|
|
|
|
rec_patch = mpatches.Patch(color='red', alpha=0.2, label='Recording active')
|
|
ax.legend(handles=[rec_patch])
|
|
ax.grid(True, alpha=0.3)
|
|
|
|
plt.tight_layout()
|
|
plt.show()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(description="Plot summary of a dist.py recording")
|
|
parser.add_argument('csvfile', help="CSV file from dist.py")
|
|
args = parser.parse_args()
|
|
main(args.csvfile)
|