forked from LASR-at-Home/Base
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Benteng Ma
authored and
tiago
committed
Feb 5, 2024
1 parent
7827dc2
commit 134c870
Showing
5 changed files
with
35 additions
and
6 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
22 changes: 22 additions & 0 deletions
22
tasks/receptionist/src/receptionist/states/speakdescriptions.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,22 @@ | ||
import smach | ||
import rospy | ||
|
||
|
||
class SpeakDescriptions(smach.State): | ||
def __init__(self, default): | ||
smach.State.__init__(self, outcomes=['succeeded','failed'], input_keys=['people']) | ||
self.default = default | ||
|
||
def execute(self, userdata): | ||
for person in userdata['people']: | ||
self.default.voice.speak('I see a person') | ||
|
||
for feature in person['features']: | ||
if feature.label: | ||
if len(feature.colours) == 0: | ||
self.default.voice.speak(f'They have {feature.name}.') | ||
continue | ||
|
||
self.default.voice.speak(f'They have {feature.name} and it has the colour {feature.colours[0]}') | ||
|
||
return 'succeeded' |