From c05363cea4549ea7e65331b4c8fcae1f810b1de9 Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Sun, 18 Feb 2024 20:40:52 +0000 Subject: [PATCH 1/9] Fix deprecation warning --- jsk_rviz_plugins/src/overlay_diagnostic_display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_rviz_plugins/src/overlay_diagnostic_display.cpp b/jsk_rviz_plugins/src/overlay_diagnostic_display.cpp index 152fbf22..a90e1d84 100644 --- a/jsk_rviz_plugins/src/overlay_diagnostic_display.cpp +++ b/jsk_rviz_plugins/src/overlay_diagnostic_display.cpp @@ -339,7 +339,7 @@ double OverlayDiagnosticDisplay::textWidth( painter.setFont(font); painter.setPen(pen); QFontMetrics metrics(font); - const int text_width = metrics.width(text.c_str()); + const int text_width = metrics.horizontalAdvance(text.c_str()); const int text_height = metrics.height(); painter.restore(); return text_width; From 3da60f1e07f5921c477b83bb1fc128d7c1fc24c5 Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Sun, 18 Feb 2024 20:41:17 +0000 Subject: [PATCH 2/9] Port CameraInfo display to ROS 2 --- jsk_rviz_plugins/CMakeLists.txt | 9 +- jsk_rviz_plugins/package.xml | 1 + jsk_rviz_plugins/plugins_description.xml | 4 +- jsk_rviz_plugins/src/camera_info_display.cpp | 1189 +++++++++-------- jsk_rviz_plugins/src/camera_info_display.hpp | 263 ++-- .../src/image_transport_hints_property.cpp | 25 + .../src/image_transport_hints_property.hpp | 24 + 7 files changed, 800 insertions(+), 715 deletions(-) create mode 100644 jsk_rviz_plugins/src/image_transport_hints_property.cpp create mode 100644 jsk_rviz_plugins/src/image_transport_hints_property.hpp diff --git a/jsk_rviz_plugins/CMakeLists.txt b/jsk_rviz_plugins/CMakeLists.txt index e20cdb20..6f83d649 100644 --- a/jsk_rviz_plugins/CMakeLists.txt +++ b/jsk_rviz_plugins/CMakeLists.txt @@ -27,6 +27,7 @@ find_package(geometry_msgs REQUIRED) find_package(nav_msgs REQUIRED) find_package(laser_geometry REQUIRED) +find_package(image_geometry REQUIRED) find_package(map_msgs REQUIRED) find_package(pluginlib REQUIRED) find_package(resource_retriever REQUIRED) @@ -107,17 +108,22 @@ add_library(jsk_rviz_plugins SHARED src/close_all_tool.cpp src/open_all_tool.cpp src/screenshot_listener_tool.cpp - src/overlay_picker_tool.cpp) + src/overlay_picker_tool.cpp ### ViewController # src/view_controller/tablet_view_controller.cpp ) + ### Properties + src/image_transport_hints_property.cpp + +) # Link ament packages ament_target_dependencies(jsk_rviz_plugins rclcpp rviz_common cv_bridge image_transport + image_geometry std_msgs geometry_msgs nav_msgs @@ -162,6 +168,7 @@ ament_export_dependencies( image_transport geometry_msgs laser_geometry + image_geometry map_msgs nav_msgs rclcpp diff --git a/jsk_rviz_plugins/package.xml b/jsk_rviz_plugins/package.xml index 06b94768..df2a782e 100644 --- a/jsk_rviz_plugins/package.xml +++ b/jsk_rviz_plugins/package.xml @@ -34,6 +34,7 @@ geometry_msgs laser_geometry + image_geometry nav_msgs map_msgs pluginlib diff --git a/jsk_rviz_plugins/plugins_description.xml b/jsk_rviz_plugins/plugins_description.xml index a511b5bc..367c6b4a 100644 --- a/jsk_rviz_plugins/plugins_description.xml +++ b/jsk_rviz_plugins/plugins_description.xml @@ -76,13 +76,13 @@ - + ament_cmake From febc310ba83da36ad5d5b68b73715088255eda9c Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Sun, 18 Feb 2024 20:51:57 +0000 Subject: [PATCH 4/9] Reduce verbosity --- jsk_rviz_plugins/src/camera_info_display.cpp | 22 +++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/jsk_rviz_plugins/src/camera_info_display.cpp b/jsk_rviz_plugins/src/camera_info_display.cpp index bc2f2f92..6df1ca72 100644 --- a/jsk_rviz_plugins/src/camera_info_display.cpp +++ b/jsk_rviz_plugins/src/camera_info_display.cpp @@ -190,7 +190,7 @@ namespace jsk_rviz_plugins RTDClass::onInitialize(); node_ = context_->getRosNodeAbstraction().lock()->get_raw_node(); image_topic_property_->initialize(context_->getRosNodeAbstraction()); - RCLCPP_INFO(node_->get_logger(), "Initializing CameraInfo view"); + RCLCPP_DEBUG(node_->get_logger(), "Initializing CameraInfo view"); scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); updateColor(); updateAlpha(); @@ -202,7 +202,7 @@ namespace jsk_rviz_plugins updateUseImage(); updateEdgeColor(); - RCLCPP_INFO(node_->get_logger(), "Initialized CameraInfo view"); + RCLCPP_DEBUG(node_->get_logger(), "Initialized CameraInfo view"); } void CameraInfoDisplay::processMessage( @@ -231,11 +231,8 @@ namespace jsk_rviz_plugins { std::lock_guard lock(mutex_); if (image_updated_) { - RCLCPP_ERROR(node_->get_logger(), "image updated"); if (bottom_texture_) { - RCLCPP_ERROR(node_->get_logger(), "draw image"); drawImageTexture(); - RCLCPP_ERROR(node_->get_logger(), "draw image done xd"); image_updated_ = false; } } @@ -360,10 +357,9 @@ namespace jsk_rviz_plugins void CameraInfoDisplay::subscribeImage(std::string topic) { - RCLCPP_ERROR(node_->get_logger(), "sub img"); image_sub_.shutdown(); if (topic.empty()) { - RCLCPP_ERROR(node_->get_logger(), "topic name is empty"); + RCLCPP_DEBUG_THROTTLE(node_->get_logger(), *node_->get_clock(), 5000, "CameraInfo topic name is empty"); return; } image_transport::ImageTransport it(node_); @@ -384,10 +380,10 @@ namespace jsk_rviz_plugins if (use_image_ && !image_.empty() && bottom_texture_->getHeight() == image_.rows && bottom_texture_->getWidth() == image_.cols) { - RCLCPP_ERROR(node_->get_logger(), "bottom_texture_->getHeight(): %u", bottom_texture_->getHeight()); - RCLCPP_ERROR(node_->get_logger(), "bottom_texture_->getWidth(): %u", bottom_texture_->getWidth()); - RCLCPP_ERROR(node_->get_logger(), "image_.rows: %d", image_.rows); - RCLCPP_ERROR(node_->get_logger(), "image_.cols: %d", image_.cols); + RCLCPP_DEBUG(node_->get_logger(), "bottom_texture_->getHeight(): %u", bottom_texture_->getHeight()); + RCLCPP_DEBUG(node_->get_logger(), "bottom_texture_->getWidth(): %u", bottom_texture_->getWidth()); + RCLCPP_DEBUG(node_->get_logger(), "image_.rows: %d", image_.rows); + RCLCPP_DEBUG(node_->get_logger(), "image_.cols: %d", image_.cols); std::vector splitted; cv::split(image_, splitted); @@ -398,10 +394,6 @@ namespace jsk_rviz_plugins cv::Mat boxMat(image_.rows, image_.cols, CV_8UC4, pDest); cv::merge(splitted, boxMat); } else { - RCLCPP_ERROR(node_->get_logger(), "bottom_texture_->getHeight(): %u", bottom_texture_->getHeight()); - RCLCPP_ERROR(node_->get_logger(), "bottom_texture_->getWidth(): %u", bottom_texture_->getWidth()); - RCLCPP_ERROR(node_->get_logger(), "image_.rows: %d", image_.rows); - RCLCPP_ERROR(node_->get_logger(), "image_.cols: %d", image_.cols); memset(pDest, 0, bottom_texture_->getWidth() * bottom_texture_->getHeight()); QImage Hud(pDest, bottom_texture_->getWidth(), bottom_texture_->getHeight(), QImage::Format_ARGB32); for (size_t j = 0; j < bottom_texture_->getHeight(); j++) { From afb5297a1ef1277be15c615c8e51204bae8d52a7 Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Mon, 19 Feb 2024 07:03:25 +0000 Subject: [PATCH 5/9] Mark CameraInfo availability in README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bba57b1e..8b1c841d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ See [read the docs](http://jsk-visualization.readthedocs.org/en/latest/). # 開発環境 - Ubuntu 20.04(ROS2 Foxy) - Ubuntu 20.04(ROS2 Galactic) +- Ubuntu 22.04(ROS2 Humble) - Compilation Only # 実装状況 ## jsk_rviz_plugins @@ -47,7 +48,7 @@ See [read the docs](http://jsk-visualization.readthedocs.org/en/latest/). | TargetVisualizer | ✅ | ✅ | | | Diagnostics | ✅ | ✅ | | | LinearGauge | ✅ | ✅ | ✅ | | -| CameraInfo | | | | +| CameraInfo | ✅ | ✅ | | | PoseArray | | | | (default pluginに実装済み?) | | OverlayCamera | | | | (Panelを含む? )| | PeoplePositionMeasuermentArray | | | | (msg未実装) | From 15bced18fe0a7f03c372ce25e6a0f11615c95109 Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Mon, 19 Feb 2024 07:27:43 +0000 Subject: [PATCH 6/9] Apply ament_clang_format to source --- jsk_rviz_plugins/src/camera_info_display.cpp | 1027 ++++++++--------- jsk_rviz_plugins/src/camera_info_display.hpp | 237 ++-- .../src/image_transport_hints_property.cpp | 19 +- .../src/image_transport_hints_property.hpp | 22 +- 4 files changed, 636 insertions(+), 669 deletions(-) diff --git a/jsk_rviz_plugins/src/camera_info_display.cpp b/jsk_rviz_plugins/src/camera_info_display.cpp index 6df1ca72..479c6da8 100644 --- a/jsk_rviz_plugins/src/camera_info_display.cpp +++ b/jsk_rviz_plugins/src/camera_info_display.cpp @@ -31,598 +31,565 @@ // ROS 2 Port: // Ander González Tomé @ IKERLAN S. COOP. - -#include -#include -#include -#include #include "camera_info_display.hpp" -#include -#include + #include -#include #include +#include +#include #include +#include + +#include +#include +#include +#include +#include +#include namespace jsk_rviz_plugins { - TrianglePolygon::TrianglePolygon( - Ogre::SceneManager* manager, - Ogre::SceneNode* node, - const cv::Point3d& O, - const cv::Point3d& A, - const cv::Point3d& B, - const std::string& name, - const Ogre::ColourValue& color, - bool use_color, - bool upper_triangle) - { - // uniq string is requred for name - - manual_ = manager->createManualObject(); - manual_->clear(); - manual_->begin(name, - Ogre::RenderOperation::OT_TRIANGLE_STRIP); - manual_->position(O.x, O.y, O.z); - if (upper_triangle) { - manual_->textureCoord(0, 0); - } - else { - manual_->textureCoord(1, 0); - } - if (use_color) { - manual_->colour(color); - } - manual_->position(A.x, A.y, A.z); - if (upper_triangle) { - manual_->textureCoord(1, 0); - } - else { - manual_->textureCoord(1, 1); - } - if (use_color) { - manual_->colour(color); - } - manual_->position(B.x, B.y, B.z); - if (upper_triangle) { - manual_->textureCoord(0, 1); - } - else { - manual_->textureCoord(0, 1); - } - if (use_color) { - manual_->colour(color); - } - manual_->end(); - node->attachObject(manual_); +TrianglePolygon::TrianglePolygon( + Ogre::SceneManager * manager, Ogre::SceneNode * node, const cv::Point3d & O, + const cv::Point3d & A, const cv::Point3d & B, const std::string & name, + const Ogre::ColourValue & color, bool use_color, bool upper_triangle) +{ + // uniq string is requred for name + + manual_ = manager->createManualObject(); + manual_->clear(); + manual_->begin(name, Ogre::RenderOperation::OT_TRIANGLE_STRIP); + manual_->position(O.x, O.y, O.z); + if (upper_triangle) { + manual_->textureCoord(0, 0); + } else { + manual_->textureCoord(1, 0); + } + if (use_color) { + manual_->colour(color); + } + manual_->position(A.x, A.y, A.z); + if (upper_triangle) { + manual_->textureCoord(1, 0); + } else { + manual_->textureCoord(1, 1); + } + if (use_color) { + manual_->colour(color); + } + manual_->position(B.x, B.y, B.z); + if (upper_triangle) { + manual_->textureCoord(0, 1); + } else { + manual_->textureCoord(0, 1); } + if (use_color) { + manual_->colour(color); + } + manual_->end(); + node->attachObject(manual_); +} + +TrianglePolygon::~TrianglePolygon() +{ + manual_->detachFromParent(); + // manager_->destroyManualObject(manual_); // this crashes rviz +} + +CameraInfoDisplay::CameraInfoDisplay() : image_updated_(true) +{ + //////////////////////////////////////////////////////// + // initialize properties + //////////////////////////////////////////////////////// + far_clip_distance_property_ = new rviz_common::properties::FloatProperty( + "far clip", 1.0, "far clip distance from the origin of camera info", this, + SLOT(updateFarClipDistance())); + show_edges_property_ = new rviz_common::properties::BoolProperty( + "show edges", true, + "show edges of the region of " + "the camera info", + this, SLOT(updateShowEdges())); + show_polygons_property_ = new rviz_common::properties::BoolProperty( + "show polygons", true, "show polygons of the region of the camera info", this, + SLOT(updateShowPolygons())); + not_show_side_polygons_property_ = new rviz_common::properties::BoolProperty( + "not show side polygons", true, + "do not show polygons of the region of " + "the camera info", + this, SLOT(updateNotShowSidePolygons())); + use_image_property_ = new rviz_common::properties::BoolProperty( + "use image", false, "use image as texture", this, SLOT(updateUseImage())); + image_topic_property_ = new rviz_common::properties::RosTopicProperty( + "Image Topic", "", rosidl_generator_traits::name(), + "sensor_msgs::Image topic to subscribe to.", this, SLOT(updateImageTopic())); + image_topic_property_->setHidden(true); + + image_transport_hints_property_ = new ImageTransportHintsProperty( + "Transport Type", "transport hint for image subscription", this, SLOT(updateImageTopic())); + image_transport_hints_property_->hide(); + color_property_ = new rviz_common::properties::ColorProperty( + "color", QColor(85, 255, 255), "color of CameraInfo", this, SLOT(updateColor())); + edge_color_property_ = new rviz_common::properties::ColorProperty( + "edge color", QColor(125, 125, 125), "edge color of CameraInfo", this, SLOT(updateEdgeColor())); + alpha_property_ = new rviz_common::properties::FloatProperty( + "alpha", 0.5, "alpha blending value", this, SLOT(updateAlpha())); +} - TrianglePolygon::~TrianglePolygon() - { - manual_->detachFromParent(); - //manager_->destroyManualObject(manual_); // this crashes rviz +CameraInfoDisplay::~CameraInfoDisplay() +{ + if (edges_) { + edges_->clear(); } + polygons_.clear(); + delete far_clip_distance_property_; + delete color_property_; + delete alpha_property_; + delete show_polygons_property_; + delete edge_color_property_; +} - CameraInfoDisplay::CameraInfoDisplay(): image_updated_(true) - { - //////////////////////////////////////////////////////// - // initialize properties - //////////////////////////////////////////////////////// - far_clip_distance_property_ = new rviz_common::properties::FloatProperty( - "far clip", - 1.0, - "far clip distance from the origin of camera info", - this, SLOT(updateFarClipDistance())); - show_edges_property_ = new rviz_common::properties::BoolProperty( - "show edges", - true, - "show edges of the region of the camera info", - this, SLOT(updateShowEdges())); - show_polygons_property_ = new rviz_common::properties::BoolProperty( - "show polygons", - true, - "show polygons of the region of the camera info", - this, SLOT(updateShowPolygons())); - not_show_side_polygons_property_ = new rviz_common::properties::BoolProperty( - "not show side polygons", - true, - "do not show polygons of the region of the camera info", - this, SLOT(updateNotShowSidePolygons())); - use_image_property_ = new rviz_common::properties::BoolProperty( - "use image", - false, - "use image as texture", - this, SLOT(updateUseImage())); - image_topic_property_ = new rviz_common::properties::RosTopicProperty( - "Image Topic", "", - rosidl_generator_traits::name(), - "sensor_msgs::Image topic to subscribe to.", - this, SLOT( updateImageTopic() )); - image_topic_property_->setHidden(true); - - image_transport_hints_property_ = new ImageTransportHintsProperty( - "Transport Type", - "transport hint for image subscription", - this, SLOT( updateImageTopic() )); - image_transport_hints_property_->hide(); - color_property_ = new rviz_common::properties::ColorProperty( - "color", - QColor(85, 255, 255), - "color of CameraInfo", - this, SLOT(updateColor())); - edge_color_property_ = new rviz_common::properties::ColorProperty( - "edge color", - QColor(125, 125, 125), - "edge color of CameraInfo", - this, SLOT(updateEdgeColor())); - alpha_property_ = new rviz_common::properties::FloatProperty( - "alpha", - 0.5, - "alpha blending value", - this, SLOT(updateAlpha())); - } - - CameraInfoDisplay::~CameraInfoDisplay() - { - if (edges_) { - edges_->clear(); - } - polygons_.clear(); - delete far_clip_distance_property_; - delete color_property_; - delete alpha_property_; - delete show_polygons_property_; - delete edge_color_property_; - } - - void CameraInfoDisplay::reset() - { - RTDClass::reset(); - if (edges_) { - edges_->clear(); - } - polygons_.clear(); - camera_info_ = sensor_msgs::msg::CameraInfo::ConstPtr(); // reset to NULL - } - - void CameraInfoDisplay::onInitialize() - { - RTDClass::onInitialize(); - node_ = context_->getRosNodeAbstraction().lock()->get_raw_node(); - image_topic_property_->initialize(context_->getRosNodeAbstraction()); - RCLCPP_DEBUG(node_->get_logger(), "Initializing CameraInfo view"); - scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); - updateColor(); - updateAlpha(); - updateFarClipDistance(); - updateShowPolygons(); - updateNotShowSidePolygons(); - updateShowEdges(); - updateImageTopic(); - updateUseImage(); - updateEdgeColor(); - - RCLCPP_DEBUG(node_->get_logger(), "Initialized CameraInfo view"); - } - - void CameraInfoDisplay::processMessage( - sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) - { - if (!isSameCameraInfo(msg)) { - createCameraInfoShapes(msg); - } - // move scene_node according to tf - Ogre::Vector3 position; - Ogre::Quaternion quaternion; - if(!context_->getFrameManager()->getTransform(msg->header.frame_id, - msg->header.stamp, - position, - quaternion)) { - RCLCPP_ERROR(node_->get_logger(), "Error transforming pose '%s' from frame '%s' to frame '%s'", - qPrintable( getName() ), msg->header.frame_id.c_str(), - qPrintable( fixed_frame_ )); - } - scene_node_->setPosition(position); - scene_node_->setOrientation(quaternion); - camera_info_ = msg; // store for caching - } - - void CameraInfoDisplay::update(float wall_dt, float ros_dt) - { - std::lock_guard lock(mutex_); - if (image_updated_) { - if (bottom_texture_) { - drawImageTexture(); - image_updated_ = false; - } +void CameraInfoDisplay::reset() +{ + RTDClass::reset(); + if (edges_) { + edges_->clear(); + } + polygons_.clear(); + camera_info_ = sensor_msgs::msg::CameraInfo::ConstPtr(); // reset to NULL +} + +void CameraInfoDisplay::onInitialize() +{ + RTDClass::onInitialize(); + node_ = context_->getRosNodeAbstraction().lock()->get_raw_node(); + image_topic_property_->initialize(context_->getRosNodeAbstraction()); + RCLCPP_DEBUG(node_->get_logger(), "Initializing CameraInfo view"); + scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); + updateColor(); + updateAlpha(); + updateFarClipDistance(); + updateShowPolygons(); + updateNotShowSidePolygons(); + updateShowEdges(); + updateImageTopic(); + updateUseImage(); + updateEdgeColor(); + + RCLCPP_DEBUG(node_->get_logger(), "Initialized CameraInfo view"); +} + +void CameraInfoDisplay::processMessage(sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) +{ + if (!isSameCameraInfo(msg)) { + createCameraInfoShapes(msg); + } + // move scene_node according to tf + Ogre::Vector3 position; + Ogre::Quaternion quaternion; + if (!context_->getFrameManager()->getTransform( + msg->header.frame_id, msg->header.stamp, position, quaternion)) { + RCLCPP_ERROR( + node_->get_logger(), "Error transforming pose '%s' from frame '%s' to frame '%s'", + qPrintable(getName()), msg->header.frame_id.c_str(), qPrintable(fixed_frame_)); + } + scene_node_->setPosition(position); + scene_node_->setOrientation(quaternion); + camera_info_ = msg; // store for caching +} + +void CameraInfoDisplay::update(float wall_dt, float ros_dt) +{ + std::lock_guard lock(mutex_); + if (image_updated_) { + if (bottom_texture_) { + drawImageTexture(); + image_updated_ = false; } } +} - bool CameraInfoDisplay::isSameCameraInfo( - sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) - { - if (camera_info_) { - bool meta_same_p = - msg->header.frame_id == camera_info_->header.frame_id && - msg->height == camera_info_->height && - msg->width == camera_info_->width && - msg->distortion_model == camera_info_->distortion_model; - if (meta_same_p) { - for (size_t i = 0; i < msg->p.size(); i++) { - if (msg->p[i] != camera_info_->p[i]) { - return false; - } +bool CameraInfoDisplay::isSameCameraInfo(sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) +{ + if (camera_info_) { + bool meta_same_p = msg->header.frame_id == camera_info_->header.frame_id && + msg->height == camera_info_->height && msg->width == camera_info_->width && + msg->distortion_model == camera_info_->distortion_model; + if (meta_same_p) { + for (size_t i = 0; i < msg->p.size(); i++) { + if (msg->p[i] != camera_info_->p[i]) { + return false; } - return true; } - else { - return false; - } - } - else { + return true; + } else { return false; } + } else { + return false; } +} + +void CameraInfoDisplay::addPointToEdge(const cv::Point3d & point) +{ + Ogre::Vector3 p; + p[0] = point.x; + p[1] = point.y; + p[2] = point.z; + edges_->addPoint(p); +} + +void CameraInfoDisplay::addPolygon( + const cv::Point3d & O, const cv::Point3d & A, const cv::Point3d & B, std::string name, + bool use_color, bool upper_triangle) +{ + Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); + color.a = alpha_; + TrianglePolygon::Ptr triangle(new TrianglePolygon( + scene_manager_, scene_node_, O, A, B, name, color, use_color, upper_triangle)); + polygons_.push_back(triangle); +} - void CameraInfoDisplay::addPointToEdge( - const cv::Point3d& point) - { - Ogre::Vector3 p; - p[0] = point.x; - p[1] = point.y; - p[2] = point.z; - edges_->addPoint(p); +void CameraInfoDisplay::createTextureForBottom(int width, int height) +{ + if ( + !bottom_texture_ || bottom_texture_->getWidth() != width || + bottom_texture_->getHeight() != height) { + static uint32_t count = 0; + rviz_common::UniformStringStream ss; + ss << "CameraInfoDisplayPolygonBottom" << count++; + material_bottom_ = Ogre::MaterialManager::getSingleton().create( + ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); + bottom_texture_ = Ogre::TextureManager::getSingleton().createManual( + material_bottom_->getName() + "Texture", // name + Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, width, height, 0, + Ogre::PF_A8R8G8B8, Ogre::TU_DEFAULT); + material_bottom_->getTechnique(0)->getPass(0)->setColourWriteEnabled(true); + Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); + color.a = alpha_; + material_bottom_->getTechnique(0)->getPass(0)->setAmbient(color); + material_bottom_->setReceiveShadows(false); + material_bottom_->getTechnique(0)->setLightingEnabled(true); + material_bottom_->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE); + material_bottom_->getTechnique(0)->getPass(0)->setLightingEnabled(false); + material_bottom_->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); + material_bottom_->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true); + + material_bottom_->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE); + material_bottom_->getTechnique(0)->getPass(0)->createTextureUnitState( + bottom_texture_->getName()); + material_bottom_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); } +} - void CameraInfoDisplay::addPolygon( - const cv::Point3d& O, const cv::Point3d& A, const cv::Point3d& B, std::string name, bool use_color, bool upper_triangle) - { +void CameraInfoDisplay::prepareMaterial() +{ + if (!texture_) { + // material + static uint32_t count = 0; + rviz_common::UniformStringStream ss; + ss << "CameraInfoDisplayPolygon" << count++; + material_ = Ogre::MaterialManager::getSingleton().create( + ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); + texture_ = Ogre::TextureManager::getSingleton().createManual( + material_->getName() + "Texture", // name + Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 1, 1, 0, + Ogre::PF_A8R8G8B8, Ogre::TU_DEFAULT); + material_->getTechnique(0)->getPass(0)->setColourWriteEnabled(true); Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); color.a = alpha_; - TrianglePolygon::Ptr triangle (new TrianglePolygon( - scene_manager_, - scene_node_, - O, A, B, name, - color, - use_color, - upper_triangle)); - polygons_.push_back(triangle); - } - - void CameraInfoDisplay::createTextureForBottom(int width, int height) - { - if (!bottom_texture_ - || bottom_texture_->getWidth() != width - || bottom_texture_->getHeight() != height) { - static uint32_t count = 0; - rviz_common::UniformStringStream ss; - ss << "CameraInfoDisplayPolygonBottom" << count++; - material_bottom_ - = Ogre::MaterialManager::getSingleton().create( - ss.str(), - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - bottom_texture_ = Ogre::TextureManager::getSingleton().createManual( - material_bottom_->getName() + "Texture", // name - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::TEX_TYPE_2D, width, height, 0, Ogre::PF_A8R8G8B8, Ogre::TU_DEFAULT); - material_bottom_->getTechnique(0)->getPass(0)->setColourWriteEnabled(true); - Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); - color.a = alpha_; - material_bottom_->getTechnique(0)->getPass(0)->setAmbient(color); - material_bottom_->setReceiveShadows(false); - material_bottom_->getTechnique(0)->setLightingEnabled(true); - material_bottom_->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE); - material_bottom_->getTechnique(0)->getPass(0)->setLightingEnabled(false); - material_bottom_->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); - material_bottom_->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true); - - material_bottom_->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE); - material_bottom_->getTechnique(0)->getPass(0)->createTextureUnitState(bottom_texture_->getName()); - material_bottom_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); - } + material_->getTechnique(0)->getPass(0)->setAmbient(color); + material_->setReceiveShadows(false); + material_->getTechnique(0)->setLightingEnabled(true); + material_->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE); + material_->getTechnique(0)->getPass(0)->setLightingEnabled(false); + material_->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); + material_->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true); + + material_->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE); + material_->getTechnique(0)->getPass(0)->createTextureUnitState(texture_->getName()); + material_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); + createTextureForBottom(640, 480); } +} - void CameraInfoDisplay::prepareMaterial() - { - if (!texture_) { - // material - static uint32_t count = 0; - rviz_common::UniformStringStream ss; - ss << "CameraInfoDisplayPolygon" << count++; - material_ - = Ogre::MaterialManager::getSingleton().create( - ss.str(), - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - texture_ = Ogre::TextureManager::getSingleton().createManual( - material_->getName() + "Texture", // name - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::TEX_TYPE_2D, 1, 1, 0, Ogre::PF_A8R8G8B8, Ogre::TU_DEFAULT); - material_->getTechnique(0)->getPass(0)->setColourWriteEnabled(true); - Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); - color.a = alpha_; - material_->getTechnique(0)->getPass(0)->setAmbient(color); - material_->setReceiveShadows(false); - material_->getTechnique(0)->setLightingEnabled(true); - material_->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE); - material_->getTechnique(0)->getPass(0)->setLightingEnabled(false); - material_->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); - material_->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true); - - material_->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE); - material_->getTechnique(0)->getPass(0)->createTextureUnitState(texture_->getName()); - material_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); - createTextureForBottom(640, 480); - } +void CameraInfoDisplay::subscribeImage(std::string topic) +{ + image_sub_.shutdown(); + if (topic.empty()) { + RCLCPP_DEBUG_THROTTLE( + node_->get_logger(), *node_->get_clock(), 5000, "CameraInfo topic name is empty"); + return; } + image_transport::ImageTransport it(node_); + auto image_properties = image_transport_hints_property_->getTransportHints(node_.get()); + image_sub_ = it.subscribe(topic, 1, &CameraInfoDisplay::imageCallback, this, &image_properties); +} - void CameraInfoDisplay::subscribeImage(std::string topic) - { - image_sub_.shutdown(); - if (topic.empty()) { - RCLCPP_DEBUG_THROTTLE(node_->get_logger(), *node_->get_clock(), 5000, "CameraInfo topic name is empty"); - return; - } - image_transport::ImageTransport it(node_); - auto image_properties = image_transport_hints_property_->getTransportHints(node_.get()); - image_sub_ = it.subscribe(topic, 1, - &CameraInfoDisplay::imageCallback, this, - &image_properties); - } - - void CameraInfoDisplay::drawImageTexture() - { - bottom_texture_->getBuffer()->lock( Ogre::HardwareBuffer::HBL_NORMAL ); - const Ogre::PixelBox& pixelBox - = bottom_texture_->getBuffer()->getCurrentLock(); - Ogre::uint8* pDest = static_cast (pixelBox.data); - // Don't copy pixel-by-pixel image matrices. - // Just split matrix into channels, add needed alpha channel and merge back directly into buffer. - if (use_image_ && !image_.empty() && - bottom_texture_->getHeight() == image_.rows && - bottom_texture_->getWidth() == image_.cols) { - RCLCPP_DEBUG(node_->get_logger(), "bottom_texture_->getHeight(): %u", bottom_texture_->getHeight()); - RCLCPP_DEBUG(node_->get_logger(), "bottom_texture_->getWidth(): %u", bottom_texture_->getWidth()); - RCLCPP_DEBUG(node_->get_logger(), "image_.rows: %d", image_.rows); - RCLCPP_DEBUG(node_->get_logger(), "image_.cols: %d", image_.cols); - - std::vector splitted; - cv::split(image_, splitted); - // Swap channels RGB -> BGR for cv::merge. - std::swap(splitted[0], splitted[2]); - cv::Mat alpha(image_.rows, image_.cols, CV_8U, cv::Scalar(alpha_ * 255.0)); - splitted.push_back(alpha); - cv::Mat boxMat(image_.rows, image_.cols, CV_8UC4, pDest); - cv::merge(splitted, boxMat); - } else { - memset(pDest, 0, bottom_texture_->getWidth() * bottom_texture_->getHeight()); - QImage Hud(pDest, bottom_texture_->getWidth(), bottom_texture_->getHeight(), QImage::Format_ARGB32); - for (size_t j = 0; j < bottom_texture_->getHeight(); j++) { - for (size_t i = 0; i < bottom_texture_->getWidth(); i++) { - Hud.setPixel(i, j, color_.rgba()); - } +void CameraInfoDisplay::drawImageTexture() +{ + bottom_texture_->getBuffer()->lock(Ogre::HardwareBuffer::HBL_NORMAL); + const Ogre::PixelBox & pixelBox = bottom_texture_->getBuffer()->getCurrentLock(); + Ogre::uint8 * pDest = static_cast(pixelBox.data); + // Don't copy pixel-by-pixel image matrices. + // Just split matrix into channels + // add needed alpha channel and merge back directly into buffer. + if ( + use_image_ && !image_.empty() && bottom_texture_->getHeight() == image_.rows && + bottom_texture_->getWidth() == image_.cols) { + RCLCPP_DEBUG( + node_->get_logger(), "bottom_texture_->getHeight(): %u", bottom_texture_->getHeight()); + RCLCPP_DEBUG( + node_->get_logger(), "bottom_texture_->getWidth(): %u", bottom_texture_->getWidth()); + RCLCPP_DEBUG(node_->get_logger(), "image_.rows: %d", image_.rows); + RCLCPP_DEBUG(node_->get_logger(), "image_.cols: %d", image_.cols); + + std::vector splitted; + cv::split(image_, splitted); + // Swap channels RGB -> BGR for cv::merge. + std::swap(splitted[0], splitted[2]); + cv::Mat alpha(image_.rows, image_.cols, CV_8U, cv::Scalar(alpha_ * 255.0)); + splitted.push_back(alpha); + cv::Mat boxMat(image_.rows, image_.cols, CV_8UC4, pDest); + cv::merge(splitted, boxMat); + } else { + memset(pDest, 0, bottom_texture_->getWidth() * bottom_texture_->getHeight()); + QImage Hud( + pDest, bottom_texture_->getWidth(), bottom_texture_->getHeight(), QImage::Format_ARGB32); + for (size_t j = 0; j < bottom_texture_->getHeight(); j++) { + for (size_t i = 0; i < bottom_texture_->getWidth(); i++) { + Hud.setPixel(i, j, color_.rgba()); } } - bottom_texture_->getBuffer()->unlock(); - } - - // convert sensor_msgs::Image into cv::Mat - void CameraInfoDisplay::imageCallback( - const sensor_msgs::msg::Image::ConstSharedPtr& msg) - { - std::lock_guard lock(mutex_); - cv_bridge::CvImagePtr cv_ptr; - try - { - cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::RGB8); - image_ = cv_ptr->image; - // check the size of bottom texture - if (!bottom_texture_ - || bottom_texture_->getWidth() != image_.cols - || bottom_texture_->getHeight() != image_.rows) { - createTextureForBottom(image_.cols, image_.rows); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } + } + bottom_texture_->getBuffer()->unlock(); +} + +// convert sensor_msgs::Image into cv::Mat +void CameraInfoDisplay::imageCallback(const sensor_msgs::msg::Image::ConstSharedPtr & msg) +{ + std::lock_guard lock(mutex_); + cv_bridge::CvImagePtr cv_ptr; + try { + cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::RGB8); + image_ = cv_ptr->image; + // check the size of bottom texture + if ( + !bottom_texture_ || bottom_texture_->getWidth() != image_.cols || + bottom_texture_->getHeight() != image_.rows) { + createTextureForBottom(image_.cols, image_.rows); + if (camera_info_) { + createCameraInfoShapes(camera_info_); } - image_updated_ = true; - } - catch (cv_bridge::Exception& e) - { - RCLCPP_ERROR(node_->get_logger(), "cv_bridge exception: %s", e.what()); } + image_updated_ = true; + } catch (cv_bridge::Exception & e) { + RCLCPP_ERROR(node_->get_logger(), "cv_bridge exception: %s", e.what()); } +} - void CameraInfoDisplay::createCameraInfoShapes( - sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) - { - polygons_.clear(); - if (edges_) { - edges_->clear(); - } - image_geometry::PinholeCameraModel model; - bool model_success_p = model.fromCameraInfo(msg); - if (!model_success_p) { - setStatus(rviz_common::properties::StatusProperty::Error, "Camera Info", "Failed to create camera model from msg"); - RCLCPP_ERROR(node_->get_logger(), "failed to create camera model"); - return; - } - // fx and fy should not be equal 0. - if (model.fx() == 0.0 || model.fy() == 0.0) { - setStatus(rviz_common::properties::StatusProperty::Error, "Camera Info", "Invalid intrinsic matrix"); - RCLCPP_ERROR_STREAM(node_->get_logger(), "camera model have invalid intrinsic matrix " << model.intrinsicMatrix()); - return; - } - setStatus(rviz_common::properties::StatusProperty::Ok, "Camera Info", "OK"); +void CameraInfoDisplay::createCameraInfoShapes(sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) +{ + polygons_.clear(); + if (edges_) { + edges_->clear(); + } + image_geometry::PinholeCameraModel model; + bool model_success_p = model.fromCameraInfo(msg); + if (!model_success_p) { + setStatus( + rviz_common::properties::StatusProperty::Error, "Camera Info", + "Failed to create camera model from msg"); + RCLCPP_ERROR(node_->get_logger(), "failed to create camera model"); + return; + } + // fx and fy should not be equal 0. + if (model.fx() == 0.0 || model.fy() == 0.0) { + setStatus( + rviz_common::properties::StatusProperty::Error, "Camera Info", "Invalid intrinsic matrix"); + RCLCPP_ERROR_STREAM( + node_->get_logger(), + "camera model have invalid intrinsic matrix " << model.intrinsicMatrix()); + return; + } + setStatus(rviz_common::properties::StatusProperty::Ok, "Camera Info", "OK"); - //////////////////////////////////////////////////////// - // initialize BillboardLine - //////////////////////////////////////////////////////// - if (!edges_) { - edges_.reset(new rviz_rendering::BillboardLine(context_->getSceneManager(), - scene_node_)); - edges_->setLineWidth(0.01); - } + //////////////////////////////////////////////////////// + // initialize BillboardLine + //////////////////////////////////////////////////////// + if (!edges_) { + edges_.reset(new rviz_rendering::BillboardLine(context_->getSceneManager(), scene_node_)); + edges_->setLineWidth(0.01); + } - cv::Point2d a(0, 0), b(msg->width, 0), - c(msg->width, msg->height), d(0, msg->height); - // all the z = 1.0 - cv::Point3d A = model.projectPixelTo3dRay(a); - cv::Point3d B = model.projectPixelTo3dRay(b); - cv::Point3d C = model.projectPixelTo3dRay(c); - cv::Point3d D = model.projectPixelTo3dRay(d); + cv::Point2d a(0, 0), b(msg->width, 0), c(msg->width, msg->height), d(0, msg->height); + // all the z = 1.0 + cv::Point3d A = model.projectPixelTo3dRay(a); + cv::Point3d B = model.projectPixelTo3dRay(b); + cv::Point3d C = model.projectPixelTo3dRay(c); + cv::Point3d D = model.projectPixelTo3dRay(d); - cv::Point3d scaled_A = A * far_clip_distance_; - cv::Point3d scaled_B = B * far_clip_distance_; - cv::Point3d scaled_C = C * far_clip_distance_; - cv::Point3d scaled_D = D * far_clip_distance_; + cv::Point3d scaled_A = A * far_clip_distance_; + cv::Point3d scaled_B = B * far_clip_distance_; + cv::Point3d scaled_C = C * far_clip_distance_; + cv::Point3d scaled_D = D * far_clip_distance_; - cv::Point3d O(0, 0, 0); + cv::Point3d O(0, 0, 0); + //////////////////////////////////////////////////////// + // build polygons + //////////////////////////////////////////////////////// + if (show_polygons_) { //////////////////////////////////////////////////////// - // build polygons + // setup color for polygons //////////////////////////////////////////////////////// - if (show_polygons_) { - //////////////////////////////////////////////////////// - // setup color for polygons - //////////////////////////////////////////////////////// - Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); - color.a = alpha_; - prepareMaterial(); - if (!not_show_side_polygons_) { - material_->getTechnique(0)->getPass(0)->setAmbient(color); - { - texture_->getBuffer()->lock( Ogre::HardwareBuffer::HBL_NORMAL ); - const Ogre::PixelBox& pixelBox - = texture_->getBuffer()->getCurrentLock(); - Ogre::uint8* pDest = static_cast (pixelBox.data); - memset(pDest, 0, 1); - QImage Hud(pDest, 1, 1, QImage::Format_ARGB32 ); - Hud.setPixel(0, 0, color_.rgba()); - texture_->getBuffer()->unlock(); - } - addPolygon(O, scaled_B, scaled_A, material_->getName(), true, true); - addPolygon(O, scaled_C, scaled_B, material_->getName(), true, true); - addPolygon(O, scaled_D, scaled_C, material_->getName(), true, true); - addPolygon(O, scaled_A, scaled_D, material_->getName(), true, true); + Ogre::ColourValue color = rviz_common::properties::qtToOgre(color_); + color.a = alpha_; + prepareMaterial(); + if (!not_show_side_polygons_) { + material_->getTechnique(0)->getPass(0)->setAmbient(color); + { + texture_->getBuffer()->lock(Ogre::HardwareBuffer::HBL_NORMAL); + const Ogre::PixelBox & pixelBox = texture_->getBuffer()->getCurrentLock(); + Ogre::uint8 * pDest = static_cast(pixelBox.data); + memset(pDest, 0, 1); + QImage Hud(pDest, 1, 1, QImage::Format_ARGB32); + Hud.setPixel(0, 0, color_.rgba()); + texture_->getBuffer()->unlock(); } - // bottom - drawImageTexture(); - - addPolygon(scaled_A, scaled_B, scaled_D, material_bottom_->getName(), false, true); - addPolygon(scaled_B, scaled_C, scaled_D, material_bottom_->getName(), false, false); - } - //////////////////////////////////////////////////////// - // build edges - //////////////////////////////////////////////////////// - if (show_edges_) { - edges_->clear(); - edges_->setMaxPointsPerLine(2); - edges_->setNumLines(8); - edges_->setColor(edge_color_.red() / 255.0, - edge_color_.green() / 255.0, - edge_color_.blue() / 255.0, - alpha_); - addPointToEdge(O); addPointToEdge(scaled_A); edges_->finishLine(); - addPointToEdge(O); addPointToEdge(scaled_B); edges_->finishLine(); - addPointToEdge(O); addPointToEdge(scaled_C); edges_->finishLine(); - addPointToEdge(O); addPointToEdge(scaled_D); edges_->finishLine(); - addPointToEdge(scaled_A); addPointToEdge(scaled_B); edges_->finishLine(); - addPointToEdge(scaled_B); addPointToEdge(scaled_C); edges_->finishLine(); - addPointToEdge(scaled_C); addPointToEdge(scaled_D); edges_->finishLine(); - addPointToEdge(scaled_D); addPointToEdge(scaled_A); + addPolygon(O, scaled_B, scaled_A, material_->getName(), true, true); + addPolygon(O, scaled_C, scaled_B, material_->getName(), true, true); + addPolygon(O, scaled_D, scaled_C, material_->getName(), true, true); + addPolygon(O, scaled_A, scaled_D, material_->getName(), true, true); } - } + // bottom + drawImageTexture(); + addPolygon(scaled_A, scaled_B, scaled_D, material_bottom_->getName(), false, true); + addPolygon(scaled_B, scaled_C, scaled_D, material_bottom_->getName(), false, false); + } //////////////////////////////////////////////////////// - // Properties updating functions + // build edges //////////////////////////////////////////////////////// - void CameraInfoDisplay::updateColor() - { - color_ = color_property_->getColor(); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } + if (show_edges_) { + edges_->clear(); + edges_->setMaxPointsPerLine(2); + edges_->setNumLines(8); + edges_->setColor( + edge_color_.red() / 255.0, edge_color_.green() / 255.0, edge_color_.blue() / 255.0, alpha_); + addPointToEdge(O); + addPointToEdge(scaled_A); + edges_->finishLine(); + addPointToEdge(O); + addPointToEdge(scaled_B); + edges_->finishLine(); + addPointToEdge(O); + addPointToEdge(scaled_C); + edges_->finishLine(); + addPointToEdge(O); + addPointToEdge(scaled_D); + edges_->finishLine(); + addPointToEdge(scaled_A); + addPointToEdge(scaled_B); + edges_->finishLine(); + addPointToEdge(scaled_B); + addPointToEdge(scaled_C); + edges_->finishLine(); + addPointToEdge(scaled_C); + addPointToEdge(scaled_D); + edges_->finishLine(); + addPointToEdge(scaled_D); + addPointToEdge(scaled_A); } +} - void CameraInfoDisplay::updateEdgeColor() - { - edge_color_ = edge_color_property_->getColor(); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } +//////////////////////////////////////////////////////// +// Properties updating functions +//////////////////////////////////////////////////////// +void CameraInfoDisplay::updateColor() +{ + color_ = color_property_->getColor(); + if (camera_info_) { + createCameraInfoShapes(camera_info_); } +} - void CameraInfoDisplay::updateAlpha() - { - alpha_ = alpha_property_->getFloat(); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } +void CameraInfoDisplay::updateEdgeColor() +{ + edge_color_ = edge_color_property_->getColor(); + if (camera_info_) { + createCameraInfoShapes(camera_info_); } +} - void CameraInfoDisplay::updateFarClipDistance() - { - far_clip_distance_ = far_clip_distance_property_->getFloat(); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } +void CameraInfoDisplay::updateAlpha() +{ + alpha_ = alpha_property_->getFloat(); + if (camera_info_) { + createCameraInfoShapes(camera_info_); } +} - void CameraInfoDisplay::updateShowPolygons() - { - show_polygons_ = show_polygons_property_->getBool(); - if (show_polygons_) { - not_show_side_polygons_property_->show(); - } - else { - not_show_side_polygons_property_->hide(); - } - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } +void CameraInfoDisplay::updateFarClipDistance() +{ + far_clip_distance_ = far_clip_distance_property_->getFloat(); + if (camera_info_) { + createCameraInfoShapes(camera_info_); + } +} + +void CameraInfoDisplay::updateShowPolygons() +{ + show_polygons_ = show_polygons_property_->getBool(); + if (show_polygons_) { + not_show_side_polygons_property_->show(); + } else { + not_show_side_polygons_property_->hide(); } + if (camera_info_) { + createCameraInfoShapes(camera_info_); + } +} - void CameraInfoDisplay::updateShowEdges() - { - show_edges_ = show_edges_property_->getBool(); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } +void CameraInfoDisplay::updateShowEdges() +{ + show_edges_ = show_edges_property_->getBool(); + if (camera_info_) { + createCameraInfoShapes(camera_info_); } +} - void CameraInfoDisplay::updateImageTopic() - { - if (use_image_) { - std::string topic = image_topic_property_->getStdString(); - subscribeImage(topic); - } else { - image_sub_.shutdown(); - // Set image_updated_ true in order to clear the bottom texture in update() method. - image_updated_ = true; - } +void CameraInfoDisplay::updateImageTopic() +{ + if (use_image_) { + std::string topic = image_topic_property_->getStdString(); + subscribeImage(topic); + } else { + image_sub_.shutdown(); + // Set image_updated_ true in order to clear the bottom texture in update() method. + image_updated_ = true; } +} - void CameraInfoDisplay::updateUseImage() - { - use_image_ = use_image_property_->getBool(); - if (use_image_) { - image_topic_property_->show(); - image_transport_hints_property_->show(); - } - else { - image_topic_property_->hide(); - image_transport_hints_property_->hide(); - } - updateImageTopic(); +void CameraInfoDisplay::updateUseImage() +{ + use_image_ = use_image_property_->getBool(); + if (use_image_) { + image_topic_property_->show(); + image_transport_hints_property_->show(); + } else { + image_topic_property_->hide(); + image_transport_hints_property_->hide(); } - void CameraInfoDisplay::updateNotShowSidePolygons() - { - not_show_side_polygons_ = not_show_side_polygons_property_->getBool(); - if (camera_info_) { - createCameraInfoShapes(camera_info_); - } + updateImageTopic(); +} +void CameraInfoDisplay::updateNotShowSidePolygons() +{ + not_show_side_polygons_ = not_show_side_polygons_property_->getBool(); + if (camera_info_) { + createCameraInfoShapes(camera_info_); } } +} // namespace jsk_rviz_plugins #include -PLUGINLIB_EXPORT_CLASS( jsk_rviz_plugins::CameraInfoDisplay, rviz_common::Display ) +PLUGINLIB_EXPORT_CLASS(jsk_rviz_plugins::CameraInfoDisplay, rviz_common::Display) diff --git a/jsk_rviz_plugins/src/camera_info_display.hpp b/jsk_rviz_plugins/src/camera_info_display.hpp index 54b94f12..932471e9 100644 --- a/jsk_rviz_plugins/src/camera_info_display.hpp +++ b/jsk_rviz_plugins/src/camera_info_display.hpp @@ -31,143 +31,138 @@ // ROS 2 Port: // Ander González Tomé @ IKERLAN S. COOP. -#ifndef JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_H_ -#define JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_H_ +#ifndef JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_HPP_ +#define JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_HPP_ #ifndef Q_MOC_RUN -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include #include -#include +#include #include +#include #include -#include + #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "image_transport_hints_property.hpp" #endif namespace jsk_rviz_plugins { - class TrianglePolygon - { - public: - typedef std::shared_ptr Ptr; - TrianglePolygon(Ogre::SceneManager* manager, - Ogre::SceneNode* node, - const cv::Point3d& O, - const cv::Point3d& A, - const cv::Point3d& B, - const std::string& name, - const Ogre::ColourValue& color, - bool use_color, - bool upper_triangle); - ~TrianglePolygon(); - protected: - Ogre::ManualObject* manual_; - Ogre::SceneManager* manager_; - private: +class TrianglePolygon +{ +public: + typedef std::shared_ptr Ptr; + TrianglePolygon( + Ogre::SceneManager * manager, Ogre::SceneNode * node, const cv::Point3d & O, + const cv::Point3d & A, const cv::Point3d & B, const std::string & name, + const Ogre::ColourValue & color, bool use_color, bool upper_triangle); + ~TrianglePolygon(); + +protected: + Ogre::ManualObject * manual_; + Ogre::SceneManager * manager_; - }; +private: +}; - class CameraInfoDisplay: - public rviz_common::RosTopicDisplay - { - Q_OBJECT - public: - typedef std::shared_ptr ShapePtr; - typedef std::shared_ptr BillboardLinePtr; - CameraInfoDisplay(); - ~CameraInfoDisplay(); +class CameraInfoDisplay : public rviz_common::RosTopicDisplay +{ + Q_OBJECT +public: + typedef std::shared_ptr ShapePtr; + typedef std::shared_ptr BillboardLinePtr; + CameraInfoDisplay(); + ~CameraInfoDisplay(); - protected: - //////////////////////////////////////////////////////// - // methods required by super class - //////////////////////////////////////////////////////// - void onInitialize() override; - void reset(); - void processMessage(sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) override; - //////////////////////////////////////////////////////// - // methods - /////////////////////////////////////////////////////// - void update(float wall_dt, float ros_dt) override; - bool isSameCameraInfo( - sensor_msgs::msg::CameraInfo::ConstSharedPtr camera_info); - void createCameraInfoShapes( - sensor_msgs::msg::CameraInfo::ConstSharedPtr camera_info); - void addPointToEdge( - const cv::Point3d& point); - void addPolygon( - const cv::Point3d& O, const cv::Point3d& A, const cv::Point3d& B, std::string name, - bool use_color, bool upper_triangle); - void prepareMaterial(); - void createTextureForBottom(int width, int height); - void imageCallback(const sensor_msgs::msg::Image::ConstSharedPtr& msg); - void drawImageTexture(); - void subscribeImage(std::string topic); - ///////////////////////////////////////////////////////// - // variables - //////////////////////////////////////////////////////// - std::vector polygons_; - BillboardLinePtr edges_; - sensor_msgs::msg::CameraInfo::ConstSharedPtr camera_info_; - Ogre::MaterialPtr material_; - Ogre::TexturePtr texture_; - Ogre::MaterialPtr material_bottom_; - Ogre::TexturePtr bottom_texture_; - image_transport::Subscriber image_sub_; - std::mutex mutex_; - rclcpp::Node::SharedPtr node_; - //////////////////////////////////////////////////////// - // variables updated by rviz properties - //////////////////////////////////////////////////////// - double alpha_; - double far_clip_distance_; - QColor color_; - QColor edge_color_; - bool show_polygons_; - bool show_edges_; - bool use_image_; - bool image_updated_; - bool not_show_side_polygons_; - cv::Mat image_; - //////////////////////////////////////////////////////// - // properties - //////////////////////////////////////////////////////// - ImageTransportHintsProperty* image_transport_hints_property_; - rviz_common::properties::FloatProperty* far_clip_distance_property_; - rviz_common::properties::FloatProperty* alpha_property_; - rviz_common::properties::ColorProperty* color_property_; - rviz_common::properties::ColorProperty* edge_color_property_; - rviz_common::properties::BoolProperty* show_polygons_property_; - rviz_common::properties::BoolProperty* not_show_side_polygons_property_; - rviz_common::properties::BoolProperty* use_image_property_; - rviz_common::properties::RosTopicProperty* image_topic_property_; - rviz_common::properties::BoolProperty* show_edges_property_; +protected: + //////////////////////////////////////////////////////// + // methods required by super class + //////////////////////////////////////////////////////// + void onInitialize() override; + void reset(); + void processMessage(sensor_msgs::msg::CameraInfo::ConstSharedPtr msg) override; + //////////////////////////////////////////////////////// + // methods + /////////////////////////////////////////////////////// + void update(float wall_dt, float ros_dt) override; + bool isSameCameraInfo(sensor_msgs::msg::CameraInfo::ConstSharedPtr camera_info); + void createCameraInfoShapes(sensor_msgs::msg::CameraInfo::ConstSharedPtr camera_info); + void addPointToEdge(const cv::Point3d & point); + void addPolygon( + const cv::Point3d & O, const cv::Point3d & A, const cv::Point3d & B, std::string name, + bool use_color, bool upper_triangle); + void prepareMaterial(); + void createTextureForBottom(int width, int height); + void imageCallback(const sensor_msgs::msg::Image::ConstSharedPtr & msg); + void drawImageTexture(); + void subscribeImage(std::string topic); + ///////////////////////////////////////////////////////// + // variables + //////////////////////////////////////////////////////// + std::vector polygons_; + BillboardLinePtr edges_; + sensor_msgs::msg::CameraInfo::ConstSharedPtr camera_info_; + Ogre::MaterialPtr material_; + Ogre::TexturePtr texture_; + Ogre::MaterialPtr material_bottom_; + Ogre::TexturePtr bottom_texture_; + image_transport::Subscriber image_sub_; + std::mutex mutex_; + rclcpp::Node::SharedPtr node_; + //////////////////////////////////////////////////////// + // variables updated by rviz properties + //////////////////////////////////////////////////////// + double alpha_; + double far_clip_distance_; + QColor color_; + QColor edge_color_; + bool show_polygons_; + bool show_edges_; + bool use_image_; + bool image_updated_; + bool not_show_side_polygons_; + cv::Mat image_; + //////////////////////////////////////////////////////// + // properties + //////////////////////////////////////////////////////// + ImageTransportHintsProperty * image_transport_hints_property_; + rviz_common::properties::FloatProperty * far_clip_distance_property_; + rviz_common::properties::FloatProperty * alpha_property_; + rviz_common::properties::ColorProperty * color_property_; + rviz_common::properties::ColorProperty * edge_color_property_; + rviz_common::properties::BoolProperty * show_polygons_property_; + rviz_common::properties::BoolProperty * not_show_side_polygons_property_; + rviz_common::properties::BoolProperty * use_image_property_; + rviz_common::properties::RosTopicProperty * image_topic_property_; + rviz_common::properties::BoolProperty * show_edges_property_; - protected Q_SLOTS: - void updateFarClipDistance(); - void updateAlpha(); - void updateColor(); - void updateShowEdges(); - void updateShowPolygons(); - void updateNotShowSidePolygons(); - void updateImageTopic(); - void updateUseImage(); - void updateEdgeColor(); - }; +protected Q_SLOTS: + void updateFarClipDistance(); + void updateAlpha(); + void updateColor(); + void updateShowEdges(); + void updateShowPolygons(); + void updateNotShowSidePolygons(); + void updateImageTopic(); + void updateUseImage(); + void updateEdgeColor(); +}; -} +} // namespace jsk_rviz_plugins -#endif +#endif // JSK_RVIZ_PLUGINS_CAMERA_INFO_DISPLAY_HPP_ diff --git a/jsk_rviz_plugins/src/image_transport_hints_property.cpp b/jsk_rviz_plugins/src/image_transport_hints_property.cpp index 99374033..f9e13aa1 100644 --- a/jsk_rviz_plugins/src/image_transport_hints_property.cpp +++ b/jsk_rviz_plugins/src/image_transport_hints_property.cpp @@ -3,13 +3,14 @@ #include "image_transport_hints_property.hpp" -namespace jsk_rviz_plugins { +namespace jsk_rviz_plugins +{ -ImageTransportHintsProperty::ImageTransportHintsProperty(const char* name, - const char* description, - rviz_common::properties::Property* parent, - const char* changed_slot) - : rviz_common::properties::EditableEnumProperty(name, "raw", description, parent, changed_slot) { +ImageTransportHintsProperty::ImageTransportHintsProperty( + const char * name, const char * description, rviz_common::properties::Property * parent, + const char * changed_slot) +: rviz_common::properties::EditableEnumProperty(name, "raw", description, parent, changed_slot) +{ addOptionStd("raw"); addOptionStd("compressed"); addOptionStd("theora"); @@ -18,8 +19,10 @@ ImageTransportHintsProperty::ImageTransportHintsProperty(const char* name, ImageTransportHintsProperty::~ImageTransportHintsProperty() {} -image_transport::TransportHints ImageTransportHintsProperty::getTransportHints(const rclcpp::Node * node) { +image_transport::TransportHints ImageTransportHintsProperty::getTransportHints( + const rclcpp::Node * node) +{ return image_transport::TransportHints(node, getStdString()); } -} \ No newline at end of file +} // namespace jsk_rviz_plugins diff --git a/jsk_rviz_plugins/src/image_transport_hints_property.hpp b/jsk_rviz_plugins/src/image_transport_hints_property.hpp index f2db687d..25f04b6d 100644 --- a/jsk_rviz_plugins/src/image_transport_hints_property.hpp +++ b/jsk_rviz_plugins/src/image_transport_hints_property.hpp @@ -1,24 +1,26 @@ // ROS 2 Port: // Ander González Tomé @ IKERLAN S. COOP. -#ifndef JSK_RVIZ_PLUGINS_IMAGE_TRANSPORT_HINTS_PROPERTY_HPP -#define JSK_RVIZ_PLUGINS_IMAGE_TRANSPORT_HINTS_PROPERTY_HPP +#ifndef JSK_RVIZ_PLUGINS_IMAGE_TRANSPORT_HINTS_PROPERTY_HPP_ +#define JSK_RVIZ_PLUGINS_IMAGE_TRANSPORT_HINTS_PROPERTY_HPP_ -#include -#include #include +#include +#include -namespace jsk_rviz_plugins { +namespace jsk_rviz_plugins +{ class ImageTransportHintsProperty : public rviz_common::properties::EditableEnumProperty { Q_OBJECT - public: - ImageTransportHintsProperty(const char* name, const char* description, - rviz_common::properties::Property* parent, const char* changed_slot); +public: + ImageTransportHintsProperty( + const char * name, const char * description, rviz_common::properties::Property * parent, + const char * changed_slot); ~ImageTransportHintsProperty(); image_transport::TransportHints getTransportHints(const rclcpp::Node * node); }; -} -#endif \ No newline at end of file +} // namespace jsk_rviz_plugins +#endif // JSK_RVIZ_PLUGINS_IMAGE_TRANSPORT_HINTS_PROPERTY_HPP_ From 7efb2ce9fef06b424ebe43cd94eb773d96d8c85d Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Mon, 19 Feb 2024 07:39:48 +0000 Subject: [PATCH 7/9] Add copyright --- .../src/image_transport_hints_property.cpp | 33 +++++++++++++++++-- .../src/image_transport_hints_property.hpp | 31 ++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/jsk_rviz_plugins/src/image_transport_hints_property.cpp b/jsk_rviz_plugins/src/image_transport_hints_property.cpp index f9e13aa1..08ffbd86 100644 --- a/jsk_rviz_plugins/src/image_transport_hints_property.cpp +++ b/jsk_rviz_plugins/src/image_transport_hints_property.cpp @@ -1,3 +1,33 @@ +// // -*- mode: c++ -*- +// Copyright (c) 2014, JSK Lab +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of the JSK Lab nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + // ROS 2 Port: // Ander González Tomé @ IKERLAN S. COOP. @@ -5,6 +35,7 @@ namespace jsk_rviz_plugins { +ImageTransportHintsProperty::~ImageTransportHintsProperty() {} ImageTransportHintsProperty::ImageTransportHintsProperty( const char * name, const char * description, rviz_common::properties::Property * parent, @@ -17,8 +48,6 @@ ImageTransportHintsProperty::ImageTransportHintsProperty( setStdString("raw"); } -ImageTransportHintsProperty::~ImageTransportHintsProperty() {} - image_transport::TransportHints ImageTransportHintsProperty::getTransportHints( const rclcpp::Node * node) { diff --git a/jsk_rviz_plugins/src/image_transport_hints_property.hpp b/jsk_rviz_plugins/src/image_transport_hints_property.hpp index 25f04b6d..f1009164 100644 --- a/jsk_rviz_plugins/src/image_transport_hints_property.hpp +++ b/jsk_rviz_plugins/src/image_transport_hints_property.hpp @@ -1,3 +1,33 @@ +// // -*- mode: c++ -*- +// Copyright (c) 2014, JSK Lab +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of the JSK Lab nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + // ROS 2 Port: // Ander González Tomé @ IKERLAN S. COOP. @@ -10,7 +40,6 @@ namespace jsk_rviz_plugins { - class ImageTransportHintsProperty : public rviz_common::properties::EditableEnumProperty { Q_OBJECT From ba7c31f2493bac4f76f2f86b7b01247a0bb26ee9 Mon Sep 17 00:00:00 2001 From: Ander Gonzalez Date: Mon, 19 Feb 2024 09:26:39 +0000 Subject: [PATCH 8/9] Also set the alpha for the bottom plane --- jsk_rviz_plugins/src/camera_info_display.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/jsk_rviz_plugins/src/camera_info_display.cpp b/jsk_rviz_plugins/src/camera_info_display.cpp index 479c6da8..0ef459e5 100644 --- a/jsk_rviz_plugins/src/camera_info_display.cpp +++ b/jsk_rviz_plugins/src/camera_info_display.cpp @@ -353,6 +353,7 @@ void CameraInfoDisplay::drawImageTexture() cv::merge(splitted, boxMat); } else { memset(pDest, 0, bottom_texture_->getWidth() * bottom_texture_->getHeight()); + color_.setAlphaF(alpha_); QImage Hud( pDest, bottom_texture_->getWidth(), bottom_texture_->getHeight(), QImage::Format_ARGB32); for (size_t j = 0; j < bottom_texture_->getHeight(); j++) { From 68b65c8ce2b9069efdc69cd1704bb03b7657f1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ander=20Gonz=C3=A1lez?= Date: Thu, 16 Apr 2026 08:28:05 +0200 Subject: [PATCH 9/9] jazzy compatibility minimal changes --- jsk_rviz_plugins/CMakeLists.txt | 6 ------ jsk_rviz_plugins/src/camera_info_display.cpp | 2 +- jsk_rviz_plugins/src/camera_info_display.hpp | 2 +- jsk_rviz_plugins/src/overlay_image_display.cpp | 2 +- jsk_topic_tools/CMakeLists.txt | 5 ----- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/jsk_rviz_plugins/CMakeLists.txt b/jsk_rviz_plugins/CMakeLists.txt index 6f83d649..08e7306f 100644 --- a/jsk_rviz_plugins/CMakeLists.txt +++ b/jsk_rviz_plugins/CMakeLists.txt @@ -143,12 +143,6 @@ ament_target_dependencies(jsk_rviz_plugins # $ # ) -if (NOT WIN32) - ament_environment_hooks( - "${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}" - ) -endif() - # Link non ament packages target_link_libraries(jsk_rviz_plugins Qt5::Widgets) diff --git a/jsk_rviz_plugins/src/camera_info_display.cpp b/jsk_rviz_plugins/src/camera_info_display.cpp index 0ef459e5..9e0dca86 100644 --- a/jsk_rviz_plugins/src/camera_info_display.cpp +++ b/jsk_rviz_plugins/src/camera_info_display.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/jsk_rviz_plugins/src/camera_info_display.hpp b/jsk_rviz_plugins/src/camera_info_display.hpp index 932471e9..f8a4a18e 100644 --- a/jsk_rviz_plugins/src/camera_info_display.hpp +++ b/jsk_rviz_plugins/src/camera_info_display.hpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/jsk_rviz_plugins/src/overlay_image_display.cpp b/jsk_rviz_plugins/src/overlay_image_display.cpp index 9eaa8759..a4da0fb9 100644 --- a/jsk_rviz_plugins/src/overlay_image_display.cpp +++ b/jsk_rviz_plugins/src/overlay_image_display.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include diff --git a/jsk_topic_tools/CMakeLists.txt b/jsk_topic_tools/CMakeLists.txt index 76a6667d..600f50bb 100644 --- a/jsk_topic_tools/CMakeLists.txt +++ b/jsk_topic_tools/CMakeLists.txt @@ -47,11 +47,6 @@ target_include_directories(jsk_topic_tools_node $ $) -if (NOT WIN32) - ament_environment_hooks( - "${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}") -endif() - ament_export_targets(export_jsk_topic_tools_node HAS_LIBRARY_TARGET) ament_export_dependencies(rclcpp) ament_export_libraries(jsk_topic_tools_node)