From 61c95f9493c4b9952ff315d8bdc03cbef48b013a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Tue, 24 Feb 2026 14:57:01 +0100 Subject: [PATCH 1/2] audio_capture: print out errors in the gstreamer pipeline --- audio_capture/src/audio_capture_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio_capture/src/audio_capture_node.cpp b/audio_capture/src/audio_capture_node.cpp index 56dff30..9cf5579 100644 --- a/audio_capture/src/audio_capture_node.cpp +++ b/audio_capture/src/audio_capture_node.cpp @@ -262,7 +262,7 @@ namespace audio_capture gchar *debug; gst_message_parse_error(message, &err, &debug); - // RCLCPP_ERROR_STREAM(this->get_logger(), "gstreamer: " << err->message); + RCLCPP_ERROR_STREAM(server->get_logger(), "gstreamer: " << err->message); g_error_free(err); g_free(debug); g_main_loop_quit(server->_loop); From 09a19ca7588a05d06f1b4310af51be3da7605f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Tue, 24 Feb 2026 14:57:18 +0100 Subject: [PATCH 2/2] audio_capture: document the node parameters --- audio_capture/src/audio_capture_node.cpp | 40 ++++++++++++++++++------ 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/audio_capture/src/audio_capture_node.cpp b/audio_capture/src/audio_capture_node.cpp index 9cf5579..bf34ec1 100644 --- a/audio_capture/src/audio_capture_node.cpp +++ b/audio_capture/src/audio_capture_node.cpp @@ -28,31 +28,53 @@ namespace audio_capture std::string device; // Need to encoding or publish raw wave data - this->declare_parameter("format", "mp3"); - this->declare_parameter("sample_format", "S16LE"); + rcl_interfaces::msg::ParameterDescriptor audio_format_param_desc; + audio_format_param_desc.description = "Audio format to encode or publish (mp3 or wave)"; + this->declare_parameter("format", "mp3", audio_format_param_desc); + rcl_interfaces::msg::ParameterDescriptor sample_format_param_desc; + sample_format_param_desc.description = "Sample format for raw wave data (e.g., S16LE)"; + this->declare_parameter("sample_format", "S16LE", sample_format_param_desc); + this->get_parameter("format", _format); this->get_parameter("sample_format", _sample_format); // The bitrate at which to encode the audio - this->declare_parameter("bitrate", 192); + rcl_interfaces::msg::ParameterDescriptor bitrate_param_desc; + bitrate_param_desc.description = "The bitrate at which to encode the audio"; + this->declare_parameter("bitrate", 192, bitrate_param_desc); this->get_parameter("bitrate", _bitrate); // only available for raw data - this->declare_parameter("channels", 1); - this->declare_parameter("depth", 16); - this->declare_parameter("sample_rate", 16000); + rcl_interfaces::msg::ParameterDescriptor nb_channels_param_desc; + nb_channels_param_desc.description = "Number of audio channels (only for raw data)"; + this->declare_parameter("channels", 1, nb_channels_param_desc); + rcl_interfaces::msg::ParameterDescriptor nb_bits_param_desc; + nb_bits_param_desc.description = "Audio depth in bits (only for raw data)"; + this->declare_parameter("depth", 16, nb_bits_param_desc); + rcl_interfaces::msg::ParameterDescriptor sample_rate_param_desc; + sample_rate_param_desc.description = "Sample rate in Hz (only for raw data)"; + this->declare_parameter("sample_rate", 16000, sample_rate_param_desc); this->get_parameter("channels", _channels); this->get_parameter("depth", _depth); this->get_parameter("sample_rate", _sample_rate); // The destination of the audio - this->declare_parameter("dst", "appsink"); + rcl_interfaces::msg::ParameterDescriptor dst_param_desc; + dst_param_desc.description = "The destination of the audio (e.g., appsink or a " + "filepath; use appsink to publish to ROS)"; + this->declare_parameter("dst", "appsink", dst_param_desc); this->get_parameter("dst", dst_type); // The source of the audio - this->declare_parameter("src", "alsasrc"); + rcl_interfaces::msg::ParameterDescriptor src_param_desc; + src_param_desc.description = + "The source of the audio (e.g., alsasrc or pulsesrc)"; + this->declare_parameter("src", "alsasrc", src_param_desc); this->get_parameter("src", src_type); - this->declare_parameter("device", ""); + rcl_interfaces::msg::ParameterDescriptor device_param_desc; + device_param_desc.description = "The device of the audio source (e.g., hw:0,0; " + "default is the system default)"; + this->declare_parameter("device", "", device_param_desc); this->get_parameter("device", device); _pub = this->create_publisher("audio", 10);