From dab001aea149ec23833316a9257844fabb9aadbb Mon Sep 17 00:00:00 2001 From: Leroy Ruegemer Date: Thu, 17 Feb 2022 10:04:18 +0100 Subject: [PATCH] replace topic_ns with namespace and pass the parameter to the node_handle constructor --- include/interactive_markers/interactive_marker_server.h | 6 +++--- src/interactive_marker_server.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/interactive_markers/interactive_marker_server.h b/include/interactive_markers/interactive_marker_server.h index eac2c85d..52fe793e 100644 --- a/include/interactive_markers/interactive_marker_server.h +++ b/include/interactive_markers/interactive_marker_server.h @@ -63,15 +63,15 @@ class InteractiveMarkerServer : boost::noncopyable static const uint8_t DEFAULT_FEEDBACK_CB = 255; - /// @param topic_ns The interface will use the topics topic_ns/update and - /// topic_ns/feedback for communication. + /// @param namespace Namespace of the server node. The interface will use the topics update and + /// feedback for communication. /// @param server_id If you run multiple servers on the same topic from /// within the same node, you will need to assign different names to them. /// Otherwise, leave this empty. /// @param spin_thread If set to true, will spin up a thread for message handling. /// All callbacks will be called from that thread. INTERACTIVE_MARKERS_PUBLIC - InteractiveMarkerServer( const std::string &topic_ns, const std::string &server_id="", bool spin_thread = false ); + InteractiveMarkerServer( const std::string &namespace, const std::string &server_id="", bool spin_thread = false ); /// Destruction of the interface will lead to all managed markers being cleared. INTERACTIVE_MARKERS_PUBLIC diff --git a/src/interactive_marker_server.cpp b/src/interactive_marker_server.cpp index d960c881..7e7a683a 100644 --- a/src/interactive_marker_server.cpp +++ b/src/interactive_marker_server.cpp @@ -39,8 +39,8 @@ namespace interactive_markers { -InteractiveMarkerServer::InteractiveMarkerServer( const std::string &topic_ns, const std::string &server_id, bool spin_thread ) : - topic_ns_(topic_ns), +InteractiveMarkerServer::InteractiveMarkerServer( const std::string &namespace, const std::string &server_id, bool spin_thread ) : + node_handle_(namespace), seq_num_(0) { if ( spin_thread ) @@ -58,9 +58,9 @@ InteractiveMarkerServer::InteractiveMarkerServer( const std::string &topic_ns, c server_id_ = ros::this_node::getName(); } - std::string update_topic = topic_ns + "/update"; + std::string update_topic = "update"; std::string init_topic = update_topic + "_full"; - std::string feedback_topic = topic_ns + "/feedback"; + std::string feedback_topic = "feedback"; init_pub_ = node_handle_.advertise( init_topic, 100, true ); update_pub_ = node_handle_.advertise( update_topic, 100 );