From 51c38625b0e935a50230624bd8f7beaae46600d7 Mon Sep 17 00:00:00 2001 From: Shobuj Paul <72087882+Shobuj-Paul@users.noreply.github.com> Date: Fri, 26 Jul 2024 20:36:28 +0530 Subject: [PATCH] Const topic instead of parameters (#2728) --- .../include/moveit/moveit_cpp/moveit_cpp.h | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h b/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h index f3c6edaa7b..15251ccdc9 100644 --- a/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h +++ b/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h @@ -57,27 +57,28 @@ class MoveItCpp /// Specification of options to use when constructing the MoveItCpp class struct PlanningSceneMonitorOptions { + PlanningSceneMonitorOptions() + : joint_state_topic(planning_scene_monitor::PlanningSceneMonitor::DEFAULT_JOINT_STATES_TOPIC) + , attached_collision_object_topic( + planning_scene_monitor::PlanningSceneMonitor::DEFAULT_ATTACHED_COLLISION_OBJECT_TOPIC) + , monitored_planning_scene_topic(planning_scene_monitor::PlanningSceneMonitor::MONITORED_PLANNING_SCENE_TOPIC) + , publish_planning_scene_topic(planning_scene_monitor::PlanningSceneMonitor::DEFAULT_PLANNING_SCENE_TOPIC) + { + } + void load(const rclcpp::Node::SharedPtr& node) { const std::string ns = "planning_scene_monitor_options"; node->get_parameter_or(ns + ".name", name, std::string("planning_scene_monitor")); node->get_parameter_or(ns + ".robot_description", robot_description, std::string("robot_description")); - node->get_parameter_or(ns + ".joint_state_topic", joint_state_topic, - planning_scene_monitor::PlanningSceneMonitor::DEFAULT_JOINT_STATES_TOPIC); - node->get_parameter_or(ns + ".attached_collision_object_topic", attached_collision_object_topic, - planning_scene_monitor::PlanningSceneMonitor::DEFAULT_ATTACHED_COLLISION_OBJECT_TOPIC); - node->get_parameter_or(ns + ".monitored_planning_scene_topic", monitored_planning_scene_topic, - planning_scene_monitor::PlanningSceneMonitor::MONITORED_PLANNING_SCENE_TOPIC); - node->get_parameter_or(ns + ".publish_planning_scene_topic", publish_planning_scene_topic, - planning_scene_monitor::PlanningSceneMonitor::DEFAULT_PLANNING_SCENE_TOPIC); node->get_parameter_or(ns + ".wait_for_initial_state_timeout", wait_for_initial_state_timeout, 0.0); } std::string name; std::string robot_description; - std::string joint_state_topic; - std::string attached_collision_object_topic; - std::string monitored_planning_scene_topic; - std::string publish_planning_scene_topic; + const std::string joint_state_topic; + const std::string attached_collision_object_topic; + const std::string monitored_planning_scene_topic; + const std::string publish_planning_scene_topic; double wait_for_initial_state_timeout; };