Skip to content

Generate a raw CCSDS header

Travis Christian edited this page Mar 31, 2022 · 1 revision

The following code snippet can be used to generate a raw CCSDS header, which is needed for use with SendCfsCommandWithRawPayload. You must import the header module used for your project (set in the config file at ccsds:CCSDS_header_path) to use the correct CcsdsCommand implementation.

import sys
sys.path.append("/path/to/your/header") # use your local path, only necessary if it resides outside of ctf
import my_header
bytes(my_header.CcsdsCommand(<MID value>, <CC value>, <payload length>, source_id=<source_id>)).hex()

Example using the built-in ccsds_v2.py:

>>> from plugins.ccsds_plugin.cfe.ccsds_v2 import ccsds_v2
>>> bytes(ccsds_v2.CcsdsCommand(0x12345, 1, 0).hex()
'2b45c0000005002300000101'
Clone this wiki locally