Skip to content

Commit

Permalink
Merge pull request #90 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-05-13
  • Loading branch information
astrogeco authored May 22, 2020
2 parents 1c31f94 + 31b433c commit 5c14375
Show file tree
Hide file tree
Showing 32 changed files with 11,523 additions and 13,631 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.pyc
cmdUtil
.DS_Store
.DS_Store
97 changes: 54 additions & 43 deletions GroundSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,110 +19,122 @@
#
#cFS Ground System Version 2.0.0
#
#!/usr/bin/env python
#!/usr/bin/env python3
#
import shlex
import subprocess
import sys
import os
import socket
import zmq
from pathlib import Path

from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox

from PyQt4 import QtGui, QtNetwork, QtCore
from MainWindow import Ui_MainWindow
from RoutingService import RoutingService

ROOTDIR = Path(sys.argv[0]).resolve().parent


#
# CFS Ground System: Setup and manage the main window
#
class GroundSystem(QtGui.QMainWindow):

class GroundSystem(QMainWindow, Ui_MainWindow):
#
# Init the class
#
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self)
def __init__(self):
super().__init__()
self.setupUi((self))

self.RoutingService = None
self.alert = QMessageBox()

self.pushButtonStartTlm.clicked.connect(self.startTlmSystem)
self.pushButtonStartCmd.clicked.connect(self.startCmdSystem)
# Init lists
self.ipAddressesList = ['All']
self.spacecraftNames = ['All']

# Init GUI and set callback methods for buttons
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.pushButtonStartTlm.clicked.connect(self.startTlmSystem)
self.ui.pushButtonStartCmd.clicked.connect(self.startCmdSystem)

def closeEvent(self, evnt):
if self.RoutingService:
self.RoutingService.stop()
print ("Stopped routing service")
print("Stopped routing service")

super(GroundSystem, self).closeEvent(evnt)
super().closeEvent(evnt)

# Read the selected spacecraft from combo box on GUI
def getSelectedSpacecraftAddress(self):
return str(self.ui.comboBoxIpAddresses.currentText())
return self.comboBoxIpAddresses.currentText().strip()

# Returns the name of the selected spacecraft
def getSelectedSpacecraftName(self):
return self.spacecraftNames[self.ipAddressesList.index(self.getSelectedSpacecraftAddress())]
return self.spacecraftNames[self.ipAddressesList.index(
self.getSelectedSpacecraftAddress())].strip()

#
# Display popup with error
#
def DisplayErrorMessage(self, message):
print (message)
alert = QtGui.QMessageBox()
alert.setText(message)
alert.setIcon(QtGui.QMessageBox.Warning)
alert.exec_()
print(message)
self.alert.setText(message)
self.alert.setIcon(QMessageBox.Warning)
self.alert.exec_()

# Start the telemetry system for the selected spacecraft
def startTlmSystem(self):
selectedSpacecraft = self.getSelectedSpacecraftName()

# Setup the subscription (to let know the telemetry system the messages it will be receiving)
# Setup the subscription (to let know the
# telemetry system the messages it will be receiving)
if selectedSpacecraft == 'All':
subscription = '--sub=GroundSystem'
else:
subscription = '--sub=GroundSystem.' + selectedSpacecraft + '.TelemetryPackets'
subscription = f'--sub=GroundSystem.{selectedSpacecraft}.TelemetryPackets'

# Open Telemetry System
system_call = '( cd Subsystems/tlmGUI/ && python3 TelemetrySystem.py ' + subscription + ' ) & '
os.system(system_call)
system_call = f'python3 {ROOTDIR}/Subsystems/tlmGUI/TelemetrySystem.py {subscription}'
args = shlex.split(system_call)
subprocess.Popen(args)

# Start command system
def startCmdSystem(self):
os.system('( cd Subsystems/cmdGui/ && python3 CommandSystem.py ) & ')
@staticmethod
def startCmdSystem():
subprocess.Popen(
['python3', f'{ROOTDIR}/Subsystems/cmdGui/CommandSystem.py'])

# Start FDL-FUL gui system
#def startFDLSystem(self):
# selectedSpacecraft = self.getSelectedSpacecraftName()
# if selectedSpacecraft == 'All':
# subscription = ''
# self.DisplayErrorMessage('Cannot open FDL manager.\nNo spacecraft selected.')
# else:
# subscription = '--sub=GroundSystem.' + selectedSpacecraft
# os.system('( cd Subsystems/fdlGui/ && python FdlSystem.py ' + subscription + ' ) & ')
def startFDLSystem(self):
selectedSpacecraft = self.getSelectedSpacecraftName()
if selectedSpacecraft == 'All':
subscription = ''
self.DisplayErrorMessage(
'Cannot open FDL manager.\nNo spacecraft selected.')
else:
subscription = f'--sub=GroundSystem.{selectedSpacecraft}'
subprocess.Popen([
'python3', f'{ROOTDIR}/Subsystems/fdlGui/FdlSystem.py',
subscription
])

