qrb_ros_audio_service sample application is a ROS package that delivers core audio functionalities, serving as the primary interface for audio capabilities (currently supporting playback and recording) within the ROS ecosystem.
NoteFor more information, see the qrb_ros_audio_service GitHub repo.
Pipeline for qrb_ros_audio_service
The following figure shows the pipeline.
Figure : qrb_ros_audio_service pipeline
ROS nodes/services used in the qrb_ros_audio_service pipeline
ROS topics used in the qrb_ros_audio_service pipeline
Prerequisites
You have Set up the device according to Set up the environment for running sample applications.Run out-of-the-box qrb_ros_audio_service
- Start three commandline terminals on your device and run the following commands to set up the environment.
- In the first SSH terminal, run the audio service package using the
ros2 launchcommand. - In the second SSH terminal, run
qrb_ros_audio_common. - Check the default devices for the pipewire.
- Verify the status of default speaker and handset mic.
- If the default speaker or handset mic isn’t set, use
wpctl set-default <device-num>to set the default device(s).
- Verify the status of default speaker and handset mic.
- In the third SSH terminal, run the test cases using either ROS commands or Python scripts according to the following table.
- Note For all step-by-step test cases,
stream_handleindicates the stream created by the audio service when the command iscreate. After the audio service creates a stream, the command prints the value ofstream_handlein the third SSH terminal.- For the ROS command, you see the following output:
stream_handle=<***> - For the Python script, you see the following output:
command create success 1 stream_handle <***>.Download the Python script using
- For the ROS command, you see the following output:
- Note For all step-by-step test cases,
| Case name | Description | ROS command/Python script |
|---|---|---|
| One-touch playback | Start playback with a one-touch command. The speaker outputs the audio. Supports the WAV file format. Place the music file on a device path, for example, /tmp/music.wav. |
|
| Step-by-step playback | Start playback with step-by-step commands. The speaker outputs the audio. Supports the WAV file format. |
|
| Streaming playback | Create and start a streaming playback. It subscribes to the audio PCM data from the loopback topic. Audio data should be filled with qrb_ros_audio_common_msgs::msg::AudioData. |
Start a step-by-step streaming playback: |
| Step-by-step record | Use the default input device to record with step-by-step commands and write the audio data to the /tmp/rec.wav file. |
|
| Publish recording data |
|
Publish the recording data to a topic (default topic name is “ qrb_audiodata”, but it can be specified using topic_name):/qrb_audiodata. Meanwhile, save it to a file: |

