diff --git a/marimbabot_behavior/src/marimbabot_behavior/behavior_node.py b/marimbabot_behavior/src/marimbabot_behavior/behavior_node.py index 0c43174c..878e2bc8 100755 --- a/marimbabot_behavior/src/marimbabot_behavior/behavior_node.py +++ b/marimbabot_behavior/src/marimbabot_behavior/behavior_node.py @@ -319,22 +319,20 @@ def callback_command(self, command_msg): self.response_pub.publish('No notes recognized.') elif command_msg.behavior == "stop": - rospy.logdebug('Aborting play.') - # stop any running threads by setting the event - self.event.set() - - # check if the planning action server is currently active - if self.planning_client.simple_state == actionlib.SimpleGoalState.ACTIVE: - # cancel the goal of the planning action server - self.planning_client.cancel_goal() - - # check if the lilypond_audio action server is currently active - if self.lilypond_audio_client.simple_state == actionlib.SimpleGoalState.ACTIVE: - # cancel the goal of the lilypond_audio action server - self.lilypond_audio_client.cancel_goal() - - # send an empty message to the soundplay node to stop any audio preview (or TTS) - self.response_pub.publish('') + rospy.logdebug('Aborting play.') + # stop any running threads by setting the event + self.event.set() + # check if the planning action server is currently active + if self.planning_client.simple_state == actionlib.SimpleGoalState.ACTIVE: + # cancel the goal of the planning action server + self.planning_client.cancel_goal() + # check if the lilypond_audio action server is currently active + if self.lilypond_audio_client.simple_state == actionlib.SimpleGoalState.ACTIVE: + # cancel the goal of the lilypond_audio action server + self.lilypond_audio_client.cancel_goal() + + # send an empty message to the soundplay node to stop any audio preview (or TTS) + self.response_pub.publish('') else: # check if a note sequence has been read via the 'read' command