black formatting
Python-based EGSE application for on-ground satellite testing.
Current scope:
The docs/ folder contains standards reference PDFs, including:
docs/
space_packet_ccsds.pdf
OpenSpaceEGSE/ ├── docs/ ├── src/ │ └── openspace_egse/ │ ├── config.py │ ├── ccsds/ │ │ ├── __init__.py │ │ ├── space_packet.py │ │ ├── sdlp.py │ │ ├── sdlp_uart.py │ │ ├── send_flow.py │ │ ├── receive_flow.py │ │ └── telemetry.py │ └── gui/ │ └── app.py ├── tests/ └── pyproject.toml
>= 3.11
python3-tk
python -m pip install -e .[dev,gui]
openspace-egse-gui
Running app on WSL in Windows may cause problems with USB com connection in the App. Here is the step by step instruction to handle it.
winget install usbipd
usbipd list
usbipd bind --busid 1-2
usbipd attach --wsl --busid 1-2
You can the check if the device is visible in WSL using commands:
lsusb
or
ls /dev/tty*
It may show up as /dev/ttyACM*.
pytest
End-to-end flow:
packet_type = TELECOMMAND
Implemented in src/openspace_egse/ccsds/space_packet.py.
src/openspace_egse/ccsds/space_packet.py
Primary header length: 6 bytes.
6 bytes
Supported fields:
version
packet_type
TELEMETRY
TELECOMMAND
secondary_header_flag
apid
sequence_flags
sequence_count
data_length
len(data_field) - 1
Validation includes APID, sequence count, payload length consistency, and bytes-like checks.
from openspace_egse.ccsds import SpacePacket packet = SpacePacket.build_tc( apid=100, sequence_count=5, payload=b"\x01\x02\x03", ) raw = packet.encode() decoded = SpacePacket.decode(raw) assert decoded == packet
Implemented in src/openspace_egse/ccsds/sdlp.py.
src/openspace_egse/ccsds/sdlp.py
TmTransferFrame
spacecraft_id
virtual_channel_id
master_channel_frame_count
virtual_channel_frame_count
first_header_pointer
ocf
fecf
TcTransferFrame
5 bytes
frame_sequence_number
bypass_flag
control_command_flag
Both TM/TC include strict encode/decode length validations.
Implemented in src/openspace_egse/ccsds/sdlp_uart.py.
src/openspace_egse/ccsds/sdlp_uart.py
Important: this is a project transport envelope (not a CCSDS standard field layout).
1=TM
2=TC
bit0 = has_fecf
uint16
END=0xC0
ESC=0xDB
0xDC
0xDD
Implemented in src/openspace_egse/ccsds/send_flow.py.
src/openspace_egse/ccsds/send_flow.py
Main API:
TcCommandSender.send(command, parameter=None)
TcSendConfig
Built-in commands:
ping
0x01 + uint16(parameter)
set_mode
0x02 + uint8(parameter)
reset_subsystem
0x03 + uint8(parameter)
request_status
0x04
Sequence counters are incremented automatically after successful write.
from openspace_egse.ccsds import TcCommandSender, TcSendConfig sender = TcCommandSender( serial_port=my_serial, config=TcSendConfig( spacecraft_id=1, virtual_channel_id=0, space_packet_apid=100, ), ) sender.send("set_mode", 2)
Implemented in src/openspace_egse/ccsds/receive_flow.py.
src/openspace_egse/ccsds/receive_flow.py
SdlpSpacePacketReceiver.process_uart_bytes(...)
SdlpSpacePacketReceiver.process_serial_once(...)
receive_and_print_once(...)
Behavior:
Implemented in src/openspace_egse/ccsds/telemetry.py.
src/openspace_egse/ccsds/telemetry.py
Current expected TM payload layout (>= 7 bytes):
>= 7 bytes
BOOT/IDLE/NOMINAL/SAFE/FAULT
Implemented in src/openspace_egse/gui/app.py.
src/openspace_egse/gui/app.py
logs/egse_events.log
All runtime/configurable parameters are in:
src/openspace_egse/config.py
This includes serial defaults, GUI timings/history, simulation waveform parameters, APIDs/SCID/VCID defaults, and event log defaults.
Edit src/openspace_egse/ccsds/send_flow.py:
TcCommandName
_TC_COMMAND_DEFINITIONS
build_tc_command_payload(...)
If parameter behavior changes, GUI control logic automatically adapts via tc_command_definition(...).
tc_command_definition(...)
Tip: keep command IDs (0x01, 0x02, …) stable and documented.
0x01
0x02
Edit src/openspace_egse/ccsds/telemetry.py:
Then update GUI rendering in src/openspace_egse/gui/app.py if you add new displayed fields or plots.
sdlp_uart.py
OpenSpaceEGSE:极简嵌入式 CCSDS/ECSS 协议 C 实现(OpenSpaceCode 系列组件)。镜像收录自 https://github.com/OpenSpaceCode/OpenSpaceEGSE,License:Apache-2.0
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
OpenSpaceEGSE
Python-based EGSE application for on-ground satellite testing.
Current scope:
The
docs/folder contains standards reference PDFs, including:space_packet_ccsds.pdf1) Project Structure
2) Installation & Run
Requirements
>= 3.11python3-tkOS package must be installedSetup
Run GUI
Running on WSL in Windows
Running app on WSL in Windows may cause problems with USB com connection in the App. Here is the step by step instruction to handle it.
You can the check if the device is visible in WSL using commands:
or
It may show up as /dev/ttyACM*.
Run tests
3) Protocol Stack Implemented
End-to-end flow:
TX (TC to OBC)
packet_type = TELECOMMAND)RX (TM from OBC)
4) CCSDS Space Packet
Implemented in
src/openspace_egse/ccsds/space_packet.py.Primary header length:
6 bytes.Supported fields:
version(3 bits)packet_type(TELEMETRY/TELECOMMAND)secondary_header_flagapid(11 bits)sequence_flags(2 bits)sequence_count(14 bits)data_length(len(data_field) - 1)Validation includes APID, sequence count, payload length consistency, and bytes-like checks.
Example
5) SDLP TM/TC Transfer Frames
Implemented in
src/openspace_egse/ccsds/sdlp.py.TM Transfer Frame (
TmTransferFrame)6 bytesspacecraft_id,virtual_channel_idmaster_channel_frame_count,virtual_channel_frame_countfirst_header_pointerocf(optional, 4 bytes)fecf(optional, 2 bytes)TC Transfer Frame (
TcTransferFrame)5 bytesspacecraft_id,virtual_channel_id,frame_sequence_numberbypass_flag,control_command_flagfecf(2 bytes)Both TM/TC include strict encode/decode length validations.
6) UART Framing (Stream Boundary Handling)
Implemented in
src/openspace_egse/ccsds/sdlp_uart.py.Important: this is a project transport envelope (not a CCSDS standard field layout).
Envelope payload (inside SLIP)
1=TM,2=TC)bit0 = has_fecf)uint16, big-endian)SLIP framing
END=0xC0,ESC=0xDB0xDC/0xDD7) TC Command Creation & Sending
Implemented in
src/openspace_egse/ccsds/send_flow.py.Main API:
TcCommandSender.send(command, parameter=None)TcSendConfigfor SCID/VCID/APID settingsBuilt-in commands:
ping0x01 + uint16(parameter)set_mode0x02 + uint8(parameter)reset_subsystem0x03 + uint8(parameter)request_status0x04Sequence counters are incremented automatically after successful write.
Example
8) TM Reception & Decoding
Implemented in
src/openspace_egse/ccsds/receive_flow.py.Main API:
SdlpSpacePacketReceiver.process_uart_bytes(...)SdlpSpacePacketReceiver.process_serial_once(...)receive_and_print_once(...)Behavior:
first_header_pointeras packet start offset9) Telemetry Payload Format (Current GUI Decoder)
Implemented in
src/openspace_egse/ccsds/telemetry.py.Current expected TM payload layout (
>= 7 bytes):BOOT/IDLE/NOMINAL/SAFE/FAULT)10) GUI Features
Implemented in
src/openspace_egse/gui/app.py.Control panel
Monitoring panel
Event log
logs/egse_events.log(repo-local)11) Central Configuration
All runtime/configurable parameters are in:
src/openspace_egse/config.pyThis includes serial defaults, GUI timings/history, simulation waveform parameters, APIDs/SCID/VCID defaults, and event log defaults.
12) Extending with Your Own TC Commands
Edit
src/openspace_egse/ccsds/send_flow.py:TcCommandName_TC_COMMAND_DEFINITIONSbuild_tc_command_payload(...)If parameter behavior changes, GUI control logic automatically adapts via
tc_command_definition(...).Tip: keep command IDs (
0x01,0x02, …) stable and documented.13) Extending with Your Own TM Telemetry
Edit
src/openspace_egse/ccsds/telemetry.py:Then update GUI rendering in
src/openspace_egse/gui/app.pyif you add new displayed fields or plots.14) Notes
sdlp_uart.pytransport envelope is intentionally simple for UART stream robustness and development velocity.