Skip to content

Commit

Permalink
set feedback first
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Dec 26, 2024
1 parent 06c280a commit 90cce26
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sound_play/scripts/soundplay_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,17 @@ def execute_cb(self, goal_handle):
success = True
while sound.get_playing():
sound.update()
feedback = SoundRequestAction.Feedback()
feedback.playing = sound.get_playing()
feedback.stamp = (
self.get_clock().now() - start_time).to_msg()
goal_handle.publish_feedback(feedback)
if not goal_handle.is_active:
self.get_logger().info(
'sound_play action: Preempted')
sound.stop()
success = False
break
feedback = SoundRequestAction.Feedback()
feedback.playing = sound.get_playing()
feedback.stamp = (
self.get_clock().now() - start_time).to_msg()
goal_handle.publish_feedback(feedback)
self.sleep(1.0 / self.loop_rate)
if success:
result.playing = feedback.playing
Expand Down

0 comments on commit 90cce26

Please sign in to comment.