From 4720ff79f74bc420992ffe2cf910797cb00c4633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juliane=20R=C3=B6scheisen?= Date: Tue, 17 Oct 2023 08:25:44 +0200 Subject: [PATCH] fix stop check indentations --- .../src/marimbabot_behavior/behavior_node.py | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) 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