Skip to content

Migrate to V2 packet format #113

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

Merged
merged 66 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
21a783d
Add new packet format
khang-874 Nov 18, 2024
0f4f83c
fix parsing
khang-874 Jan 27, 2025
55bd4b2
Start migrating packet spec
EliasJRH Mar 22, 2025
0ee629e
Remove sync word
EliasJRH Mar 22, 2025
212fd5d
Start working on parsing
EliasJRH Mar 22, 2025
0edb1a0
fix comment
Juan-789 Mar 22, 2025
1fb3628
add id, and fix to voltage. And fix a letter in a case
Juan-789 Mar 22, 2025
41943f4
Merge branch 'new-packet-format' of https://github.com/CarletonURocke…
Juan-789 Mar 22, 2025
497fa9e
Add parsing hex
EliasJRH Mar 24, 2025
fa0f8b2
continue transition to new spec
AngusJull Mar 25, 2025
03f1fe7
generalize block parsing and types
AngusJull Mar 25, 2025
efd1d48
go back to using dataclasses for blocks
AngusJull Mar 25, 2025
8a00102
update parsing to use new block types
AngusJull Mar 25, 2025
1a72091
start working on a more comprehensible decoder
AngusJull Mar 28, 2025
8d3f925
rip out decoder, replace with boring list
AngusJull Mar 28, 2025
e7bd438
fix imports and types
AngusJull Mar 31, 2025
c339d30
add a sample mission file for new spec
AngusJull Mar 31, 2025
f0629d7
Separate launch and sea level alt and fix mission times
EliasJRH Mar 31, 2025
3f471cf
Fix callsign warning to account for callzones
EliasJRH Mar 31, 2025
9cc661d
Add more error catching
EliasJRH Mar 31, 2025
cdcf34f
add mission that follows new spec
AngusJull Apr 1, 2025
9f2a4e1
add converter from nuttx output to missions
AngusJull Apr 1, 2025
2046519
Add necesarry unit conversions
EliasJRH Apr 2, 2025
1a6766e
Have blocks be output as understandable values
EliasJRH Apr 2, 2025
042932b
Add new packet format
khang-874 Nov 18, 2024
9aa87d7
fix parsing
khang-874 Jan 27, 2025
22e96d8
fix comment
Juan-789 Mar 22, 2025
db1efb0
add id, and fix to voltage. And fix a letter in a case
Juan-789 Mar 22, 2025
c6f5be7
Start migrating packet spec
EliasJRH Mar 22, 2025
f775546
Remove sync word
EliasJRH Mar 22, 2025
2e945a9
Rebase
EliasJRH Apr 4, 2025
efc8bcd
Add parsing hex
EliasJRH Mar 24, 2025
69cede8
continue transition to new spec
AngusJull Mar 25, 2025
feefa85
generalize block parsing and types
AngusJull Mar 25, 2025
971b356
go back to using dataclasses for blocks
AngusJull Mar 25, 2025
f630a27
update parsing to use new block types
AngusJull Mar 25, 2025
f5c4bfb
start working on a more comprehensible decoder
AngusJull Mar 28, 2025
ba8dee4
rip out decoder, replace with boring list
AngusJull Mar 28, 2025
8ea7e49
fix imports and types
AngusJull Mar 31, 2025
ebdc8a0
add a sample mission file for new spec
AngusJull Mar 31, 2025
28dfc81
Separate launch and sea level alt and fix mission times
EliasJRH Mar 31, 2025
2747872
Fix callsign warning to account for callzones
EliasJRH Mar 31, 2025
8039ee5
Add more error catching
EliasJRH Mar 31, 2025
2540aef
add mission that follows new spec
AngusJull Apr 1, 2025
52f5be3
add converter from nuttx output to missions
AngusJull Apr 1, 2025
8b64dce
Add necesarry unit conversions
EliasJRH Apr 2, 2025
78d1bba
Have blocks be output as understandable values
EliasJRH Apr 2, 2025
3bf7151
Rebase
EliasJRH Apr 4, 2025
9d0ea6e
Fix telemetry output dict
EliasJRH Apr 4, 2025
75c1524
Merge remote-tracking branch 'refs/remotes/origin/packet-format' into…
EliasJRH Apr 4, 2025
55f0ae2
Add function for magnitude
EliasJRH Apr 5, 2025
08e844c
Add linear acceleration and voltage to data output
EliasJRH Apr 5, 2025
97f91a4
Remove debug logs
EliasJRH Apr 5, 2025
91d2288
Move old missions to archive folder
EliasJRH Apr 5, 2025
6fee9b2
Format
EliasJRH Apr 5, 2025
76cf589
Format
EliasJRH Apr 5, 2025
f33b476
Add rules to ignore star imports
EliasJRH Apr 30, 2025
5320b21
Format
EliasJRH Apr 30, 2025
de3fc06
Fix some formatting issues
EliasJRH Apr 30, 2025
fc3dbe6
Comment out tests (need to be replaced)
EliasJRH Apr 30, 2025
9d73405
Update requirements
EliasJRH Apr 30, 2025
4e57b69
Update rocket name
EliasJRH Apr 30, 2025
619559b
More formatting fix
EliasJRH Apr 30, 2025
d1012bd
Remove syncword from testing until it's confirmed to be working
EliasJRH Apr 30, 2025
22cca75
The linter can bite me
EliasJRH Apr 30, 2025
0f1cab8
bruh
EliasJRH Apr 30, 2025
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
10 changes: 8 additions & 2 deletions modules/misc/unit_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def pascals_to_psi(pascals: int) -> float:

