From f7966a7f5e0c1fe8fa9cc486d8c9efad4dd7d795 Mon Sep 17 00:00:00 2001 From: Roelof Oomen Date: Thu, 24 Oct 2024 10:15:22 +0200 Subject: [PATCH] Generate unique node name for ROSPlotting --- tesseract_rosutils/src/plotting.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tesseract_rosutils/src/plotting.cpp b/tesseract_rosutils/src/plotting.cpp index f02a075b..711d9fb2 100644 --- a/tesseract_rosutils/src/plotting.cpp +++ b/tesseract_rosutils/src/plotting.cpp @@ -53,7 +53,10 @@ static constexpr const char* NODE_ID = "tesseract_rosutils_plotting"; ROSPlotting::ROSPlotting(std::string root_link, std::string topic_namespace) : root_link_(std::move(root_link)), topic_namespace_(std::move(topic_namespace)) { - internal_node_ = std::make_shared(NODE_ID); + // Create a unique name for the node + char node_name[45]; // NOLINT + snprintf(node_name, sizeof(node_name), "%s_%zx", NODE_ID, reinterpret_cast(this)); // NOLINT + internal_node_ = std::make_shared(node_name); trajectory_pub_ = internal_node_->create_publisher(topic_namespace_ + "/display_" "tesseract_" "trajectory",