Skip to content

Commit

Permalink
Added raw data packet
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonElia committed Sep 13, 2024
1 parent 47f2029 commit a285a3f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
47 changes: 31 additions & 16 deletions Airbrakes/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,32 @@ def __init__(self, timestamp: float):


class RawDataPacket(IMUDataPacket):
__slots__ = ("",)
"""
Represents a raw data packet from the IMU, these values are exactly what the IMU read, without any processing done.
It contains a timestamp and the raw values of the acceleration and gyroscopes.
"""

__slots__ = ("scaledAccelX", "scaledAccelY", "scaledAccelZ", "scaledGyroX", "scaledGyroY", "scaledGyroZ",)

def __init__(self, altitude: float, yaw: float, pitch: float, roll: float):
# TODO: I know these names break snake_case convention, but they are the actual names of the data points so I argue we should keep them

Check failure on line 30 in Airbrakes/imu.py

View workflow job for this annotation

GitHub Actions / build

Ruff (E501)

Airbrakes/imu.py:30:121: E501 Line too long (139 > 120)
def __init__(self, scaledAccelX: float, scaledAccelY: float, scaledAccelZ: float, scaledGyroX: float,
scaledGyroY: float, scaledGyroZ: float):
super().__init__(0.0)
self.altitude = altitude
self.yaw = yaw
self.pitch = pitch
self.roll = roll
self.scaledAccelX = scaledAccelX
self.scaledAccelY = scaledAccelY
self.scaledAccelZ = scaledAccelZ
self.scaledGyroX = scaledGyroX
self.scaledGyroY = scaledGyroY
self.scaledGyroZ = scaledGyroZ


class EstimatedDataPacket(IMUDataPacket):
"""
Represents an estimated data packet from the IMU, these values are the processed values of the raw data that are
supposed to be more accurate/smoothed. It contains a timestamp and the estimated values of the altitude, yaw, pitch,
"""

# TODO: these are not all the right names/values, we will need to check the actual names
__slots__ = (
"altitude",
"filter_state",
Expand All @@ -43,15 +58,15 @@ class EstimatedDataPacket(IMUDataPacket):
)

def __init__(
self,
altitude: float,
yaw: float,
pitch: float,
roll: float,
filter_state: float,
roll_uncert: float,
pitch_uncert: float,
yaw_uncert: float,
self,
altitude: float,
yaw: float,
pitch: float,
roll: float,
filter_state: float,
roll_uncert: float,
pitch_uncert: float,
yaw_uncert: float,
):
super().__init__(0.0)
self.altitude = altitude
Expand All @@ -67,7 +82,7 @@ def __init__(
class RollingAverages:
"""Calculates the rolling averages of acceleration, (and?) from the set of data points"""

def __init__(self, data_points: list[IMUDataPacket]) -> None:
def __init__(self, data_points: list[IMUDataPacket]):
self.data_points = data_points

def add_estimated_data_packet(self):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@

logging

0 comments on commit a285a3f

Please sign in to comment.