Skip to content
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

Changed project structure #15

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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: 5 additions & 5 deletions airbrakes/airbrakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from typing import TYPE_CHECKING

from airbrakes.imu.data_processor import IMUDataProcessor
from airbrakes.imu.imu import IMU, IMUDataPacket
from airbrakes.imu.imu_data_packet import EstimatedDataPacket
from airbrakes.logger import Logger
from airbrakes.servo import Servo
from airbrakes.data_handling.data_processor import IMUDataProcessor
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket
from airbrakes.data_handling.logger import Logger
from airbrakes.hardware.imu import IMU, IMUDataPacket
from airbrakes.hardware.servo import Servo
from airbrakes.state import StandByState, State

if TYPE_CHECKING:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import statistics as stats
from collections.abc import Sequence

from airbrakes.imu.imu_data_packet import EstimatedDataPacket
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket


class IMUDataProcessor:
Expand Down
4 changes: 2 additions & 2 deletions airbrakes/logger.py → airbrakes/data_handling/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import multiprocessing
from pathlib import Path

from airbrakes.constants import CSV_HEADERS, STOP_SIGNAL
from airbrakes.imu.imu_data_packet import IMUDataPacket
from airbrakes.data_handling.imu_data_packet import IMUDataPacket
from constants import CSV_HEADERS, STOP_SIGNAL


class Logger:
Expand Down
Empty file added airbrakes/hardware/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions airbrakes/imu/imu.py → airbrakes/hardware/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
stacklevel=2,
)

from airbrakes.constants import ESTIMATED_DESCRIPTOR_SET, MAX_QUEUE_SIZE, RAW_DESCRIPTOR_SET
from airbrakes.imu.imu_data_packet import EstimatedDataPacket, IMUDataPacket, RawDataPacket
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket, IMUDataPacket, RawDataPacket
from constants import ESTIMATED_DESCRIPTOR_SET, MAX_QUEUE_SIZE, RAW_DESCRIPTOR_SET


class IMU:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion airbrakes/constants.py → constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path

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

# -------------------------------------------------------
# Servo Configuration
Expand Down
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
loop."""

from airbrakes.airbrakes import AirbrakesContext
from airbrakes.constants import FREQUENCY, LOGS_PATH, MAX_EXTENSION, MIN_EXTENSION, PORT, SERVO_PIN, UPSIDE_DOWN
from airbrakes.imu.imu import IMU
from airbrakes.logger import Logger
from airbrakes.servo import Servo
from airbrakes.data_handling.logger import Logger
from airbrakes.hardware.imu import IMU
from airbrakes.hardware.servo import Servo
from constants import FREQUENCY, LOGS_PATH, MAX_EXTENSION, MIN_EXTENSION, PORT, SERVO_PIN, UPSIDE_DOWN


def main():
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.1.0"
dependencies = [
"gpiozero",
"pigpio", # Run sudo pigpiod before running the program
"pytest",
harshil21 marked this conversation as resolved.
Show resolved Hide resolved
# Installation instructions for the following dependencies can be found in the README:
# "mscl" https://github.com/LORD-MicroStrain/MSCL/blob/master/BuildScripts/buildReadme_Linux.md
]
Expand Down
4 changes: 0 additions & 4 deletions requirements.txt
harshil21 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

8 changes: 3 additions & 5 deletions scripts/run_imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
For the pi, you will have to use python3
"""

from airbrakes.constants import FREQUENCY, PORT, UPSIDE_DOWN
from airbrakes.imu.imu import IMU
from airbrakes.logger import Logger
from constants import FREQUENCY, PORT, UPSIDE_DOWN
from airbrakes.hardware.imu import IMU
from airbrakes.data_handling.logger import Logger
from pathlib import Path

from airbrakes.imu.imu_data_packet import EstimatedDataPacket, RawDataPacket

# import matplotlib.pyplot as plt
# import matplotlib.animation as animation
# from collections import deque
Expand Down
6 changes: 3 additions & 3 deletions scripts/run_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import time
from collections import deque

from airbrakes.constants import LOGS_PATH
from airbrakes.imu.imu_data_packet import RawDataPacket
from airbrakes.logger import Logger
from constants import LOGS_PATH
from airbrakes.data_handling.imu_data_packet import RawDataPacket
from airbrakes.data_handling.logger import Logger


def main():
Expand Down
4 changes: 2 additions & 2 deletions scripts/run_servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
For the pi, you will have to use python3
"""

from airbrakes.constants import MAX_EXTENSION, MIN_EXTENSION, SERVO_PIN
from airbrakes.servo import Servo
from constants import MAX_EXTENSION, MIN_EXTENSION, SERVO_PIN
from airbrakes.hardware.servo import Servo

servo = Servo(SERVO_PIN, MIN_EXTENSION, MAX_EXTENSION)

Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import pytest
from gpiozero.pins.mock import MockFactory, MockPWMPin

from airbrakes.constants import FREQUENCY, MAX_EXTENSION, MIN_EXTENSION, PORT, SERVO_PIN, UPSIDE_DOWN
from airbrakes.imu.imu import IMU
from airbrakes.logger import Logger
from airbrakes.servo import Servo
from airbrakes.data_handling.logger import Logger
from airbrakes.hardware.imu import IMU
from airbrakes.hardware.servo import Servo
from constants import FREQUENCY, MAX_EXTENSION, MIN_EXTENSION, PORT, SERVO_PIN, UPSIDE_DOWN

LOG_PATH = Path("tests/logs")

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

import pytest

from airbrakes.imu.data_processor import IMUDataProcessor
from airbrakes.imu.imu_data_packet import EstimatedDataPacket
from airbrakes.data_handling.data_processor import IMUDataProcessor
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket


def simulate_altitude_sine_wave(n_points=1000, frequency=0.01, amplitude=100, noise_level=3, base_altitude=20):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import time
from collections import deque

from airbrakes.constants import FREQUENCY, PORT, UPSIDE_DOWN
from airbrakes.imu.imu import IMU
from airbrakes.imu.imu_data_packet import EstimatedDataPacket, IMUDataPacket, RawDataPacket
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket, IMUDataPacket, RawDataPacket
from airbrakes.hardware.imu import IMU
from constants import FREQUENCY, PORT, UPSIDE_DOWN

RAW_DATA_PACKET_SAMPLING_RATE = 1 / 1000 # 1kHz
EST_DATA_PACKET_SAMPLING_RATE = 1 / 500 # 500Hz
Expand Down
2 changes: 1 addition & 1 deletion tests/test_imu_data_packet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from airbrakes.imu.imu_data_packet import EstimatedDataPacket, RawDataPacket
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket, RawDataPacket


class TestEstimatedDataPacket:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import pytest

from airbrakes.constants import CSV_HEADERS
from airbrakes.imu.imu_data_packet import EstimatedDataPacket, RawDataPacket
from airbrakes.logger import Logger
from airbrakes.data_handling.imu_data_packet import EstimatedDataPacket, RawDataPacket
from airbrakes.data_handling.logger import Logger
from constants import CSV_HEADERS
from tests.conftest import LOG_PATH


Expand Down
Loading