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

Lidar processing #48

Closed
wants to merge 3 commits into from
Closed

Lidar processing #48

wants to merge 3 commits into from

Conversation

Mmoyv27
Copy link
Contributor

@Mmoyv27 Mmoyv27 commented Oct 17, 2024

Fixed Linting, Creating custom data structures to store lidar oscillations

"""


class LidarReading:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a data structure for lidar detections so use that instead. it's called LidarDetection


class LidarOscillation:
"""
Class to represent a collection of LiDAR readings that make up an oscillation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how many degrees are there in one oscillation?

@classmethod
def create(cls, readings: list[LidarReading]) -> "tuple[bool, LidarOscillation | None]":
"""
Create a new LidarOscillation object from a list of LidarReading objects.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create this from a list[LidarDetection]

Create a new LidarOscillation object from a list of LidarReading objects.
"""
# Ensuring the list only contains LidarReading instances
if not all(isinstance(reading, LidarReading) for reading in readings):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to check that they are the correct type. just check that the object is not None.


return True, LidarOscillation(cls.__create_key, readings)

def __init__(self, class_private_create_key: object, readings: list) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type annotation for readings is incorrect

"""
assert class_private_create_key is LidarOscillation.__create_key, "Use the create() method"

# Store the list of LidarReading objects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is not needed

"""
reading_strs = [
str(reading) for reading in self.readings
] # Create a list of reading strings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with this comment

reading_strs = [
str(reading) for reading in self.readings
] # Create a list of reading strings
return f"LidarOscillation with {len(self.readings)} readings:\n" + "\n".join(reading_strs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reformat to keep strings on one line. you can leave spaces or commas in between readings instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a period and a space at the end as well

…rDetection objects, adjusted _str_ to print on one line and include all relevant details
@Mmoyv27 Mmoyv27 closed this Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants