diff --git a/CHANGELOG.md b/CHANGELOG.md index bc5259e0..e867643c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/grc/components/datasinks/satellites_telemetry_submit.block.yml b/grc/components/datasinks/satellites_telemetry_submit.block.yml index 86b04c91..2da4394f 100644 --- a/grc/components/datasinks/satellites_telemetry_submit.block.yml +++ b/grc/components/datasinks/satellites_telemetry_submit.block.yml @@ -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 @@ -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 @@ -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 diff --git a/python/components/datasinks/telemetry_submit.py b/python/components/datasinks/telemetry_submit.py index f55c5e84..db79f737 100644 --- a/python/components/datasinks/telemetry_submit.py +++ b/python/components/datasinks/telemetry_submit.py @@ -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): """ @@ -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)) @@ -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') diff --git a/python/core/gr_satellites_flowgraph.py b/python/core/gr_satellites_flowgraph.py index 6a2a46b6..893a74b5 100644 --- a/python/core/gr_satellites_flowgraph.py +++ b/python/core/gr_satellites_flowgraph.py @@ -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): diff --git a/python/satyaml/BY02.yml b/python/satyaml/BY02.yml index 110d43fd..c75fb4da 100644 --- a/python/satyaml/BY02.yml +++ b/python/satyaml/BY02.yml @@ -2,6 +2,8 @@ name: BY02 alternative_names: - BY70-2 norad: 45857 +telemetry_servers: + - HIT 8001 data: &tlm Telemetry: telemetry: by02 diff --git a/python/satyaml/satyaml.py b/python/satyaml/satyaml.py index 972baeaf..13e0097a 100644 --- a/python/satyaml/satyaml.py +++ b/python/satyaml/satyaml.py @@ -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}')