-
Notifications
You must be signed in to change notification settings - Fork 0
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
Lidar processing #49
Lidar processing #49
Conversation
…rDetection objects, adjusted _str_ to print on one line and include all relevant details
modules/lidar_oscillation.py
Outdated
Representing a LiDAR Oscillation | ||
""" | ||
|
||
from lidar_detection import LidarDetection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import the module instead of the class - so instead use from . import lidar_detection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just to maintain consistency as well as to avoid confusion because some data structure files contain multiple classes so it is easier to trace back where each object is from this way.
modules/lidar_oscillation.py
Outdated
__create_key = object() | ||
|
||
@classmethod | ||
def create(cls, readings: list[LidarDetection]) -> "tuple[bool, LidarOscillation | None]": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we changed the import this would now be lidar_detection.LidarDetection
modules/lidar_oscillation.py
Outdated
Create a new LidarOscillation object from a list of LidarReading objects. | ||
""" | ||
# Ensuring the list does not contain None values | ||
if any(reading is None for reading in readings): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can assume that every reading inside readings is valid so no need to check here. validation will be done in the lidar parser, not here in the data structure creation itself
modules/lidar_oscillation.py
Outdated
assert class_private_create_key is LidarOscillation.__create_key, "Use the create() method" | ||
|
||
self.readings = readings | ||
valid_angles = [reading.angle for reading in readings if reading is not None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed for reason above
modules/lidar_oscillation.py
Outdated
""" | ||
Create a new LidarOscillation object from a list of LidarReading objects. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if list is empty
modules/lidar_oscillation.py
Outdated
self.readings = readings | ||
angles = [reading.angle for reading in readings] | ||
|
||
if angles: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we checked list is empty, we can assume there are valid angle readings so we can remove this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
made review changes, adjusted for linting