Skip to content

Commit

Permalink
Add connection to the HIT telemetry proxy as an option in Telemetry S…
Browse files Browse the repository at this point in the history
…ubmit

See csete#131
  • Loading branch information
daniestevez committed Jul 13, 2020
1 parent f4f7d92 commit d1fcfd1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Option not to add a control byte in PDU to KISS
- Connection to the Harbin Institute of Technology telemetry proxy from Telemetry Submit

### Fixed
- Bug that prevented the NORAD field from appearing in Telemetry Submit
Expand Down
13 changes: 10 additions & 3 deletions grc/components/datasinks/satellites_telemetry_submit.block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ parameters:
label: Server
dtype: enum
default: '"SatNOGS"'
options: ['"SatNOGS"', '"FUNcube"', '"PWSat"', '"BME"']
option_labels: [SatNOGS DB, AMSAT-UK Data Warehouse, PW-Sat2 Ground Station, BME Ground Station]
options: ['"SatNOGS"', '"FUNcube"', '"PWSat"', '"BME"', '"HIT"']
option_labels: [SatNOGS DB, AMSAT-UK Data Warehouse, PW-Sat2 Ground Station, BME Ground Station, Harbin Institute of Technology]
- id: norad
label: NORAD ID
dtype: int
default: 0
hide: ${ 'all' if server not in ['"SatNOGS"', '"BME"'] else 'none' }
- id: port
label: TCP server port
dtype: int
default: 0
hide: ${ 'none' if server == '"HIT"' else 'all' }
- id: options
label: Command line options
dtype: string
Expand All @@ -28,7 +33,7 @@ templates:
imports: |-
import satellites.components.datasinks
import satellites.utils.config
make: satellites.components.datasinks.telemetry_submit(${server}, ${norad}, satellites.utils.config.open_config(), options=${options})
make: satellites.components.datasinks.telemetry_submit(${server}, norad=${norad}, port='${port}', config=satellites.utils.config.open_config(), options=${options})

documentation: |-
Sends telemetry frames to an online telemetry data base server
Expand All @@ -40,6 +45,8 @@ documentation: |-
Parameters:
Server: selects the server to submit telemetry to
NORAD ID: NORAD ID of the satellite (for SatNOGS and BME)
TCP server port: TCP port where the proxy is listening (for HIT)
Command line options: options to pass down to the block, following the syntax of the gr_satellites command line tool
file_format: 1
14 changes: 12 additions & 2 deletions python/components/datasinks/telemetry_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#

from gnuradio import gr, blocks
from ... import submit, funcube_submit, pwsat2_submitter, bme_submitter
from ... import submit, funcube_submit, pwsat2_submitter, bme_submitter, pdu_to_kiss

class telemetry_submit(gr.hier_block2):
"""
Expand All @@ -22,10 +22,11 @@ class telemetry_submit(gr.hier_block2):
Args:
server: 'SatNOGS', 'FUNcube', 'PWSat' or 'BME' (string)
norad: NORAD ID (int)
port: TCP port to connect to (used by HIT) (str)
config: configuration file from configparser
options: options from argparse
"""
def __init__(self, server, norad = None, config = None, options = None):
def __init__(self, server, norad = None, port = None, config = None, options = None):
gr.hier_block2.__init__(self, "telemetry_submit",
gr.io_signature(0, 0, 0),
gr.io_signature(0, 0, 0))
Expand All @@ -46,6 +47,15 @@ def __init__(self, server, norad = None, config = None, options = None):
satellites = {44830 : 'atl1', 44832 : 'smogp'}
satellite = satellites[norad]
self.submit = bme_submitter(config['BME']['user'], config['BME']['password'], satellite)
elif server == 'HIT':
try:
self.tcp = blocks.socket_pdu('TCP_CLIENT', '127.0.0.1', port, 10000, False)
except RuntimeError as e:
print('Could not connect to telemetry proxy:', e)
print('Disabling telemetry submission...')
return
self.submit = pdu_to_kiss(control_byte = False)
self.msg_connect((self.submit, 'out'), (self.tcp, 'pdus'))
else:
raise ValueError('Unsupported telemetry server')

Expand Down
11 changes: 9 additions & 2 deletions python/core/gr_satellites_flowgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,16 @@ def get_telemetry_submitters(self, satyaml, config):
config: configuration file from configparser
"""
norad = satyaml['norad']
submitters = [datasinks.telemetry_submit('SatNOGS', norad, config)]
submitters = [datasinks.telemetry_submit('SatNOGS', norad = norad, config = config)]
for server in satyaml.get('telemetry_servers', []):
submitters.append(datasinks.telemetry_submit(server, norad, config))
port = None
if server.startswith('HIT '):
port = server.split()[1]
server = 'HIT'
submitters.append(datasinks.telemetry_submit(server,
norad = norad,
port = port,
config = config))
return submitters

def get_demodulator(self, modulation):
Expand Down
2 changes: 2 additions & 0 deletions python/satyaml/BY02.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: BY02
alternative_names:
- BY70-2
norad: 45857
telemetry_servers:
- HIT 8001
data:
&tlm Telemetry:
telemetry: by02
Expand Down
3 changes: 2 additions & 1 deletion python/satyaml/satyaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def check_yaml(self, yml):
raise YAMLError(f'NORAD field does not contain a number in {yml}')
if 'telemetry_servers' in d:
for server in d['telemetry_servers']:
if server not in ['SatNOGS', 'FUNcube', 'PWSat', 'BME']:
if server not in ['SatNOGS', 'FUNcube', 'PWSat', 'BME'] and\
not server.startswith('HIT '):
raise YAMLError(f'Unknown telemetry server {server}')
if 'data' not in d:
raise YAMLError(f'Missing data field in {yml}')
Expand Down

0 comments on commit d1fcfd1

Please sign in to comment.