# Update the combo box list in gui
def updateIpList(self, ip, name):
self.ipAddressesList.append(ip)
self.spacecraftNames.append(name)
self.ui.comboBoxIpAddresses.addItem(ip)
self.comboBoxIpAddresses.addItem(ip)

# Start the routing service (see RoutingService.py)
def initRoutingService(self):
self.RoutingService = RoutingService(self)
self.connect(self.RoutingService, self.RoutingService.signalUpdateIpList, self.updateIpList)
self.RoutingService = RoutingService()
self.RoutingService.signalUpdateIpList.connect(self.updateIpList)
self.RoutingService.start()


#
# Main
#
if __name__ == "__main__":

# Init app
app = QtGui.QApplication(sys.argv)
app = QApplication(sys.argv)

# Init main window
MainWindow = GroundSystem()
Expand All @@ -136,4 +148,3 @@ def initRoutingService(self):

# Execute the app
sys.exit(app.exec_())

18 changes: 9 additions & 9 deletions Guide-GroundSystem.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cFS Ground System Version 2.1.8
# cFS Ground System Version 2.1.9

## cFS Ground System Info

Expand All @@ -25,18 +25,17 @@ Future enhancements:
## Install and run

Before launching the Ground System make sure that:

- PyQt4 is installed,
- PyQt5 is installed,
- PyZMQ is installed,
- cmdUtil is compiled.

Installing and running cFS Ground System on Ubuntu:

1. `sudo apt-get install python3-pyqt4`
2. `sudo apt-get install python3-zmq`
3. `sudo apt-get install libcanberra-gtk-module`
4. `cd Subsystems/cmdUtil/ && make`
5. `python3 GroundSystem.py`
1. ```sudo apt-get install python3-pyqt5```
1. ```sudo apt-get install python3-zmq```
1. ```sudo apt-get install libcanberra-gtk-module```
1. ```cd Subsystems/cmdUtil/ && make```
1. ```python3 GroundSystem.py```

The historically included instructions for running on macOS or CentOS are included at the bottom of this document for reference. Please note that instructions have not been maintained. Welcoming instruction contributions if any of these are your platform of choice.

Expand All @@ -46,7 +45,8 @@ This section was made to help developers who are adding core Flight Software (cF

The `CHeaderParser.py` program that should be found in:

````groundsystem/subsystems/cmdgui```
```GroundSystem/Subsystems/cmdGui```

Is an interactive, command-line based program to help walk developers through the process of adding custom cFS applications to the Ground System. Along with `CHeaderParser.py` is a configuration file that CHeaderParser uses to find the proper header files for your "new" cFS application. This file is named `CHeaderParser-hdr-paths.txt`, and should be placed in the same directory as `CHeaderParser.py`.

Expected file structure:
Expand Down
12 changes: 6 additions & 6 deletions Guide-GroundSystem.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cFS Ground System Version 2.1.8
cFS Ground System Version 2.1.9

cFS Ground System Info:

Expand All @@ -18,20 +18,20 @@ Future enhancements:


Before launching the Ground System make sure that:
-> PyQt4 is installed.
-> PyQt5 is installed.
-> PyZMQ is installed.
-> cmdUtil is compiled.


Installing and running cFS Ground System on Ubuntu:
$ sudo apt-get install python3-pyqt4
$ sudo apt-get install python3-pyqt5
$ sudo apt-get install python3-zmq
$ sudo apt-get install libcanberra-gtk-module
$ ( cd Subsystems/cmdUtil/ && make )
$ python3 GroundSystem.py


The historically included instructions for running on Mac or CentOS are inluded at the bottom of this document for referance.
The historically included instructions for running on Mac or CentOS are inluded at the bottom of this document for reference.
Please note that instructions have not been maintained.
Welcoming instruction contributions if any of these are your platform of choice.

Expand Down Expand Up @@ -160,8 +160,8 @@ Installing and running cFS Ground System on CentOS 6:
$ ldconfig
$ pip install pyzmq

#### Install pyQT4 ####
$ yum install -y PyQt4
#### Install pyQT5 ####
$ yum install -y PyQt5
$ yum install -y qt qt-demos qt-designer qt4 qt4-designer


Expand Down
Loading

0 comments on commit 5c14375

Please sign in to comment.