ros-drivers / audio_common

Common code for working with audio in ROS
BSD 3-Clause "New" or "Revised" License
86 stars 151 forks source link

Question/Tutorial : how to effectively use audio_capture_node in ROS2 #239

Open antbono opened 10 months ago

antbono commented 10 months ago

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!

knorth55 commented 10 months ago

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

antbono commented 10 months ago

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

weeshal commented 9 months ago

@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.