-
Notifications
You must be signed in to change notification settings - Fork 248
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
<3 #127
<3 #127
Conversation
|
||
elif report.status == drone_status.DroneStatus.HALTED and not self.landing and self.ready: | ||
command = commands.Command.create_land_command() | ||
self.landing = 1 |
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.
self.landing never used
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.
Solved
if (self.waypoint.location_x - report.position.location_x) <= self.acceptance_radius and ( | ||
self.waypoint.location_y - report.position.location_y | ||
) <= self.acceptance_radius: | ||
self.ready = 1 |
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.
using a bool or enum is better
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.
Solved
destination.location_y - position.location_y | ||
) <= self.acceptance_radius: | ||
return True | ||
return 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.
use false instead of 0 for bools
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.
Solved
def get_dist(self, pad: location.Location) -> float: | ||
""" | ||
Calculate distance between waypoint and a landing pad | ||
""" | ||
return (pad.location_x - self.waypoint.location_x) ** 2 + ( | ||
pad.location_y - self.waypoint.location_y | ||
) ** 2 | ||
|
||
def reached_destination( | ||
self, destination: location.Location, position: location.Location | ||
) -> bool: | ||
""" | ||
Check if drone is within acceptance radius of target destination | ||
""" | ||
if (destination.location_x - position.location_x) <= self.acceptance_radius and ( | ||
destination.location_y - position.location_y | ||
) <= self.acceptance_radius: | ||
return True | ||
return 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.
side note that sometimes it maybe worth while to make these helper functions static
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.
Solved
if self.reaching: | ||
reached = self.reached_destination(self.waypoint, report.position) | ||
if report.status == drone_status.DroneStatus.HALTED and not reached: | ||
command = commands.Command.create_set_relative_destination_command( | ||
self.waypoint.location_x, self.waypoint.location_y | ||
) | ||
elif report.status == drone_status.DroneStatus.HALTED and reached: |
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.
I would probably move halted to top level since it is apart of all nested conditions, and use elif on the current else.
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.
Solved
if report.status == drone_status.DroneStatus.HALTED and not self.landing and at_pad: | ||
command = commands.Command.create_land_command() | ||
self.landing = True |
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.
what if at pad is false
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.
Unsure
if res is True: | ||
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.
note that it is generally a common convention is to disregard all results if any of the bounding boxes error out (indicating code/model produced garbage output). tho you don't have to it here
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.
Sounds good
if not self.landing and at_pad: | ||
command = commands.Command.create_land_command() | ||
self.landing = True |
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.
just need an else statement to send the drone to the landing pad again
No description provided.