Code Monkey home page Code Monkey logo

packetraven's Introduction

PacketRaven

tests docs license

PacketRaven is a command-line dashboard that retrieves location telemetry sent by high-altitude balloon payloads. The program is designed to be run during a flight and display information in a terminal user interface (TUI): demo

Features

  • retrieves location telemetry from a variety of sources, including
  • retrieves balloon flight predictions from https://predict.sondehub.org
  • plots variables such as altitude and ascent rate over time
  • estimates landing time (and, if doing a prediction, shows preficted landing location)

Instructions

  1. Follow these instructions to create a new configuration file in a text editor, or use the following simple example:

    # example.yaml
    callsigns:
      - W3EAX-8
    connections:
      sondehub: {}
      text:
        - path: http://bpp.umd.edu/archives/Launches/NS-111_2022_07_31/APRS/W3EAX-8%20raw.txt
        - port: COM3
          baud_rate: 9600
  2. Download an executable from the Releases page.

  3. Open a terminal window.

  4. Run the executable you downloaded with start and a path to your configuration file:

    packetraven.exe start example.yaml

Tip

Add --help to any command to show usage instructions.

Note

On MacOS or Linux, you may need to give the file executable permissions to run it:

chmod +x packetraven
  1. You should now see the user interface. The program starts on the Log tab, which displays log messages. Use the up and down arrow keys to scroll. log messages tab

Tip

Resize your terminal window, or zoom out / decrease the font size, as needed.

  1. Upon first receiving new packet(s) from a callsign, a new tab will be created (shown in the top bar) for that callsign. Use the left and right arrow keys to switch between tabs.

  2. While on a callsign tab, use the up and down arrow keys to switch between plots. altitude telemetry plotted over time

  3. To quit, press q or Esc.

retrieve predictions

Run the executable with predict to retrieve a balloon flight prediction:

packetraven.exe predict "2023-08-16T10:00:00" -- -79 39 5 30000 9

Warning

due to a limitation in the argument parser, you must prepend all negative values with -- ; for instance, -79 should be -- -79

packetraven's People

Contributors

dependabot[bot] avatar quinnkupec avatar zacharyburnett avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

packetraven's Issues

Integer overflow when determining large time to ground

