-
Notifications
You must be signed in to change notification settings - Fork 235
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
Bootcamp Submission - Emily Qi #135
Conversation
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.
reviewed
if result: | ||
bounding_boxes.append(box) |
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.
instead of skipping failed boxes, we want to return no boxes if any of then fail. This is because in data science, when we have corrupted data, we skip the whole data point instead of partial data - in this case, the image is the data point and the boxes are parts of the data
def distance_between_locations(self, other_location: location.Location) -> float: | ||
""" | ||
Calculate the squared distance between two Location 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.
since this is the distance squared, name it accordingly
distance_from_waypoint <= self.acceptance_radius**2 | ||
and not self.has_sent_landing_command | ||
): | ||
smallest_distance = 999999999 |
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.
it's generally bad practice to use just a very large number like this - try looking for how to represent infinity in python
smallest_distance_x = 0 | ||
smallest_distance_y = 0 |
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.
consider storing the waypoint object instead of the x and y, this also makes is so you don't need to check ready_to_land
to avoid landing the drone and (0, 0)
and not self.has_sent_landing_command | ||
): | ||
|
||
if distance_from_waypoint <= self.acceptance_radius**2: |
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 generally say that an acceptance radius is strictly <, not <=
command = commands.Command.create_land_command() | ||
self.has_sent_landing_command = True | ||
|
||
elif distance_from_waypoint > self.acceptance_radius**2: |
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.
do you need the elif or can it just be an else?
command = commands.Command.create_land_command() | ||
self.has_sent_landing_command = True | ||
|
||
elif ( |
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 generally say that an acceptance radius is strictly <, not <=
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.
reviewed
distance_from_waypoint = ( | ||
self.waypoint.location_x - report.position.location_x | ||
) ** 2 + (self.waypoint.location_y - report.position.location_y) ** 2 |
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.
consider using your defined function with report.position as the input
|
||
elif distance_from_waypoint < self.acceptance_radius**2: | ||
smallest_distance = float("inf") | ||
smallest_distance_pad = 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.
make sure you handle the case where the landing pad is none below - in this case you would return the default command
(smallest_distance_pad.location_y - self.waypoint.location_y), | ||
) | ||
if smallest_distance_pad is None: | ||
command = commands.Command.create_null_command() |
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'd prefer just returning (early exit is generally better than nested if statements
No description provided.