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

<3 #127

Closed
wants to merge 17 commits into from
Closed

<3 #127

wants to merge 17 commits into from

Conversation

tqmsh
Copy link

@tqmsh tqmsh commented Nov 22, 2024

No description provided.


elif report.status == drone_status.DroneStatus.HALTED and not self.landing and self.ready:
command = commands.Command.create_land_command()
self.landing = 1

Choose a reason for hiding this comment

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

self.landing never used

Copy link
Author

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

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

Copy link
Author

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

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

Copy link
Author

Choose a reason for hiding this comment

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

Solved

Comment on lines 46 to 64
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

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

Copy link
Author

Choose a reason for hiding this comment

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

Solved

Comment on lines 92 to 98
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:

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.

Copy link
Author

Choose a reason for hiding this comment

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

Solved

Comment on lines 113 to 115
if report.status == drone_status.DroneStatus.HALTED and not self.landing and at_pad:
command = commands.Command.create_land_command()
self.landing = True

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

Copy link
Author

Choose a reason for hiding this comment

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

Unsure

Comment on lines +126 to +127
if res is True:
boxes.append(box)

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

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good

Comment on lines +108 to +110
if not self.landing and at_pad:
command = commands.Command.create_land_command()
self.landing = True

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

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