2018-08-22 14:34:09 -06:00
# auto-scheduler
2018-11-15 13:13:07 -07:00
This is a tool to automatically compute passes of satellites on the
2018-12-02 05:09:23 -07:00
SatNOGS network. It uses code from the SatNOGS network scheduler. It requires
2018-11-30 05:00:56 -07:00
[python-satellitetle ](https://gitlab.com/librespacefoundation/python-satellitetle ) for downloading TLEs.
## Dependencies
2019-06-25 15:05:43 -06:00
```bash
sudo apt-get install libxml2-dev libxslt1-dev
2018-11-30 05:00:56 -07:00
pip install -r requirements.txt
```
2018-12-02 05:09:23 -07:00
2019-05-10 01:20:47 -06:00
## Configuration
2019-10-11 07:10:16 -06:00
Copy the env-dist file to .env and set your SatNOGS Network API token.
2019-05-10 01:20:47 -06:00
2019-06-25 15:10:20 -06:00
## Test run
Perform a test run to download orbital elements and transmitter priorities (these are stored in `/tmp/cache` ) with
```bash
schedule_single_station.py -s < ground station ID > -n
```
The `-n` option computes the passes but does not schedule them. To schedule these passes, run
```bash
schedule_single_station.py -s < ground station ID >
```
2019-06-25 15:05:43 -06:00
## Setup priority scheduling
The following commands will add a list consisting of all DUV, BPSK1k2, BPSK9k6, [G]MSK and [G]FSK transmitters into `priorities_37.txt` .
2019-07-05 09:20:42 -06:00
Please change the station id (here `37` - in the cache file and the list file name) to your corresponding one!
2019-06-25 15:05:43 -06:00
```bash
2019-10-23 10:13:51 -06:00
STATION_ID=37
TRM_FILE="/tmp/cache/transmitters_${STATION_ID}.txt"
PRIO_FILE="priorities_${STATION_ID}.txt"
awk '{if ($3>=80) print $0 }' ${TRM_FILE} | grep -e "FSK" | awk '{printf("%s 1.0 %s\n",$1,$2)}' > ${PRIO_FILE}
awk '{if ($3>=0) print $0 }' ${TRM_FILE} | grep -e "BPSK1k2" | awk '{printf("%s 1.0 %s\n",$1,$2)}' >> ${PRIO_FILE}
awk '{if ($3>=0) print $0 }' ${TRM_FILE} | grep -e "BPSK9k6" | awk '{printf("%s 1.0 %s\n",$1,$2)}' >> ${PRIO_FILE}
awk '{if ($3>=80) print $0 }' ${TRM_FILE} | grep -e "MSK" | awk '{printf("%s 1.0 %s\n",$1,$2)}' >> ${PRIO_FILE}
sort -n -k 4 ${TRM_FILE} | grep -e "DUV" | awk '{printf("%s 1.0 %s\n",$1,$2)}' >> ${PRIO_FILE}
2019-06-25 15:05:43 -06:00
```
2019-06-25 15:10:20 -06:00
## Add cron-job
2019-06-25 15:05:43 -06:00
Start editing your default user's cron (select your preferred editor):
```bash
crontab -e
```
Add a line like this - execute the scheduling script on each full hour:
```bash
0 */1 * * * < path_to_auto_scheduler > /schedule_single_station.py -s < station_id > -d 1.2 -P < path_to_priority_list > /< priority_file > .txt -f -z
```
2019-07-05 09:20:42 -06:00
Omit the `-f` option to also fill in the gaps, but be aware if using a rotator setup! This will wear-out your rotator very quickly!
Add `-w 60` for a delay if you want to give your rotator a bit of time (60 s) to reset or home.
2019-06-25 15:05:43 -06:00
2019-10-29 11:32:39 -06:00
## Add systemd-timer
The advantage of using a systemd-timer for invoking the auto-scheduler lies in the better logging output (you can use `journalctl -u satnogs-auto-scheduler.service` to access the log output).
- Add a systemd service unit file at `/etc/systemd/system/satnogs-auto-scheduler.service` :
```
[Unit]
Description=Schedule SatNOGS observations for 1.2h on station 132
[Service]
Type=oneshot
ExecStart=< path_to_auto_scheduler > /env/bin/python < path_to_auto_scheduler > /schedule_single_station.py -s < station_id > -d 1.2 -P < path_to_priority_list > /< priority_file > .txt -z
User=pi
```
- Add a systemd timer unit file at `/etc/systemd/system/satnogs-auto-scheduler.timer` :
```
[Unit]
Description=Run satnogs-auto-scheduler hourly and on boot
[Timer]
OnBootSec=2min
OnUnitActiveSec=1h
[Install]
WantedBy=timers.target
```
- Start the timer with
```bash
sudo systemctl start satnogs-auto-scheduler.timer
```
- Enable the timer to be started on boot with
```bash
sudo systemctl enable satnogs-auto-scheduler.timer
```
If you want to run the auto-scheduler once manually, you can do so with
```bash
sudo systemctl start satnogs-auto-scheduler.service
```
2019-05-10 01:20:47 -06:00
2019-05-07 09:13:34 -06:00
## Usage
The following command will list all available command-line arguments:
2019-06-25 15:05:43 -06:00
```bash
2019-05-07 09:13:34 -06:00
./schedule_single_station.py --help
```
2018-12-02 05:09:23 -07:00
## License
[![license ](https://img.shields.io/badge/license-AGPL%203.0-6672D8.svg )](LICENSE)
2019-05-10 01:20:47 -06:00
Copyright 2019 - Cees Bassa, Fabian Schmidt, Pierros Papadeas