From 0201fda0f2ec78c2d0d23f979af111654d1592d2 Mon Sep 17 00:00:00 2001 From: doronhi Date: Wed, 17 Nov 2021 08:11:57 +0200 Subject: [PATCH] Add description for .profile parameter. --- realsense2_camera/src/profile_manager.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/realsense2_camera/src/profile_manager.cpp b/realsense2_camera/src/profile_manager.cpp index f1e3bd1b7b..7f182dd1c4 100644 --- a/realsense2_camera/src/profile_manager.cpp +++ b/realsense2_camera/src/profile_manager.cpp @@ -239,6 +239,26 @@ void VideoProfilesManager::registerProfileParameters(std::vector } } +std::string get_profiles_descriptions(const std::vector& all_profiles) +{ + std::set profiles_str; + for (auto& profile : all_profiles) + { + auto video_profile = profile.as(); + std::stringstream crnt_profile_str; + crnt_profile_str << video_profile.width() << "x" << video_profile.height() << "x" << video_profile.fps(); + profiles_str.insert(crnt_profile_str.str()); + } + std::stringstream descriptors_strm; + for (auto& profile_str : profiles_str) + { + descriptors_strm << profile_str << "\n"; + } + std::string descriptors(descriptors_strm.str()); + descriptors.pop_back(); + return descriptors; +} + void VideoProfilesManager::registerVideoSensorParams() { // Set default values: @@ -252,7 +272,7 @@ void VideoProfilesManager::registerVideoSensorParams() // Register ROS parameter: std::string param_name(_module_name + ".profile"); rcl_interfaces::msg::ParameterDescriptor crnt_descriptor; - crnt_descriptor.description = "Available options are: DORON\n"; + crnt_descriptor.description = "Available options are:\n" + get_profiles_descriptions(_all_profiles); std::stringstream crnt_profile_str; crnt_profile_str << _width << "x" << _height << "x" << _fps; rclcpp::ParameterValue aa = _params.getParameters()->setParam(param_name, rclcpp::ParameterValue(crnt_profile_str.str()), [this](const rclcpp::Parameter& parameter)