Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CIRBE #426

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
67 changes: 67 additions & 0 deletions python/telemetry/cirbe_70cm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/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
#


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