Added habitat upload support for imagery packets. Telemetry GUI loads by default with start_rx.sh

pull/1/head
Mark Jessop 2017-01-07 20:00:35 +10:30
rodzic 43f6f57455
commit 11fc3d73d0
4 zmienionych plików z 200 dodań i 152 usunięć

Wyświetl plik

@ -10,6 +10,7 @@ from threading import Thread
import traceback import traceback
import socket import socket
import json import json
import sys
import Queue import Queue
import datetime import datetime
from WenetPackets import * from WenetPackets import *
@ -20,6 +21,11 @@ import numpy as np
imu_plot_history_size = 60 # Seconds. imu_plot_history_size = 60 # Seconds.
user_callsign = "N0CALL"
if len(sys.argv) > 1:
user_callsign = sys.argv[1]
app = QtGui.QApplication([]) app = QtGui.QApplication([])
# Configure PyQtGraph to use black plots on a transparent background. # Configure PyQtGraph to use black plots on a transparent background.
@ -224,7 +230,7 @@ def updateIMUFrame(imu_data):
# Telemetry Log # Telemetry Log
packetSnifferFrame = QtGui.QFrame() packetSnifferFrame = QtGui.QFrame()
packetSnifferFrame.setFixedSize(1300,150) packetSnifferFrame.setFixedSize(1200,150)
packetSnifferFrame.setFrameStyle(QtGui.QFrame.Box) packetSnifferFrame.setFrameStyle(QtGui.QFrame.Box)
packetSnifferTitle = QtGui.QLabel("<b><u>Telemetry Log</u></b>") packetSnifferTitle = QtGui.QLabel("<b><u>Telemetry Log</u></b>")
console = QtGui.QPlainTextEdit() console = QtGui.QPlainTextEdit()
@ -234,6 +240,40 @@ packetSnifferLayout.addWidget(packetSnifferTitle)
packetSnifferLayout.addWidget(console) packetSnifferLayout.addWidget(console)
packetSnifferFrame.setLayout(packetSnifferLayout) packetSnifferFrame.setLayout(packetSnifferLayout)
# Habitat Upload Frame
uploadFrame = QtGui.QFrame()
uploadFrame.setFixedSize(200,150)
uploadFrame.setFrameStyle(QtGui.QFrame.Box)
uploadFrame.setLineWidth(1)
uploadFrameTitle = QtGui.QLabel("<b><u>Habitat Upload</u></b>")
uploadFrameHabitat = QtGui.QCheckBox("Habitat Upload")
uploadFrameHabitat.setChecked(True)
uploadFrameCallsignLabel = QtGui.QLabel("<b>Your Callsign:</b>")
uploadFrameCallsign = QtGui.QLineEdit(user_callsign)
uploadFrameCallsign.setMaxLength(10)
uploadFrameHabitatStatus = QtGui.QLabel("Last Upload: ")
uploadFrameLayout = QtGui.QGridLayout()
uploadFrameLayout.addWidget(uploadFrameTitle,0,0,1,1)
uploadFrameLayout.addWidget(uploadFrameCallsignLabel,1,0,1,1)
uploadFrameLayout.addWidget(uploadFrameCallsign,1,1,1,1)
uploadFrameLayout.addWidget(uploadFrameHabitat,2,0,1,2)
uploadFrameLayout.addWidget(uploadFrameHabitatStatus,3,0,1,2)
uploadFrame.setLayout(uploadFrameLayout)
def imageTelemetryHandler(packet):
(upload_ok, error) = image_telemetry_upload(packet, user_callsign = str(uploadFrameCallsign.text()))
timestamp = datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%SZ")
if upload_ok:
uploadFrameHabitatStatus.setText("Last Upload: %s" % datetime.utcnow().strftime("%H:%M:%S"))
console.appendPlainText("%s \tHabitat Upload: OK")
else:
uploadFrameHabitatStatus.setText("Last Upload: Failed!")
console.appendPlainText("%s \tHabitat Upload: FAIL: %s" % (timestamp, error))
# Main Window # Main Window
main_widget = QtGui.QWidget() main_widget = QtGui.QWidget()
@ -242,8 +282,10 @@ main_widget.setLayout(layout)
layout.addWidget(gpsFrame,0,0) layout.addWidget(gpsFrame,0,0)
layout.addWidget(imuFrame,0,1) layout.addWidget(imuFrame,0,1)
layout.addWidget(imuPlot,0,2) layout.addWidget(imuPlot,0,2,1,2)
layout.addWidget(packetSnifferFrame,1,0,1,4) layout.addWidget(packetSnifferFrame,1,0,1,3)
layout.addWidget(uploadFrame,1,3,1,1)
mainwin = QtGui.QMainWindow() mainwin = QtGui.QMainWindow()
mainwin.setWindowTitle("Wenet GPS/IMU Telemetry Console") mainwin.setWindowTitle("Wenet GPS/IMU Telemetry Console")
@ -275,6 +317,10 @@ def process_udp(udp_packet):
elif packet_type == WENET_PACKET_TYPES.ORIENTATION_TELEMETRY: elif packet_type == WENET_PACKET_TYPES.ORIENTATION_TELEMETRY:
orientation_data = orientation_telemetry_decoder(packet) orientation_data = orientation_telemetry_decoder(packet)
updateIMUFrame(orientation_data) updateIMUFrame(orientation_data)
elif packet_type == WENET_PACKET_TYPES.IMAGE_TELEMETRY:
# Print to console, then attempt to upload packet.
console.appendPlainText("%s \t%s" % (timestamp,packet_to_string(packet)))
imageTelemetryHandler(packet)
else: else:
# Convert to string, and print to terminal with timestamp. # Convert to string, and print to terminal with timestamp.
console.appendPlainText("%s \t%s" % (timestamp,packet_to_string(packet))) console.appendPlainText("%s \t%s" % (timestamp,packet_to_string(packet)))

Wyświetl plik

@ -603,9 +603,9 @@ def image_telemetry_upload(packet, user_callsign="N0CALL"):
) )
response = c.getresponse() response = c.getresponse()
return "Image Telemetry: Uploaded to Habitat Successfuly." return (True, "Image Telemetry: Uploaded to Habitat Successfuly.")
except Exception as e: except Exception as e:
return "Failed to upload to Habitat: %s" % (str(e)) return (False, "Failed to upload to Habitat: %s" % (str(e)))

Wyświetl plik

@ -19,6 +19,8 @@ python ssdv_upload.py $MYCALL &
# Start the SSDV RX GUI. # Start the SSDV RX GUI.
python rx_gui.py & python rx_gui.py &
# Start the Telemetry GUI.
python TelemetryGUI.py $MYCALL &
# Uncomment the following line if using a V3 RTLSDR and need the Bias-Tee enabled. # Uncomment the following line if using a V3 RTLSDR and need the Bias-Tee enabled.
# rtl_biast -b 1 # rtl_biast -b 1

Wyświetl plik

@ -1131,7 +1131,7 @@ class UBloxGPS(object):
self.gps.send_message(CLASS_CFG, MSG_CFG_NAV5,'\x00') self.gps.send_message(CLASS_CFG, MSG_CFG_NAV5,'\x00')
# Additional checks to be sure we're in the right dynamic model. # Additional checks to be sure we're in the right dynamic model.
if self.rx_counder % 40 == 0: if self.rx_counter % 40 == 0:
self.gps.set_preferred_dynamic_model(self.dynamic_model) self.gps.set_preferred_dynamic_model(self.dynamic_model)
# Send data to the callback function. # Send data to the callback function.