Skip to content

Commit

Permalink
Updated wildlife mission logic
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniParr committed Nov 8, 2024
1 parent 8ca9a24 commit 1fa8c65
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
5 changes: 1 addition & 4 deletions NaviGator/gnc/navigator_thrust_mapper/nodes/thrust_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ def publish_thrusts(self) -> None:
rospy.logfatal("Number of thrusts does not equal number of publishers")
return
for i, pub in enumerate(self.publishers):
if pub.name == "/BL_motor/cmd":
commands[i].setpoint = thrusts[i] * 0.85
else:
commands[i].setpoint = thrusts[i]
commands[i].setpoint = thrusts[i]
if not self.is_vrx and not self.is_sim:
for i in range(len(self.publishers)):
self.joint_state_msg.effort[i] = commands[i].setpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from .navigator import NaviGatorMission

CIRCLE_ANIMAL = "red_python_buoy"


class MoveState(Enum):
NOT_STARTED = 1
Expand Down Expand Up @@ -189,32 +191,31 @@ async def explore_closest_until(self, is_done, filter_and_sort) -> dict:
move_id_tuple = (move, objects[potential_candidate].id)
print("USING POTENTIAL CANDIDATE")

async def circle_animals(self, animals):
for animal in animals:
object = animal[0]
position = animal[1]
label = object.labeled_classification

# Go to point and Circle animal
await self.move.d_spiral_point(
position,
6,
4,
1,
(
"cw"
if label == "green_iguana_buoy" or label == "red_python_buoy"
else "ccw"
),
theta_offset=(
1.57
if label == "green_iguana_buoy" or label == "red_python_buoy"
else -1.57
),
)
async def circle_animal(self, animal):
object = animal[0]
position = animal[1]
label = object.labeled_classification

# Go to point and Circle animal
await self.move.d_spiral_point(
position,
6,
4,
1,
(
"ccw"
if label == "green_iguana_buoy" or label == "red_python_buoy"
else "cw"
),
theta_offset=(
-1.57
if label == "green_iguana_buoy" or label == "red_python_buoy"
else 1.57
),
)

# Update explore dict
self.animals_observed[label] = True
# Update explore dict
self.animals_observed[label] = True

def get_indices_of_most_confident_animals(
self,
Expand Down Expand Up @@ -263,7 +264,16 @@ def is_done(objects, positions):
)

# Go to each object and circle them accordingly
await self.circle_animals(animals)
for animal in animals:
object = animal[0]
# position = animal[1]
label = object.labeled_classification
if label == CIRCLE_ANIMAL:
print(f"CIRCLING ANIMAL {CIRCLE_ANIMAL}")
await self.circle_animal(animal)
if label == "red_python_buoy":
await self.circle_animal(animal)
self.animals_observed[label] = True

# # Check if all wildlife has been circled
# IF not all wildlife has been found call this function again
Expand Down
2 changes: 1 addition & 1 deletion mil_common/axros

0 comments on commit 1fa8c65

Please sign in to comment.