-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5f9590
commit 40cbed2
Showing
13 changed files
with
291 additions
and
228 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .point import * | ||
from .imu_connection_status import * | ||
from .imu_calibration_status import * |
36 changes: 36 additions & 0 deletions
36
examples/imu_experiment/src/util/imu_calibration_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from enum import Enum | ||
from random import randint | ||
|
||
|
||
class ImuCalibrationStatus(Enum): | ||
UNKNOWN = 0 | ||
UNRELIABLE = 1 | ||
ACCURACY_LOW = 2 | ||
ACCURACY_MEDIUM = 3 | ||
ACCURACY_HIGH = 4 | ||
|
||
@staticmethod | ||
def get_random_status(): | ||
random_status = randint(0, 4) | ||
if random_status == 0: | ||
return ImuCalibrationStatus.UNKNOWN | ||
elif random_status == 1: | ||
return ImuCalibrationStatus.UNRELIABLE | ||
elif random_status == 2: | ||
return ImuCalibrationStatus.ACCURACY_LOW | ||
elif random_status == 3: | ||
return ImuCalibrationStatus.ACCURACY_MEDIUM | ||
elif random_status == 4: | ||
return ImuCalibrationStatus.ACCURACY_HIGH | ||
|
||
def to_string(self): | ||
if self == ImuCalibrationStatus.UNKNOWN: | ||
return "UNKNOWN" | ||
elif self == ImuCalibrationStatus.UNRELIABLE: | ||
return "UNRELIABLE" | ||
elif self == ImuCalibrationStatus.ACCURACY_LOW: | ||
return "ACCURACY_LOW" | ||
elif self == ImuCalibrationStatus.ACCURACY_MEDIUM: | ||
return "ACCURACY_MEDIUM" | ||
elif self == ImuCalibrationStatus.ACCURACY_HIGH: | ||
return "ACCURACY_HIGH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from enum import Enum | ||
from random import randint | ||
|
||
|
||
class ImuConnectionStatus(Enum): | ||
DISCONNECTED = 0 | ||
CONNECTING = 1 | ||
CONNECTED = 2 | ||
|
||
def get_color(self): | ||
if self == ImuConnectionStatus.DISCONNECTED: | ||
return "#FF0000" | ||
elif self == ImuConnectionStatus.CONNECTING: | ||
return "#FFFF00" | ||
elif self == ImuConnectionStatus.CONNECTED: | ||
return "#00FF00" | ||
|
||
@staticmethod | ||
def get_random_status(): | ||
random_status = randint(0, 2) | ||
if random_status == 0: | ||
return ImuConnectionStatus.DISCONNECTED | ||
elif random_status == 1: | ||
return ImuConnectionStatus.CONNECTING | ||
elif random_status == 2: | ||
return ImuConnectionStatus.CONNECTED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Point: | ||
x: float = 0.0 | ||
y: float = 0.0 | ||
|
||
def scale(self, scaling_factor: float): | ||
return Point(self.x * scaling_factor, self.y * scaling_factor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .imu_calibration_widget import * | ||
from .imu_connection_widget import * | ||
from .imu_plot_widget import * | ||
from .setup_task_widget import * |
37 changes: 37 additions & 0 deletions
37
examples/imu_experiment/src/widgets/imu_calibration_widget.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from PyQt6.QtWidgets import QWidget | ||
from PyQt6.QtWidgets import QGridLayout | ||
from PyQt6.QtWidgets import QLabel | ||
from PyQt6.QtCore import QSize | ||
|
||
from examples.imu_experiment.src.util import ImuCalibrationStatus | ||
|
||
imu_selector_labels = [ | ||
"IMU 1 (Left Wrist)", | ||
"IMU 2 (Left Elbow)", | ||
"IMU 3 (Left Shoulder)", | ||
"IMU 4 (Trunk)", | ||
"IMU 5 (Right Shoulder)", | ||
"IMU 6 (Right Elbow)", | ||
"IMU 7 (Right Wrist)", | ||
] | ||
|
||
|
||
class ImuCalibrationWidget(QWidget): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
layout = QGridLayout() # Y Rows, X Columns | ||
|
||
for i, imu in enumerate(imu_selector_labels): | ||
self._title_label = QLabel(imu) | ||
layout.addWidget(self._title_label, i, 0) | ||
|
||
self._calibration_label = QLabel( | ||
str(ImuCalibrationStatus.get_random_status().to_string()) | ||
) # lots of things | ||
layout.addWidget(self._calibration_label, i, 2) | ||
|
||
self.setLayout(layout) | ||
|
||
def sizeHint(self): | ||
return QSize(40, 120) |
Oops, something went wrong.