return round(pascals / 6895, 2)


def millimeters_to_meters(millimeters: int) -> float:
"""Returns the passed millimeters value into meters.
Args:
Expand All @@ -57,6 +58,7 @@ def millimeters_to_meters(millimeters: int) -> float:

return round(millimeters / 1000, 2)


def centimeters_to_meters(centimeters: int) -> float:
"""Returns the passed centimeters value into meters.
Args:
Expand All @@ -68,6 +70,7 @@ def centimeters_to_meters(centimeters: int) -> float:

return round(centimeters / 100, 2)


def milliseconds_to_seconds(milliseconds: int) -> float:
"""Returns the passed milliseconds value into seconds.
Args:
Expand All @@ -79,6 +82,7 @@ def milliseconds_to_seconds(milliseconds: int) -> float:

return round(milliseconds / 1000, 2)


def tenthdegrees_to_degrees(tenthdegrees: int) -> float:
"""Returns the passed tenth degree per second value into degrees per second.
Args:
Expand All @@ -90,6 +94,7 @@ def tenthdegrees_to_degrees(tenthdegrees: int) -> float:

return round(tenthdegrees / 10, 2)


def microdegrees_to_degrees(microdegrees: int) -> float:
"""Returns the passed microdegree value into degrees.
Args:
Expand All @@ -101,15 +106,16 @@ def microdegrees_to_degrees(microdegrees: int) -> float:

return round(microdegrees / pow(10, 7), 2)


def magnitude(x: int, y: int, z: int) -> float:
"""Returns the magnitude of the 3D vector specified by the input values
Args:
x (int): x component of the vector
y (int): y component of the vector
z (int): z component of the vector

Returns:
float: Magnitude of vector
"""

return round((pow(x, 2) + pow(y, 2) + pow(z, 2) ** 0.5), 2)
return round((pow(x, 2) + pow(y, 2) + pow(z, 2) ** 0.5), 2)
5 changes: 3 additions & 2 deletions modules/telemetry/packet_spec/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def decode(cls, packet_timestamp: int, encoded: bytes) -> tuple[int]:
"""Decode the block from bytes using the struct format string
Args:
packet_timestamp int: Number of half minutes since power on
encoded bytes: Bytes containing block contents
encoded bytes: Bytes containing block contents

Returns:
tuple[int]: The results of the unpacking
Expand Down Expand Up @@ -79,10 +79,11 @@ class TimedBlock(Block):
def output_formatted(self, into: dict[str, Any]):
pass


@dataclass
class AltitudeAboveLaunchLevel(TimedBlock):
_struct_format: str = field(default="<Hi", init=False, repr=False)
measurement_time: int
measurement_time: int
altitude: int

def output_formatted(self, into: dict[str, Any]):
Expand Down
2 changes: 1 addition & 1 deletion modules/telemetry/parsing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ def parse_blocks(packet_header: PacketHeader, encoded_blocks: bytes) -> List[Blo
logger.debug(data_block)
parsed_blocks.append(data_block)
# Remove the data we processed from the whole set, and move onto the next data block
encoded_blocks = encoded_blocks[BLOCK_HEADER_LENGTH + block_len:]
encoded_blocks = encoded_blocks[BLOCK_HEADER_LENGTH + block_len :]

return parsed_blocks
7 changes: 3 additions & 4 deletions modules/telemetry/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __iter__(self):
with open(self.replay_path, "rb") as file:
callsign = file.read(9)
if len(callsign) < 9:
return
return
next_packet = bytearray()

while True:
Expand All @@ -80,13 +80,13 @@ def __iter__(self):
next_packet.extend(data)
yield next_packet.hex()
break

# Start a new packet
if data == callsign:
yield next_packet.hex()
next_packet = bytearray()

next_packet.extend(data)
next_packet.extend(data)


class LogfileReplay(TelemetryReplay):
Expand All @@ -108,4 +108,3 @@ def run(self):
if not self.replay_input.empty():
self.parse_input_command(self.replay_input.get())
sleep(0.052)

8 changes: 4 additions & 4 deletions tests/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

# Imports
import pytest
import modules.misc.converter as conv
from modules.misc.unit_conversions import *


# Tests
def test_celsius_to_fahrenheit() -> None:
"""Test that Celsius is properly converted to Fahrenheit."""
assert conv.celsius_to_fahrenheit(12.0) == pytest.approx(53.6) # type: ignore
assert celsius_to_fahrenheit(12.0) == pytest.approx(53.6) # type: ignore


def test_metres_to_feet() -> None:
"""Test that metres are properly converted to feet."""
assert conv.metres_to_feet(5.0) == pytest.approx(16.4) # type: ignore
assert metres_to_feet(5.0) == pytest.approx(16.4) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not know about this approx helper, gonna start using that from now on!



def test_pascals_to_psi() -> None:
"""Test that metres are properly converted to feet."""
assert conv.pascals_to_psi(87181) == pytest.approx(12.64) # type: ignore
assert pascals_to_psi(87181) == pytest.approx(12.64) # type: ignore
Loading