-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
280 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tasks/receptionist/src/receptionist/states/recognise_people.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python3 | ||
import smach | ||
import rospy | ||
from lasr_vision_msgs.srv import Recognise, RecogniseRequest | ||
|
||
|
||
class RecognisePeople(smach.State): | ||
def __init__( | ||
self, | ||
dataset: str, | ||
confidence: float = 0.5, | ||
): | ||
smach.State.__init__( | ||
self, | ||
outcomes=["succeeded", "failed"], | ||
output_keys=["named_detections"], | ||
input_keys=["people_detections"], | ||
) | ||
self._dataset = dataset | ||
self._confidence = confidence | ||
self._recognise = rospy.ServiceProxy("/recognise", Recognise) | ||
|
||
def execute(self, userdata): | ||
try: | ||
named_detections = [] | ||
for person_detection in userdata.people_detections: | ||
img_msg = person_detection[1] | ||
result = self._recognise(img_msg, self._dataset, self._confidence) | ||
named_detections.append( | ||
[person_detection[0], result.detections[0].name] | ||
) | ||
userdata.named_detections = named_detections | ||
except rospy.ServiceException as e: | ||
rospy.logwarn(f"Unable to perform inference. ({str(e)})") | ||
return "failed" | ||
return "succeeded" |
Oops, something went wrong.