Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't cancel loop sounds via action #245

Open
bsmiron opened this issue Dec 19, 2023 · 0 comments
Open

Can't cancel loop sounds via action #245

bsmiron opened this issue Dec 19, 2023 · 0 comments

Comments

@bsmiron
Copy link

bsmiron commented Dec 19, 2023

Hi! I'm encountering an issue when using the following ROS2 to cancel a loop sound.

    ros2 action send_goal /sound_play sound_play/action/SoundRequest "{sound_request: {sound: 1, command: 2, volume: 0.8}}"

Although the sound plays successfully, I'm receiving an error from the ActionServer:

    [ERROR] [1703000144.370809778] [sound_play]: Exception in actionlib callback: local variable 'feedback' referenced before assignment
    [INFO] [1703000144.371072712] [sound_play]: Traceback (most recent call last):
      File "/home/bsmiron/workspace/sweep/install/sound_play/lib/sound_play/soundplay_node.py", line 563, in execute_cb
        result.playing = feedback.playing
    UnboundLocalError: local variable 'feedback' referenced before assignment

The message from the action is as follows:

    Waiting for an action server to become available...
    Sending goal:
         sound_request:
      sound: 1
      command: 2
      volume: 0.8
      arg: ''
      arg2: ''
    
    Goal accepted with ID: d715b2455f1a428b99c52cada1833774
    
    Result:
        playing: false
    stamp:
      sec: 0
      nanosec: 0
    
    Goal finished with status: ABORTED

Additionally, I'm encountering a similar issue when attempting to stop the sound using the command:

    ros2 action send_goal /sound_play sound_play/action/SoundRequest "{sound_request: {sound: 1, command: 0, volume: 0.8}}"

The error from the ActionServer is the same:

    [ERROR] [1703000315.212196142] [sound_play]: Exception in actionlib callback: local variable 'feedback' referenced before assignment
    [INFO] [1703000315.212440367] [sound_play]: Traceback (most recent call last):
      File "/home/bsmiron/workspace/sweep/install/sound_play/lib/sound_play/soundplay_node.py", line 563, in execute_cb
        result.playing = feedback.playing
    UnboundLocalError: local variable 'feedback' referenced before assignment

And the message from the action is:

    Waiting for an action server to become available...
    Sending goal:
         sound_request:
      sound: 1
      command: 0
      volume: 0.8
      arg: ''
      arg2: ''
    
    Goal accepted with ID: 4565d64e98114219a0305f1cabab98bf
    
    Result:
        playing: false
    stamp:
      sec: 0
      nanosec: 0

  Goal finished with status: ABORTED

Steps to Reproduce:

Start the action server:

      ros2 run sound_play soundplay_node.py 

New terminal run the ros2 actions:

    ros2 action send_goal /sound_play sound_play/action/SoundRequest "{sound_request: {sound: 1, command: 2, volume: 0.8}}
    ros2 action send_goal /sound_play sound_play/action/SoundRequest "{sound_request: {sound: 1, command: 0, volume: 0.8}}"

Expected Behavior:
Should manage to cancel the loop via actions using command: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant