Receiver¶
receiver
¶
ORION ground station receiver for HIGH-priority satellite image downlink.
Listens on TCP port 50050 for ORIO-framed image transmissions from the
flight segment's GroundCommsDriver. Each connection carries one frame:
an 8-byte header (4-byte ORIO magic + 4-byte big-endian payload length)
followed by raw pixel data (typically 786,432 bytes for a 512x512 RGB image).
Received frames are saved sequentially to the ./data/downlinked_XBand/ directory
as both orion_frame_XXXX.raw (original bytes) and orion_frame_XXXX.jpg
(viewable image).
Usage:
cd ground_segment
uv run receiver.py
See the ORIO frame protocol documentation for the full wire format specification.
raw_to_jpg(raw_path, payload_len)
¶
Convert a raw RGB file to JPG if it matches the expected 512x512x3 size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_path
|
str
|
Path to the |
required |
payload_len
|
int
|
Size of the payload in bytes. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The JPG file path on success, or |
Source code in ground_segment/receiver.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
recv_exact(sock, n)
¶
Read exactly n bytes from sock, returning the accumulated buffer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sock
|
socket
|
Connected TCP socket to read from. |
required |
n
|
int
|
Number of bytes to read. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
A |
bytes
|
the connection before all bytes were delivered. |
Source code in ground_segment/receiver.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
start_receiver()
¶
Start the ORIO ground station receiver loop.
Binds a TCP server on LISTEN_IP:LISTEN_PORT, accepts one connection
at a time, validates the ORIO header, reads the image payload, writes
the raw bytes to disk, and converts 512x512 RGB frames to JPG.
Runs indefinitely until interrupted.
Source code in ground_segment/receiver.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |