Skip to content

Commit

Permalink
Handle known guests
Browse files Browse the repository at this point in the history
  • Loading branch information
haiwei-luo committed Jul 3, 2024
1 parent 893efa5 commit 8ebf362
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions tasks/receptionist/src/receptionist/states/find_and_look_at.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ def __init__(
self.guest_id = guest_id
self.mask = mask

def _check_named_host(self, userdata):
for detection in userdata.matched_face_detections:
if detection.name == "host":
print("YESSSSSSSSSSSSSSSSSSSSSSSSSSS")
look_position = detection.point
look_position.z = 1.25
userdata.look_position = PointStamped(
point=look_position, header=Header(frame_id="map")
)
return True
return False

def execute(self, userdata):
if self.guest_id is not None:
for detection in userdata.matched_face_detections:
Expand All @@ -47,23 +59,27 @@ def execute(self, userdata):
point=look_position, header=Header(frame_id="map")
)
return "succeeded"
elif self.mask is not None:
for detection in userdata.matched_face_detections:
if detection.name not in self.mask:
look_position = detection.point
else:
named_guest = self._check_named_host(userdata)
if named_guest:
return "succeeded"
elif self.mask is not None:
for detection in userdata.matched_face_detections:
if detection.name not in self.mask:
look_position = detection.point
look_position.z = 1.25
userdata.look_position = PointStamped(
point=look_position, header=Header(frame_id="map")
)
return "succeeded"
else:
if len(userdata.matched_face_detections) > 0:
look_position = userdata.matched_face_detections[0].point
look_position.z = 1.25
userdata.look_position = PointStamped(
point=look_position, header=Header(frame_id="map")
point=look_position,
header=Header(frame_id="map"),
)
return "succeeded"
else:
if len(userdata.matched_face_detections) > 0:
look_position = userdata.matched_face_detections[0].point
look_position.z = 1.25
userdata.look_position = PointStamped(
point=look_position,
header=Header(frame_id="map"),
)
return "succeeded"
userdata.look_position = PointStamped()
return "failed"
Expand Down

0 comments on commit 8ebf362

Please sign in to comment.