Groundstation - spacecraft-design-lab-2019/documentation GitHub Wiki

Overview

The goal of the groundstation is to automate many aspects of communicating with the satellite, allowing GUI control of the commands sent to and fro via radio. In addition, the ground station should be responsive to the changing needs of the satellite - which includes both uploading new commands as required and handling changes in the satellite system configuration over time.

Current Status

There exist two code segments - a HOOTL test for the Major Tom API (code called 'test-gateway') and the production code, 'gateway1'. Gateway1 is currently integrated with the latest information that I have about the required commands, states and telemetry. However, it has not been tested because I don't yet have access to hardware to test it with, and many parts of it are not in a functional state yet because of a lack of information on the exact input/output format coming off of the radio.

Architecture

The ground station currently uses an off-the-shelf software called Major Tom as an API and GUI.

The core of the ground station is a 'gateway', code run locally from the command line on the user computer. This connects to the hardware radio using Pyserial, sending commands and inputting telemetry. It then uses an API to push the resulting information to Major Tom, a cloud-based application and GUI.

The core of the code is agnostic to Major Tom. If required, all of the calls to Major Tom's API could be replaced with direct inputs and outputs on the user device.

User Experience:

Major Tom is designed to make communicating with the satellite easy and accessible. Each satellite comes with a series of commands that one can send in GUI, using buttons. There's also a simple and accessible GUI for interpreting telemetry streams, including the location of the satellite. More complex commands can be sent using a subsidiary interface.

Connection to Hardware

Each gateway contains a run.py file that can be run on any computer with Python. Currently they are designed to communicate over serial using the Pyserial module. To run, just change the code to contain the serial port connected to the radio device. (This info is in Device Manger for Windows and in /sys/class/tty for Linux).

Extension and Evolution

  • To change the commands that can be sent to the satellite, modify the callback list in satellite.py.
  • To change the structure or responses to telemetry, edit the dictionary in satellite_telemetry.
  • To change the input format, replace calls to pyserial with something else (like io).
  • To entirely remove Major Tom, replace calls to Major Tom's API (everything that calls to 'gateway') with your preferred alternative.

Current Goal List of Basic Commands

(Info from meeting with Hridu)

  • Take a picture (maybe settings for image processing?)
  • Actuate torquers (input: a dipole)
  • Change the satellite state machine state.
  • Change one of a list of configurable parameters (not yet sure how this works - if better as a single command "change parameter" or as a series of them.) Depends on parameters and relative importance.
  • Push code change. This one is important! Is a straight file upload enough?

(All require a little more info on formatting)

Goals for Future Additions

  • Demonstration on real satellite hardware. There are no doubt a number of errors left that require HITL testing.
  • To make the code nicer, extend the "read and wait for awk bit" process into a single function that can get called. This will be easier once I have a sense of exactly how this works.
  • The Major Tom GUI has the capability of assuming that the satellite is in one or more states, which can make possible different commands. It would be nice if there was a simple dashboard object that signaled what state the satellite is currently in.
  • Command to upload the SPG4. Could this be automated? Would be cool if it was automated.
  • Internal code that automates some of the basic communications architecture with the satellite - for example, resending commands until the satellite sends an awk bit.
  • Alignment of the state machine, commands and telemetry format with the actual values observed on the satellite.
  • Configurable option to turn Major Tom on or off on demand.

Getting Started Intro Guide

Major Tom

To get started with Major Tom, head over to https://app.majortom.cloud/missions. You will need to make an account, and possibly email the folks at Major Tom in order to get them to give you access. Try [email protected].

Once you have this set up, go back to Major Tom and make a new mission. Inside the mission, you'll get this interface:

dashboard

Your first step is to set up a gateway and connect it to Major Tom. You can do this by taking the test-gateway code available here, (or whatever code you write), and running it on your local machine with two input arguments.

python3 run.py app.majortom.cloud [auth_token]

You can find the authentication token under the Gateway tab in the Major Tom interface, here:

gateway

Once your gateway is up and running, you can now talk to your satellite! The primary mode of communication with the satellite is either through a set of per-generated commands, which display as UI elements (and can be found in the satellite part of the menu), or by directly uploading code. Both of these can be found in the satellite menu.

satellite

Modifying the types of commands the satellites can handle can be done with a JSON file - more details are available in the Major Tom interface under the blue button 'View Commands Definition Documentation'.

You can find the original example gateway that the current one was forked from linked from the Major Tom documentation!

Local Gateway Code

Just clone the repo, edit satellite.py with the port you are connecting to, and run run.py!