Skip to content

Commit

Permalink
Rename Airbrakes folder to airbrakes
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil21 committed Sep 13, 2024
1 parent 8443388 commit f150793
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Scripts/test_imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
For the pi, you will have to use python3
"""

from Airbrakes.imu import IMU
from airbrakes.imu import IMU

# Should be checked before launch
UPSIDE_DOWN = True
Expand Down
4 changes: 2 additions & 2 deletions Scripts/test_logger.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Module to test the logger module."""

from Airbrakes.imu import IMUDataPacket
from Airbrakes.logger import Logger
from airbrakes.imu import IMUDataPacket
from airbrakes.logger import Logger

CSV_HEADERS = ["state", "extension", *list(IMUDataPacket(0.0).__slots__)]

Expand Down
2 changes: 1 addition & 1 deletion Scripts/test_servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
For the pi, you will have to use python3
"""

from Airbrakes.servo import Servo
from airbrakes.servo import Servo

# The pin that the servo's data wire is plugged into, in this case the GPIO 12 pin which is used for PWM
SERVO_PIN = 12
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions Airbrakes/airbrakes.py → airbrakes/airbrakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from typing import TYPE_CHECKING

from Airbrakes.imu import IMU, IMUDataPacket, RollingAverages
from Airbrakes.logger import Logger
from Airbrakes.servo import Servo
from Airbrakes.state import StandByState, State
from airbrakes.imu import IMU, IMUDataPacket, RollingAverages
from airbrakes.logger import Logger
from airbrakes.servo import Servo
from airbrakes.state import StandByState, State

if TYPE_CHECKING:
import collections
Expand Down Expand Up @@ -60,7 +60,7 @@ def update(self):
data_packets: collections.deque[IMUDataPacket] = self.imu.get_imu_data_packets()

# Logs the current state, extension, and IMU data
rolling_average = RollingAverages(data_packets.copy())
RollingAverages(data_packets.copy())
# TODO: Compute state(s) for given IMU data
self.logger.log(self.state.get_name(), self.current_extension, data_packets.copy())

Expand Down
File renamed without changes.
9 changes: 6 additions & 3 deletions Airbrakes/imu/imu.py → airbrakes/imu/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import mscl

from Airbrakes.imu.imu_data_packet import EstimatedDataPacket, IMUDataPacket, RawDataPacket
from airbrakes.imu.imu_data_packet import EstimatedDataPacket, IMUDataPacket, RawDataPacket


class RollingAverages:
Expand Down Expand Up @@ -87,8 +87,11 @@ def _fetch_data_loop(self, port: str, frequency: int, _: bool):
timestamp = packet.collectedTimestamp().nanoseconds()

# Initialize packet with the timestamp, determines if the packet is raw or estimated
imu_data_packet = EstimatedDataPacket(timestamp) \
if packet.descriptorSet() == self.ESTIMATED_DESCRIPTOR_SET else RawDataPacket(timestamp)
imu_data_packet = (
EstimatedDataPacket(timestamp)
if packet.descriptorSet() == self.ESTIMATED_DESCRIPTOR_SET
else RawDataPacket(timestamp)
)

# Each of these packets has multiple data points
for data_point in packet.data():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
scaledAccelZ: float | None = None,
scaledGyroX: float | None = None,
scaledGyroY: float | None = None,
scaledGyroZ: float | None = None
scaledGyroZ: float | None = None,
):
super().__init__(timestamp)

Expand Down Expand Up @@ -111,7 +111,7 @@ def __init__(
estAngularRateZ: float | None = None,
estCompensatedAccelX: float | None = None,
estCompensatedAccelY: float | None = None,
estCompensatedAccelZ: float | None = None
estCompensatedAccelZ: float | None = None,
):
super().__init__(timestamp)

Expand Down
2 changes: 1 addition & 1 deletion Airbrakes/logger.py → airbrakes/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import multiprocessing
from pathlib import Path

from Airbrakes.imu import IMUDataPacket
from airbrakes.imu import IMUDataPacket


class Logger:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Airbrakes/state.py → airbrakes/state.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Module for the finite state machine that represents which state of flight we are in."""

from Airbrakes.airbrakes import AirbrakesContext
from airbrakes.airbrakes import AirbrakesContext


class State:
Expand Down
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""The main file which will be run on the Raspberry Pi. It will create the AirbrakesContext object and run the main
loop."""

from Airbrakes.airbrakes import AirbrakesContext
from Airbrakes.imu import IMU, IMUDataPacket
from Airbrakes.logger import Logger
from Airbrakes.servo import Servo
from airbrakes.airbrakes import AirbrakesContext
from airbrakes.imu import IMU, IMUDataPacket
from airbrakes.logger import Logger
from airbrakes.servo import Servo

# The pin that the servo's data wire is plugged into, in this case the GPIO 12 pin which is used for PWM
SERVO_PIN = 12
Expand Down

0 comments on commit f150793

Please sign in to comment.