Skip to content

Commit

Permalink
Merge pull request #106 from UBC-Rocket/bnb-profile
Browse files Browse the repository at this point in the history
BNB Profile
  • Loading branch information
MarcoYuen17 authored Dec 8, 2023
2 parents 5c8c3b3 + 20a3f09 commit 7a695f7
Show file tree
Hide file tree
Showing 19 changed files with 455 additions and 410 deletions.
2 changes: 1 addition & 1 deletion connections/serial/serial_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def shutdown(self):
self.device.close()

def isIntBigEndian(self):
return True
return False

def isFloatBigEndian(self):
return False
8 changes: 4 additions & 4 deletions connections/sim/hw/hw_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ def analog_read(self, pin):
val = self._ignitor_reads[pin].read()
LOGGER.debug(f"Analog read from pin={pin} returned value={val}")

else:
voltage_sensor = self._sensors[SensorType.VOLTAGE]
if voltage_sensor is not None and pin == voltage_sensor.pin:
val = self._sensors[SensorType.VOLTAGE].read()
# else:
# voltage_sensor = self._sensors[SensorType.VOLTAGE]
# if voltage_sensor is not None and pin == voltage_sensor.pin:
# val = self._sensors[SensorType.VOLTAGE].read()

return val

Expand Down
2 changes: 1 addition & 1 deletion connections/sim/hw/sensors/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SensorType(Enum):

REQUIRED_SENSOR_FLOATS = {
SensorType.GPS: 3,
SensorType.IMU: 4,
SensorType.IMU: 7,
SensorType.ACCELEROMETER: 3,
SensorType.BAROMETER: 2,
SensorType.TEMPERATURE: 1,
Expand Down
4 changes: 2 additions & 2 deletions main_window/competition/comp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def mousePressEvent(QMouseEvent):
if label.map_fn is not None:
qt_text.mousePressEvent = gen_clicked_callback(label)

if label.name == "GPS":
if "GPS" in label.name:
self.selected_label = label

if self.selected_label is None:
Expand Down Expand Up @@ -259,7 +259,7 @@ def setup_view_menu(self) -> None:
dataplot_view_menu = view_menu.addMenu("Data Plot")

for label in self.label_windows:
if label.name != "GPS":
if "GPS" not in label.name:
data_label = QAction(f'{label.name}', self)
data_label.triggered.connect(
lambda i, label_name=label: self.open_plot_window(label_name))
Expand Down
8 changes: 4 additions & 4 deletions main_window/device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@


class DeviceType(Enum):
TANTALUS_STAGE_1_FLARE = auto()
TANTALUS_STAGE_2_FLARE = auto()
BNB_STAGE_1_FLARE = auto()
BNB_STAGE_2_FLARE = auto()
CO_PILOT_FLARE = auto()
HOLLYBURN_BODY_FLARE = auto()
HOLLYBURN_NOSE_FLARE = auto()
SILVERTIP_FLARE = auto()


_FLARE_DEVICE_TYPES = [
DeviceType.TANTALUS_STAGE_1_FLARE,
DeviceType.TANTALUS_STAGE_2_FLARE,
DeviceType.BNB_STAGE_1_FLARE,
DeviceType.BNB_STAGE_2_FLARE,
DeviceType.CO_PILOT_FLARE,
DeviceType.HOLLYBURN_BODY_FLARE,
DeviceType.HOLLYBURN_NOSE_FLARE,
Expand Down
4 changes: 2 additions & 2 deletions main_window/packet_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class SubpacketIds(Enum):


ID_TO_DEVICE_TYPE = {
0x00: DeviceType.TANTALUS_STAGE_1_FLARE,
0x01: DeviceType.TANTALUS_STAGE_2_FLARE,
0x00: DeviceType.BNB_STAGE_1_FLARE,
0x01: DeviceType.BNB_STAGE_2_FLARE,
0x02: DeviceType.CO_PILOT_FLARE,
0x03: DeviceType.HOLLYBURN_BODY_FLARE,
0x04: DeviceType.HOLLYBURN_NOSE_FLARE,
Expand Down
5 changes: 3 additions & 2 deletions profiles/mpl_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def receive_time_series(self, plot_widget: MplWidget, label: Label) -> None:

self.im = None

if label.name == "Acceleration" and not plot_widget.showing_checkboxes:
is_acceleration = "Acceleration" in label.name
if is_acceleration and not plot_widget.showing_checkboxes:
plot_widget.show_checkboxes()

# Plot data on graph
Expand All @@ -75,7 +76,7 @@ def receive_time_series(self, plot_widget: MplWidget, label: Label) -> None:
plot_widget.canvas.ax.cla()
data_entry_id = self.rocket_profile.label_to_data_id[label.name]

if label.name == "Acceleration":
if is_acceleration:
labels = ["X", "Y", "Z"]
colors = ["Red", "Blue", "Green"]
plot_data = False
Expand Down
4 changes: 2 additions & 2 deletions profiles/rocket_profile_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from .rocket_profile import RocketProfile

from .rockets.silvertip import SilvertipProfile
from .rockets.tantalus import TantalusProfile
from .rockets.bnb import BNBProfile
from .rockets.co_pilot import CoPilotProfile
from .rockets.hollyburn import HollyburnProfile
from .rockets.whistler_blackcomb import WbProfile

ROCKET_PROFILES: List[RocketProfile] = [
BNBProfile(),
SilvertipProfile(),
TantalusProfile(),
CoPilotProfile(),
HollyburnProfile(),
WbProfile(),
Expand Down
Loading

0 comments on commit 7a695f7

Please sign in to comment.