Skip to content
This repository was archived by the owner on Sep 21, 2025. It is now read-only.

Conversation

@tejas-srikanth
Copy link

No description provided.

Copy link
Contributor

@TongguangZhang TongguangZhang left a comment

Choose a reason for hiding this comment

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

Reviewed

# * device
# * verbose
predictions = ...
predictions = self.__model.predict(source=image, conf=0.7, show_conf=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look at the parameters of interest above - we want to set the source, conf, device, and verbose (but not the show_conf)

# Plot the annotated image from the Result object
# Include the confidence value
image_annotated = ...
image_annotated = prediction.orig_img
Copy link
Contributor

Choose a reason for hiding this comment

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

We're looking for the annotated image (with the confidence threshold), not the original image

Comment on lines 108 to -111
# Hint: .shape gets the dimensions of the numpy array
# for i in range(0, ...):
for i in range(0, boxes_cpu.shape[0]):
# Create BoundingBox object and append to list
# result, box = ...
Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove this commented out code since we're not using it (the if statement and result, box =) we can go back for it in the git history if we ever need it

result, box = bounding_box.BoundingBox.create(boxes_cpu[i])

if not result:
return ([], image_annotated)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove unnecessary brackets, return [], image annotated will work here

Comment on lines +41 to +45
self.commands = [
commands.Command.create_set_relative_destination_command( 4, 1),
commands.Command.create_set_relative_destination_command( 0.0, -2),
commands.Command.create_set_relative_destination_command(-4, 1),
]
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not hardcode the coordinates - use self.waypoint instead

# ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑
# ============

def getL2Norm(self, l1: location.Location, l2: location.Location) -> int:
Copy link
Contributor

Choose a reason for hiding this comment

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

technically this doesn't give us the L2 norm - it gives the square of the L2 norm, let's rename the function to be more descriptive (btw, we try to use snake_case instead of camelCase)

# ============

def getL2Norm(self, l1: location.Location, l2: location.Location) -> int:
return (l2.location_x - l1.location_x) * (l2.location_x - l1.location_x) + (l2.location_y - l1.location_y) * (l2.location_y - l1.location_y)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use ** 2 to make it explicit that we're squaring and not multiplying

elif report.status == drone_report.drone_status.DroneStatus.HALTED and not self.landed_at_waypoint:

self.landed_at_waypoint = True
min_landing_distance = 10000000
Copy link
Contributor

Choose a reason for hiding this comment

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

let's try to not use arbitrary values or magic numbers - set this to infinity instead with min_landing_distance = float('inf')


elif report.status == drone_report.drone_status.DroneStatus.HALTED and not self.landed_at_waypoint:

self.landed_at_waypoint = True
Copy link
Contributor

Choose a reason for hiding this comment

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

we're not actually landing at the waypoint here, just stopped, let's rename this to be more descriptive

Comment on lines +80 to +103
if report.status == drone_report.drone_status.DroneStatus.HALTED and self.command_index<len(self.commands):
command = self.commands[self.command_index]
self.command_index += 1

elif report.status == drone_report.drone_status.DroneStatus.HALTED and not self.landed_at_waypoint:

self.landed_at_waypoint = True
min_landing_distance = 10000000
for landing_pad in landing_pad_locations:
distance_to_lp = self.getL2Norm(landing_pad, report.position)
if distance_to_lp < min_landing_distance:
self.landing_pad_cache = landing_pad
min_landing_distance = distance_to_lp

location_delta_x = self.landing_pad_cache.location_x - report.position.location_x
location_delta_y = self.landing_pad_cache.location_y - report.position.location_y
self.commands.append(commands.Command.create_set_relative_destination_command(location_delta_x, location_delta_y))
command = self.commands[self.command_index]

self.command_index += 1

elif report.status == drone_report.drone_status.DroneStatus.HALTED and not self.has_sent_landing_command:
self.has_sent_landing_command = True
command = commands.Command.create_land_command()
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use the acceptance radius here too - we don't want to land if the drone is too far from the waypoint

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants