Skip to content

Commit 6265e47

Browse files
GustavoDCCIasonTheodorou
authored andcommitted
fix resolve semantic
1 parent 35b4009 commit 6265e47

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

robot_smach_states/src/robot_smach_states/human_interaction/human_interaction.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,19 +601,20 @@ def execute(self, userdata=None):
601601
return 'succeeded'
602602

603603
@smach.cb_interface(outcomes=["succeeded", "failed"])
604-
def process_answer(_, context: Union[ds.Designator, str], answer_des, output_des):
604+
def process_answer(_, context: Union[ds.Designator[str], str], answer_des, output_des):
605605
try:
606606
answer_val = answer_des.resolve()
607607
rospy.logdebug(f"{answer_val=}")
608-
name = answer_val.semantics[context]
609-
rospy.loginfo(f"Your answer is: '{name}'")
610-
output_des.write(name)
608+
semantic = answer_val.semantics[ds.value_or_resolve(context)]
609+
rospy.loginfo(f"Your answer is: '{semantic}'")
610+
output_des.write(semantic)
611611

612612
except KeyError as e:
613613
rospy.loginfo(f"KeyError resolving the name heard: {e}")
614614
return "failed"
615615
return "succeeded"
616616

617+
617618
class AskPersonNamePicoVoice(smach.StateMachine):
618619
"""
619620
Ask the person's name, and try to hear one of the given names

0 commit comments

Comments
 (0)