audio_common icon indicating copy to clipboard operation
audio_common copied to clipboard

Question/Tutorial : how to effectively use audio_capture_node in ROS2

Open antbono opened this issue 1 year ago • 3 comments

Hello everyone! I am quite new to ros2 and I am trying to understand how to effectively use audio_capture_node. I think that a common case is recording when some conditions are true and, possibly, for a variable period of time. How can you do this? Do you launch this node from another one? If yes, how? I hope the question is clear.

Thanks!

antbono avatar Sep 05 '23 16:09 antbono

please read launch files and figure out how to use it. you may be need to use audio_play, too. https://github.com/ros-drivers/audio_common/tree/ros2/audio_capture/launch

knorth55 avatar Sep 05 '23 17:09 knorth55

Hi @knorth55! Thank you very much for the quick reply :)

I have already taken a look to capture.launch.py and capture_to_file.launch.py. For my basic understanding of ROS2 launch files, in those above there are nodes' parameters declarations (device, format, bitrate, etc.) and their default values. How should I use the launch file to launch and stop the node as needed?

Thank you again

antbono avatar Sep 05 '23 17:09 antbono

@antbono You can look into ros2 components. The capture node was recently written as a component so you can load and unload it as necessary. The link I have attached uses the command line interface, but you'll need to use ros2 services to emulate a similar workflow in rclpy/rclcpp.

weeshal avatar Oct 05 '23 16:10 weeshal