QRB ROS Audio Common
Overview
qrb_ros_audio_common is a package to provide two ros action for playback and capture.
Provide two ROS node for playback and capture. Two node support set audio parameter(volume, channels, sample_format, rate, repeat) to specify stream format. Provide interface(ros2 communication) to Transfer audio data between ROS node. For Playback, can receive PCM data or file path from other ROS node, then playback to Speaker For Capture, can get PCM data from Mic, then send PCM data to other ROS node or save to file
Build
Currently, we only support use QCLINUX to build
Setup environments follow this document ‘s Set up the cross-compile environment.
Create
ros_ws
directory in<qirp_decompressed_workspace>/qirp-sdk/
Clone this repository under
<qirp_decompressed_workspace>/qirp-sdk/ros_ws
git clone https://github.com/quic-qrb-ros/qrb_ros_audio_common.git
git clone https://github.com/quic-qrb-ros/qrb_ros_interfaces.git
Build this project
export AMENT_PREFIX_PATH="${OECORE_TARGET_SYSROOT}/usr;${OECORE_NATIVE_SYSROOT}/usr"
export PYTHONPATH=${PYTHONPATH}:${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages
colcon build --merge-install --cmake-args \
-DPython3_ROOT_DIR=${OECORE_TARGET_SYSROOT}/usr \
-DPython3_NumPy_INCLUDE_DIR=${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages/numpy/core/include \
-DPYTHON_SOABI=cpython-310-aarch64-linux-gnu -DCMAKE_STAGING_PREFIX=$(pwd)/install \
-DCMAKE_PREFIX_PATH=$(pwd)/install/share \
-DBUILD_TESTING=OFF
Push to the device & Install
cd `<qirp_decompressed_workspace>/qirp-sdk/ros_ws/install`
tar czvf qrb_ros_audio.tar.gz lib share
scp qrb_ros_audio.tar.gz root@[ip-addr]:/opt/
ssh root@[ip-addr]
(ssh) tar -zxf /opt/qrb_ros_audio.tar.gz -C /opt/qcom/qirp-sdk/usr/
Run
This package supports running it from ros launch file or directly running it from command.
Run with launch file
Source this file to set up the environment on your device:
ssh root@[ip-addr]
(ssh) export HOME=/opt
(ssh) source /opt/qcom/qirp-sdk/qirp-setup.sh
(ssh) export ROS_DOMAIN_ID=xx
(ssh) source /usr/bin/ros_setup.bash
Use this launch file to run this package
(ssh) ros2 launch qrb_ros_audio_common component.launch.py
Run with command
Playback Action:
ros2 run qrb_ros_audio_common audio_common_node_exec --ros-args -p Stream_type:="playback" -p action_name:="ros_audio_playback" -p topic_name:="ros_audio_data"
Capture Action
ros2 run qrb_ros_audio_common audio_common_node_exec --ros-args -p Stream_type:="capture" -p action_name:="ros_audio_capture" -p topic_name:="ros_audio_data"
After launch with component.launch.py, will start two action ros_audio_playback and ros_audio_capture.
Packages
Supported Platforms
This package is designed and tested to be compatible with ROS 2 Humble running on Qualcomm RB3 gen2.
Hardware |
Software |
---|---|
LE.QCROBOTICS.1.0 |
Updates
Date |
Changes |
---|---|
2024-8-21 |
Add Build in QCLINUX SDK |