From 9ad59ce2b419fc717a863775d12c3a413d6340bb Mon Sep 17 00:00:00 2001 From: Roelof Oomen Date: Wed, 3 Jul 2024 09:09:41 +0200 Subject: [PATCH] Fixup --- .../src/environment_monitor.cpp | 4 +-- .../include/tesseract_rosutils/plotting.h | 2 +- tesseract_rosutils/src/plotting.cpp | 26 ++++++++++++------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tesseract_monitoring/src/environment_monitor.cpp b/tesseract_monitoring/src/environment_monitor.cpp index e621c8ce..17c20def 100644 --- a/tesseract_monitoring/src/environment_monitor.cpp +++ b/tesseract_monitoring/src/environment_monitor.cpp @@ -187,7 +187,7 @@ bool ROSEnvironmentMonitor::initialize() return false; } - last_update_time_ = last_robot_motion_time_ = node_->now(); + last_update_time_ = last_robot_motion_time_ = internal_node_->now(); last_robot_state_update_wall_time_ = rclcpp::Clock().now(); state_update_pending_ = false; @@ -642,7 +642,7 @@ void ROSEnvironmentMonitor::startStateMonitor(const std::string& joint_states_to if (env_) { if (!current_state_monitor_) - current_state_monitor_ = std::make_unique(env_, node_); + current_state_monitor_ = std::make_unique(env_, internal_node_); current_state_monitor_->addUpdateCallback( std::bind(&ROSEnvironmentMonitor::onJointStateUpdate, this, std::placeholders::_1)); // NOLINT diff --git a/tesseract_rosutils/include/tesseract_rosutils/plotting.h b/tesseract_rosutils/include/tesseract_rosutils/plotting.h index e1c371ca..24ee3570 100644 --- a/tesseract_rosutils/include/tesseract_rosutils/plotting.h +++ b/tesseract_rosutils/include/tesseract_rosutils/plotting.h @@ -135,7 +135,7 @@ class ROSPlotting : public tesseract_visualization::Visualization std::string root_link_; /**< Root link of markers */ std::string topic_namespace_; /**< Namespace used when publishing markers */ int marker_counter_{ 0 }; /**< Counter when plotting */ - rclcpp::Node::SharedPtr node_; + rclcpp::Node::SharedPtr internal_node_; rclcpp::executors::MultiThreadedExecutor::SharedPtr internal_node_executor_; std::shared_ptr internal_node_spinner_; rclcpp::Publisher::SharedPtr scene_pub_; /**< Scene publisher */ diff --git a/tesseract_rosutils/src/plotting.cpp b/tesseract_rosutils/src/plotting.cpp index 9c7bf5e5..d4b03a42 100644 --- a/tesseract_rosutils/src/plotting.cpp +++ b/tesseract_rosutils/src/plotting.cpp @@ -53,15 +53,23 @@ 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)) { - node_ = std::make_shared(NODE_ID); - trajectory_pub_ = - node_->create_publisher(topic_namespace_ + "/display_tesseract_trajectory", 1); - collisions_pub_ = - node_->create_publisher(topic_namespace_ + "/display_collisions", 1); - arrows_pub_ = node_->create_publisher(topic_namespace_ + "/display_arrows", 1); - axes_pub_ = node_->create_publisher(topic_namespace_ + "/display_axes", 1); - tool_path_pub_ = - node_->create_publisher(topic_namespace_ + "/display_tool_path", 1); + internal_node_ = std::make_shared(NODE_ID); + trajectory_pub_ = internal_node_->create_publisher(topic_namespace_ + "/display_" + "tesseract_" + "trajectory", + 1); + collisions_pub_ = internal_node_->create_publisher(topic_namespace_ + "/display" + "_collisi" + "ons", + 1); + arrows_pub_ = + internal_node_->create_publisher(topic_namespace_ + "/display_arrows", 1); + axes_pub_ = + internal_node_->create_publisher(topic_namespace_ + "/display_axes", 1); + tool_path_pub_ = internal_node_->create_publisher(topic_namespace_ + "/display_" + "tool_" + "path", + 1); internal_node_executor_ = std::make_shared(); internal_node_spinner_ = std::make_shared([this]() {