Skip to content

Commit d1fcfd1

Browse files
committed
Add connection to the HIT telemetry proxy as an option in Telemetry Submit
See csete#131
1 parent f4f7d92 commit d1fcfd1

File tree

6 files changed

+36
-8
lines changed

6 files changed

+36
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

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

1213
### Fixed
1314
- Bug that prevented the NORAD field from appearing in Telemetry Submit

grc/components/datasinks/satellites_telemetry_submit.block.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ parameters:
77
label: Server
88
dtype: enum
99
default: '"SatNOGS"'
10-
options: ['"SatNOGS"', '"FUNcube"', '"PWSat"', '"BME"']
11-
option_labels: [SatNOGS DB, AMSAT-UK Data Warehouse, PW-Sat2 Ground Station, BME Ground Station]
10+
options: ['"SatNOGS"', '"FUNcube"', '"PWSat"', '"BME"', '"HIT"']
11+
option_labels: [SatNOGS DB, AMSAT-UK Data Warehouse, PW-Sat2 Ground Station, BME Ground Station, Harbin Institute of Technology]
1212
- id: norad
1313
label: NORAD ID
1414
dtype: int
1515
default: 0
1616
hide: ${ 'all' if server not in ['"SatNOGS"', '"BME"'] else 'none' }
17+
- id: port
18+
label: TCP server port
19+
dtype: int
20+
default: 0
21+
hide: ${ 'none' if server == '"HIT"' else 'all' }
1722
- id: options
1823
label: Command line options
1924
dtype: string
@@ -28,7 +33,7 @@ templates:
2833
imports: |-
2934
import satellites.components.datasinks
3035
import satellites.utils.config
31-
make: satellites.components.datasinks.telemetry_submit(${server}, ${norad}, satellites.utils.config.open_config(), options=${options})
36+
make: satellites.components.datasinks.telemetry_submit(${server}, norad=${norad}, port='${port}', config=satellites.utils.config.open_config(), options=${options})
3237

3338
documentation: |-
3439
Sends telemetry frames to an online telemetry data base server
@@ -40,6 +45,8 @@ documentation: |-
4045
4146
Parameters:
4247
Server: selects the server to submit telemetry to
48+
NORAD ID: NORAD ID of the satellite (for SatNOGS and BME)
49+
TCP server port: TCP port where the proxy is listening (for HIT)
4350
Command line options: options to pass down to the block, following the syntax of the gr_satellites command line tool
4451
4552
file_format: 1

python/components/datasinks/telemetry_submit.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010

1111
from gnuradio import gr, blocks
12-
from ... import submit, funcube_submit, pwsat2_submitter, bme_submitter
12+
from ... import submit, funcube_submit, pwsat2_submitter, bme_submitter, pdu_to_kiss
1313

1414
class telemetry_submit(gr.hier_block2):
1515
"""
@@ -22,10 +22,11 @@ class telemetry_submit(gr.hier_block2):
2222
Args:
2323
server: 'SatNOGS', 'FUNcube', 'PWSat' or 'BME' (string)
2424
norad: NORAD ID (int)
25+
port: TCP port to connect to (used by HIT) (str)
2526
config: configuration file from configparser
2627
options: options from argparse
2728
"""
28-
def __init__(self, server, norad = None, config = None, options = None):
29+
def __init__(self, server, norad = None, port = None, config = None, options = None):
2930
gr.hier_block2.__init__(self, "telemetry_submit",
3031
gr.io_signature(0, 0, 0),
3132
gr.io_signature(0, 0, 0))
@@ -46,6 +47,15 @@ def __init__(self, server, norad = None, config = None, options = None):
4647
satellites = {44830 : 'atl1', 44832 : 'smogp'}
4748
satellite = satellites[norad]
4849
self.submit = bme_submitter(config['BME']['user'], config['BME']['password'], satellite)
50+
elif server == 'HIT':
51+
try:
52+
self.tcp = blocks.socket_pdu('TCP_CLIENT', '127.0.0.1', port, 10000, False)
53+
except RuntimeError as e:
54+
print('Could not connect to telemetry proxy:', e)
55+
print('Disabling telemetry submission...')
56+
return
57+
self.submit = pdu_to_kiss(control_byte = False)
58+
self.msg_connect((self.submit, 'out'), (self.tcp, 'pdus'))
4959
else:
5060
raise ValueError('Unsupported telemetry server')
5161

python/core/gr_satellites_flowgraph.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,16 @@ def get_telemetry_submitters(self, satyaml, config):
187187
config: configuration file from configparser
188188
"""
189189
norad = satyaml['norad']
190-
submitters = [datasinks.telemetry_submit('SatNOGS', norad, config)]
190+
submitters = [datasinks.telemetry_submit('SatNOGS', norad = norad, config = config)]
191191
for server in satyaml.get('telemetry_servers', []):
192-
submitters.append(datasinks.telemetry_submit(server, norad, config))
192+
port = None
193+
if server.startswith('HIT '):
194+
port = server.split()[1]
195+
server = 'HIT'
196+
submitters.append(datasinks.telemetry_submit(server,
197+
norad = norad,
198+
port = port,
199+
config = config))
193200
return submitters
194201

195202
def get_demodulator(self, modulation):

python/satyaml/BY02.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: BY02
22
alternative_names:
33
- BY70-2
44
norad: 45857
5+
telemetry_servers:
6+
- HIT 8001
57
data:
68
&tlm Telemetry:
79
telemetry: by02

python/satyaml/satyaml.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def check_yaml(self, yml):
5252
raise YAMLError(f'NORAD field does not contain a number in {yml}')
5353
if 'telemetry_servers' in d:
5454
for server in d['telemetry_servers']:
55-
if server not in ['SatNOGS', 'FUNcube', 'PWSat', 'BME']:
55+
if server not in ['SatNOGS', 'FUNcube', 'PWSat', 'BME'] and\
56+
not server.startswith('HIT '):
5657
raise YAMLError(f'Unknown telemetry server {server}')
5758
if 'data' not in d:
5859
raise YAMLError(f'Missing data field in {yml}')

0 commit comments

Comments
 (0)