From b958ca1c225378119b3efca72182f658fd1642ab Mon Sep 17 00:00:00 2001 From: Arun-Prasad-V Date: Tue, 12 Sep 2023 03:01:28 +0530 Subject: [PATCH] getting camera_name dynamically in ROS2 wrapper --- realsense2_camera/src/base_realsense_node.cpp | 3 +++ realsense2_camera/src/parameters.cpp | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/realsense2_camera/src/base_realsense_node.cpp b/realsense2_camera/src/base_realsense_node.cpp index cae3f6c43f..d9cfb06529 100755 --- a/realsense2_camera/src/base_realsense_node.cpp +++ b/realsense2_camera/src/base_realsense_node.cpp @@ -125,6 +125,9 @@ BaseRealSenseNode::BaseRealSenseNode(rclcpp::Node& node, ROS_INFO("Intra-Process communication enabled"); } + // Get node name + _camera_name = _node.get_name(); + initializeFormatsMaps(); _monitor_options = {RS2_OPTION_ASIC_TEMPERATURE, RS2_OPTION_PROJECTOR_TEMPERATURE}; } diff --git a/realsense2_camera/src/parameters.cpp b/realsense2_camera/src/parameters.cpp index c5d1abef3a..e007f60515 100644 --- a/realsense2_camera/src/parameters.cpp +++ b/realsense2_camera/src/parameters.cpp @@ -23,9 +23,6 @@ void BaseRealSenseNode::getParameters() ROS_INFO("getParameters..."); std::string param_name; - param_name = std::string("camera_name"); - _camera_name = _parameters->setParam(param_name, "camera"); - _parameters_names.push_back(param_name); param_name = std::string("publish_tf"); _publish_tf = _parameters->setParam(param_name, PUBLISH_TF);