SatNOGS’ image for the Raspberry Pi 3

Since I got nowhere with neither pip nor git I turned to the ‘official’ Raspberry Pi image. It contained a ready-to-run setup of all the SatNOGS software, so I got a chance to find out how to configure it.

First of all there was a setup program (which uses Ansible) so I could supply the necessary information to the program. Using the setup program I got the following in /etc/default/satnogs-client:

ATNOGS_API_TOKEN="<---obfuscated--->"
SATNOGS_NETWORK_API_URL="https://network-dev.satnogs.org/api/"
SATNOGS_RX_DEVICE="ic821h" 
SATNOGS_STATION_ELEV="37" 
SATNOGS_STATION_ID="187" 
SATNOGS_STATION_LAT="55.83904" 
SATNOGS_STATION_LON="12.39592"

The tricky part here was the Station ID. It is not the callsign of your station – which to me would be the natural interpretation – but the serial number you get when you register your station at the SatNOGS web site.

Finding the code that actually comprises the client was more difficult but I found it in /var/lib/satnogs/lib/python2.7/site-packages/satnogsclient/ Here was also the settings.py file. The part of it concerning the whereabouts of the ground station is:

import os
from distutils.util import strtobool
from os import environ, path

def _cast_or_none(func, value):
try:
  return func(value)
except (ValueError, TypeError):
  return None

# Ground station information
SATNOGS_API_TOKEN = environ.get('SATNOGS_API_TOKEN', None)
SATNOGS_PRE_OBSERVATION_SCRIPT = environ.get('SATNOGS_PRE_OBSERVATION_SCRIPT', None)
SATNOGS_POST_OBSERVATION_SCRIPT = environ.get('SATNOGS_POST_OBSERVATION_SCRIPT', None)
SATNOGS_STATION_ID = _cast_or_none(int, environ.get('SATNOGS_STATION_ID', None))
SATNOGS_STATION_LAT = _cast_or_none(float, environ.get('SATNOGS_STATION_LAT', None))
SATNOGS_STATION_LON = _cast_or_none(float, environ.get('SATNOGS_STATION_LON', None))
SATNOGS_STATION_ELEV = _cast_or_none(float, environ.get('SATNOGS_STATION_ELEV', None))

So the information is taken from environment variables as I suspected, but who sets the up and how? It turned out that SatNOGS relies heavily on the functionality of systemd, but the service script for the client reveals how:

[Unit]
Description=SatNOGS client
Requires=redis-server.service
After=redis-server.service

[Service]
EnvironmentFile=-/etc/default/satnogs-client
Environment=LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libuhd.so.003
ExecStart=/var/lib/satnogs/bin/satnogs-client
#Restart=on-failure
User=satnogs
Group=satnogs

[Install]
WantedBy=multi-user.target

Keine Hexerei, nur Behändigkeit

Visits: 45

Leave a Reply