Skip to content

Commit

Permalink
prepared for reo2016 rules, no turn and repitition question. Also str…
Browse files Browse the repository at this point in the history
…aight head for omnidir mic
  • Loading branch information
reinzor committed Mar 30, 2016
1 parent 100493f commit c4fbfe3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
8 changes: 3 additions & 5 deletions challenge_speech_recognition/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Challenge Speech Recognition

ahardware
amiddle-restaurant
ahardware / shardware
amiddle / smiddle

## Speech recognition
rosrun challenge_speech_recognition speech_recognition.py [robot]
## Generate test sentences
rosrun challenge_speech_recognition generate_random_question.py
rosrun challenge_speech_recognition speech_recognition.py [robot]
4 changes: 2 additions & 2 deletions challenge_speech_recognition/src/direct_speech_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
data = load_knowledge('challenge_speech_recognition')

class HearQuestion(smach.State):
def __init__(self, robot, time_out=rospy.Duration(10)):
def __init__(self, robot, time_out=rospy.Duration(15)):
smach.State.__init__(self, outcomes=["answered"])
self.robot = robot
self.time_out = time_out

def execute(self, userdata):
self.robot.head.look_at_standing_person()
self.robot.head.look_at_ground_in_front_of_robot(100)

res = self.robot.ears.recognize(spec=data.spec, choices=data.choices, time_out=self.time_out)

Expand Down
16 changes: 8 additions & 8 deletions challenge_speech_recognition/src/indirect_speech_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
data = load_knowledge('challenge_speech_recognition')

class HearQuestion(smach.State):
def __init__(self, robot, time_out=rospy.Duration(10)):
smach.State.__init__(self, outcomes=["answered","not_answered"])
def __init__(self, robot, time_out=rospy.Duration(15)):
smach.State.__init__(self, outcomes=["answered", "not_answered"])
self.robot = robot
self.time_out = time_out

def execute(self, userdata):
self.robot.head.look_at_standing_person()
self.robot.head.look_at_ground_in_front_of_robot(100)

res = self.robot.ears.recognize(spec=data.spec, choices=data.choices, time_out=self.time_out)

Expand Down Expand Up @@ -94,31 +94,31 @@ def setup_statemachine(robot):
"abort" : "Aborted"})

smach.StateMachine.add('SAY_1', states.Say(robot, "Please ask me question one"), transitions={ 'spoken' :'QUESTION_1'})
smach.StateMachine.add('QUESTION_1', HearQuestion(robot), transitions={ 'answered' :'SAY_2', 'not_answered': 'TURN_1'})
smach.StateMachine.add('QUESTION_1', HearQuestion(robot), transitions={ 'answered' :'SAY_2', 'not_answered': 'SAY_2'})
smach.StateMachine.add('TURN_1', Turn(robot), transitions={ 'turned' :'SAY_1A'})
smach.StateMachine.add('SAY_1A', states.Say(robot, "Please repeat your question"), transitions={ 'spoken' :'QUESTION_1A'})
smach.StateMachine.add('QUESTION_1A', HearQuestion(robot), transitions={ 'answered' :'SAY_2', 'not_answered': 'SAY_2'})

smach.StateMachine.add('SAY_2', states.Say(robot, "Please ask me question two"), transitions={ 'spoken' :'QUESTION_2'})
smach.StateMachine.add('QUESTION_2', HearQuestion(robot), transitions={ 'answered' :'SAY_3', 'not_answered': 'TURN_2'})
smach.StateMachine.add('QUESTION_2', HearQuestion(robot), transitions={ 'answered' :'SAY_3', 'not_answered': 'SAY_3'})
smach.StateMachine.add('TURN_2', Turn(robot), transitions={ 'turned' :'SAY_2A'})
smach.StateMachine.add('SAY_2A', states.Say(robot, "Please repeat your question"), transitions={ 'spoken' :'QUESTION_2A'})
smach.StateMachine.add('QUESTION_2A', HearQuestion(robot), transitions={ 'answered' :'SAY_3', 'not_answered': 'SAY_3'})

smach.StateMachine.add('SAY_3', states.Say(robot, "Please ask me question three"), transitions={ 'spoken' :'QUESTION_3'})
smach.StateMachine.add('QUESTION_3', HearQuestion(robot), transitions={ 'answered' :'SAY_4', 'not_answered': 'TURN_3'})
smach.StateMachine.add('QUESTION_3', HearQuestion(robot), transitions={ 'answered' :'SAY_4', 'not_answered': 'SAY_4'})
smach.StateMachine.add('TURN_3', Turn(robot), transitions={ 'turned' :'SAY_3A'})
smach.StateMachine.add('SAY_3A', states.Say(robot, "Please repeat your question"), transitions={ 'spoken' :'QUESTION_3A'})
smach.StateMachine.add('QUESTION_3A', HearQuestion(robot), transitions={ 'answered' :'SAY_4', 'not_answered': 'SAY_4'})

smach.StateMachine.add('SAY_4', states.Say(robot, "Please ask me question four"), transitions={ 'spoken' :'QUESTION_4'})
smach.StateMachine.add('QUESTION_4', HearQuestion(robot), transitions={ 'answered' :'SAY_5', 'not_answered': 'TURN_4'})
smach.StateMachine.add('QUESTION_4', HearQuestion(robot), transitions={ 'answered' :'SAY_5', 'not_answered': 'SAY_5'})
smach.StateMachine.add('TURN_4', Turn(robot), transitions={ 'turned' :'SAY_4A'})
smach.StateMachine.add('SAY_4A', states.Say(robot, "Please repeat your question"), transitions={ 'spoken' :'QUESTION_4A'})
smach.StateMachine.add('QUESTION_4A', HearQuestion(robot), transitions={ 'answered' :'SAY_5', 'not_answered': 'SAY_5'})

smach.StateMachine.add('SAY_5', states.Say(robot, "Please ask me question five"), transitions={ 'spoken' :'QUESTION_5'})
smach.StateMachine.add('QUESTION_5', HearQuestion(robot), transitions={ 'answered' :'AT_END', 'not_answered': 'TURN_5'})
smach.StateMachine.add('QUESTION_5', HearQuestion(robot), transitions={ 'answered' :'AT_END', 'not_answered': 'AT_END'})
smach.StateMachine.add('TURN_5', Turn(robot), transitions={ 'turned' :'SAY_5A'})
smach.StateMachine.add('SAY_5A', states.Say(robot, "Please repeat your question"), transitions={ 'spoken' :'QUESTION_5A'})
smach.StateMachine.add('QUESTION_5A', HearQuestion(robot), transitions={ 'answered' :'AT_END', 'not_answered': 'AT_END'})
Expand Down

0 comments on commit c4fbfe3

Please sign in to comment.