2020-11-05 21:10:36,884 | INFO     | received 1 new packet(s) from https://api.aprs.fi/api/get: [APRSPacket(from_callsign='KC3HHV-7', to_callsign='APDR16', time=datetime.datetime(2020, 11, 5, 21, 10, 29), x=-76.851, y=39.16533, z=64.9224, crs=CRS.from_epsg(4326), path=['TCPIP*', 'qAC', 'FIFTH'], timestamp='1604628629', symbol='Z', symbol_table='/', comment='UMDBPP Recovery')]
2020-11-05 21:10:36,970 | INFO     | sending 1 packet(s) to postgres://128.8.202.13:5432/nearspace/testing: [APRSPacket(from_callsign='KC3HHV-7', to_callsign='APDR16', time=datetime.datetime(2020, 11, 5, 21, 10, 29), x=-76.851, y=39.16533, z=64.9224, crs=CRS.from_epsg(4326), path=['TCPIP*', 'qAC', 'FIFTH'], timestamp='1604628629', symbol='Z', symbol_table='/', comment='UMDBPP Recovery')]
Exception in Tkinter callback
Traceback (most recent call last):
  File "c:\program files\python38\lib\tkinter\__init__.py", line 1883, in __call__
    return self.func(*args)
  File "c:\program files\python38\lib\tkinter\__init__.py", line 804, in callit
    func(*args)
  File "c:\program files\python38\lib\site-packages\client\gui.py", line 500, in retrieve_packets
    parsed_packets = retrieve_packets(self.__connections, self.__packet_tracks, self.database, self.output_filename, self.start_date,
  File "c:\program files\python38\lib\site-packages\client\retrieve.py", line 82, in retrieve_packets
    if packet_track.time_to_ground >= timedelta(seconds=0):
  File "c:\program files\python38\lib\site-packages\packetraven\tracks.py", line 68, in time_to_ground
    return timedelta(seconds=self.packets[-1].coordinates[2] / current_ascent_rate)
OverflowError: Python int too large to convert to C int

synchronize with database

upload and download new packets to PostGreSQL database table to keep it up-to-date with latest packets

Prediction perturber

Build a prediction perturber:

  • build perturber class
  • get sigma + bounds for prediction variables (launch location, launch time, avg. ascent rate, burst altitude, sea level descent rate, float altitude, float duration)
  • add a command line command

We're planning to do 4-6 launches between January 8th-17th, the first half will each be two single balloon launches near simultaneously, and the second half of those launches will be tandems for a float. We'll be launching out of Kessler Atmospheric and Ecological Field Station (somewhere around 34.980110, -97.521800 perhaps). Dr. Bowden can probably speak more about the prediction variables, I think they may want us to aim higher so ascend slower? I think we decided to aim for 9 AM launches too

Issues with building PyPROJ on Windows

When running pip install packetraven on a Windows machine, Pip will attempt to install PyPROJ from PyPI. However, since pyproj does not currently have a compiled Windows wheel on PyPI, the installation will fail unless the user has PROJ installed on their machine.

Display aprs.fi link in console to track specified callsigns

example URL:

https://aprs.fi/#!ts=1627131600&te=1627164000&call=a%2FW3EAX-11%2Ca%2FW3EAX-8%2Ca%2FW3EAX-9%2Ca%2FW3EAX-12
  • convert start and end time to epoch seconds
  • use selected callsogns
  • display at start of output so that user can get URL even if no connections are started

Reduce clutter when printing new packet

When a new packet is received, the console currently prints the entire packet string, which piles up text

Instead of printing all of the packet details, print a short form instead

start and end dates do not propagate to existing plot window

Changes to the start and end times do not change a live plot window

edit LivePlot class:

class LivePlot:
def __init__(
self,
packet_tracks: {str: LocationPacketTrack},
variable: str,
predictions: {str: PredictedTrajectory} = None,
):
if variable not in VARIABLES:
raise NotImplementedError(f'unsupported plotting variable "{variable}"')
self.packet_tracks = packet_tracks
self.predictions = predictions if predictions is not None else {}
self.variable = variable
self.window.protocol('WM_DELETE_WINDOW', self.window.iconify)
self.update()
def update(
self,
packet_tracks: {str: LocationPacketTrack} = None,
predictions: {str: PredictedTrajectory} = None,
):
if packet_tracks is not None:
self.packet_tracks.update(packet_tracks)
if predictions is not None:
self.predictions.update(predictions)
if len(self.packet_tracks) > 0:
if self.window.state() == 'iconic':
self.window.deiconify()
if self.window.focus_get() is None:
self.window.focus_force()
while len(self.axis.lines) > 0:
self.axis.lines.pop(-1)
packet_track_lines = {}
for name, packet_track in self.packet_tracks.items():
lines = self.axis.plot(
getattr(packet_track, VARIABLES[self.variable]['x']),
getattr(packet_track, VARIABLES[self.variable]['y']),
linewidth=2,
marker='o',
label=packet_track.name,
)
packet_track_lines[name] = lines[0]
for name, packet_track in self.predictions.items():
color = (
packet_track_lines[name].get_color()
if name in packet_track_lines
else None
)
self.axis.plot(
getattr(packet_track, VARIABLES[self.variable]['x']),
getattr(packet_track, VARIABLES[self.variable]['y']),
'--',
linewidth=0.5,
color=color,
label=f'{packet_track.name} prediction',
)
self.axis.legend()
pyplot.draw()
@property
def window(self) -> Toplevel:
return self.figure.canvas.manager.window
@property
def figure(self) -> Figure:
try:
figure = self.__figure
if not pyplot.fignum_exists(figure.number):
raise RuntimeError
except (AttributeError, RuntimeError):
figure = self.__new_figure()
self.__figure = figure
pyplot.show(block=False)
return figure
@property
def axis(self) -> Axes:
try:
axis = self.__axis
figure = axis.figure
if figure is not self.figure:
raise RuntimeError
except (AttributeError, RuntimeError):
axis = self.__new_axis()
self.__axis = axis
return axis
def __new_figure(self) -> Figure:
x_label = VARIABLES[self.variable]['xlabel']
y_label = VARIABLES[self.variable]['ylabel']
return pyplot.figure(num=f'{y_label} / {x_label}')
def __new_axis(self, figure: Figure = None) -> Axes:
if figure is None:
figure = self.figure
x_label = VARIABLES[self.variable]['xlabel']
y_label = VARIABLES[self.variable]['ylabel']
axis = figure.add_subplot(1, 1, 1)
axis.set_xlabel(x_label)
axis.set_ylabel(y_label)
return axis
def close(self):
pyplot.close(self.figure.number)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.