Skip to content

Commit

Permalink
Increased radius of revolution, and commented out the await for class…
Browse files Browse the repository at this point in the history
…ifier since we will need to set which props are which for now
  • Loading branch information
DaniParr committed Sep 28, 2024
1 parent 3635339 commit e115b92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ def object_classified(objects, obj_id):
return i
return -1

def movement_finished(self, task):
if not task.cancelled():
print("THE MOVEMENT HAS FINISHED")
self.current_move_task_state = MoveState.FINISHED

# Explore until we find one of the animals we have not seen before
async def explore_closest_until(self, is_done, filter_and_sort)->dict:
"""
Expand Down Expand Up @@ -133,16 +138,15 @@ async def explore_closest_until(self, is_done, filter_and_sort)->dict:
[rosmsg_to_numpy(obj.pose.position) for obj in objects],
)
indices = [] if len(objects) == 0 else filter_and_sort(objects, positions)
print(f"\n\nINDICES: {indices}\n\n")
if indices is None or len(indices) == 0:
self.send_feedback("No objects")
continue
objects = [objects[i] for i in indices]
positions = positions[indices]

# Exit if done
self.send_feedback(f"Analyzing objects: {objects}")
ret = is_done(objects, positions)
self.send_feedback(f"Analyzing objects: {ret}")
if ret is not None:
if move_id_tuple is not None:
self.send_feedback("Condition met. Canceling investigation")
Expand Down Expand Up @@ -192,7 +196,7 @@ async def circle_animals(self, animals):
label = object.labeled_classification

# Go to point and Circle animal
await self.move.d_spiral_point(position, 5, 4, 1,
await self.move.d_spiral_point(position, 10, 4, 1,
"cw"
if label == "green_iguana_buoy" or label == "red_python_buoy"
else
Expand All @@ -207,13 +211,13 @@ def get_indices_of_most_confident_animals(self, objects, classifications=["red_p
"""Pass in sorted list of objects by distance from boat and extract the first instance of classifications"""
animals_dict = {classif:-1 for classif in classifications}
for i, obj in enumerate(objects):
print(obj)
if obj.labeled_classification in classifications and animals_dict[obj.labeled_classification] == -1:
animals_dict[obj.labeled_classification] = i
return animals_dict

async def find_wildlife(self):
robot_position = (await self.tx_pose())[0]
self.send_feedback("FINDING WILDLIFE")

def filter_and_sort(objects, positions):
distances = np.linalg.norm(positions - robot_position, axis=1)
Expand Down Expand Up @@ -264,7 +268,7 @@ async def run(self, args):
self.objects_passed = set()
await self.change_wrench("autonomous")
# Wait a bit for PCDAR to get setup
await self.set_classifier_enabled.wait_for_service()
await self.set_classifier_enabled(SetBoolRequest(data=True))
# await self.set_classifier_enabled.wait_for_service()
# await self.set_classifier_enabled(SetBoolRequest(data=True))
await self.nh.sleep(3.0)
await self.find_wildlife()
2 changes: 1 addition & 1 deletion mil_common/axros
2 changes: 0 additions & 2 deletions ptk.txt

This file was deleted.

0 comments on commit e115b92

Please sign in to comment.