Skip to content

Commit

Permalink
Add support for CIRBE
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Svihla <Sean.Svihla@lasp.colorado.edu>
  • Loading branch information
spsvihla committed Dec 5, 2022
1 parent f2df31a commit c06b5bd
Show file tree
Hide file tree
Showing 5 changed files with 408 additions and 0 deletions.
21 changes: 21 additions & 0 deletions python/satyaml/CIRBE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CIRBE
norad: 99401
data:
&tlm Telemetry:
telemetry: cirbe_70cm
transmitters:
9k6 FSK downlink:
frequency: 437.250e+6
modulation: FSK
baudrate: 9600
framing: AX.25
data:
- *tlm
19k2 FSK downlink:
frequency: 437.250e+6
modulation: FSK
baudrate: 19200
framing: AX.25
data:
- *tlm

2 changes: 2 additions & 0 deletions python/telemetry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ GR_PYTHON_INSTALL(
binar1.py
by02.py
by70_1.py
cirbe_70cm.py
cirbe_bct_soh.py
csp.py
ctim_70cm.py
cute_70cm.py
Expand Down
1 change: 1 addition & 0 deletions python/telemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .binar1 import binar1
from .by02 import by02
from .by70_1 import by70_1
from .cirbe_70cm import cirbe_70cm
from .csp import csp
from .ctim_70cm import ctim_70cm
from .cute_70cm import cute_70cm
Expand Down
68 changes: 68 additions & 0 deletions python/telemetry/cirbe_70cm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env python3

# Copyright 2017, 2018, 2019, 2020 Daniel Estevez <daniel@destevez.net>
# Copyright 2022 The Regents of the University of Colorado
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#


import copy
from datetime import datetime
from construct import Adapter, BitsInteger, BitStruct, Container, Enum, \
Flag, GreedyBytes, If, Int8ub, Int16ub, Int32ub, \
Padding, RawCopy, Struct, Switch
from .ax25 import Header
from .cirbe_bct_soh import cirbe_bct_soh


PrimaryHeader = BitStruct(
'ccsds_version' / BitsInteger(3),
'packet_type' / Flag,
'secondary_header_flag' / Flag,
'is_stored_data' / Flag,
'APID' / BitsInteger(10),
'grouping_flag' / Enum(BitsInteger(2), GRP_MIDDLE=0, GRP_BEGIN=1,
GRP_END=2, GRP_FIRST_AND_LAST=3),
'sequence_count' / BitsInteger(14),
'packet_length' / BitsInteger(16)
)


SecondaryHeaderRaw = Struct(
'time_stamp_seconds' / Int32ub,
'sub_seconds' / Int8ub,
Padding(1)
)


class TimeAdapter(Adapter):
def _encode(self, obj, context, path=None):
return Container()

def _decode(self, obj, context, path=None):
offset = datetime(2000, 1, 1, 12) - datetime(1970, 1, 1)
return (datetime.utcfromtimestamp(obj.time_stamp_seconds) + offset)


SecondaryHeader = TimeAdapter(
SecondaryHeaderRaw
)


cirbe_70cm = Struct(
'ax25_header' / Header,
'primary_header' / PrimaryHeader,
'secondary_header' / If(
lambda c: c.primary_header.secondary_header_flag,
SecondaryHeader
),
'packet' / Switch(
lambda c: (c.primary_header.APID),
{
(0x050): cirbe_bct_soh
}
)
)
Loading

0 comments on commit c06b5bd

Please sign in to comment.