From 7bc1d17888cdb9432f71c578269ca8024975155e Mon Sep 17 00:00:00 2001 From: Takayuki Murooka Date: Tue, 24 Dec 2024 13:32:56 +0900 Subject: [PATCH] update Signed-off-by: Takayuki Murooka --- .../CMakeLists.txt | 119 +++--------------- .../package.xml | 2 +- .../plugins_description.xml | 2 +- ...cpp => string_stamped_overlay_display.cpp} | 12 +- ...hpp => string_stamped_overlay_display.hpp} | 19 +-- 5 files changed, 34 insertions(+), 120 deletions(-) rename visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/{string_stamped.cpp => string_stamped_overlay_display.cpp} (95%) rename visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/{string_stamped.hpp => string_stamped_overlay_display.hpp} (85%) diff --git a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/CMakeLists.txt b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/CMakeLists.txt index f42495e455ddd..6de4041243923 100644 --- a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/CMakeLists.txt +++ b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/CMakeLists.txt @@ -2,116 +2,27 @@ cmake_minimum_required(VERSION 3.8) project(autoware_string_stamped_rviz_plugin) # find dependencies -find_package(ament_cmake_auto REQUIRED) -ament_auto_find_build_dependencies() +find_package(autoware_cmake REQUIRED) +autoware_package() -set(headers_to_moc - include/signal_display.hpp -) - -set(headers_to_not_moc - include/steering_wheel_display.hpp - include/gear_display.hpp - include/speed_display.hpp - include/turn_signals_display.hpp - include/traffic_display.hpp - include/speed_limit_display.hpp -) - - -foreach(header "${headers_to_moc}") - qt5_wrap_cpp(display_moc_files "${header}") -endforeach() - -set(display_source_files - src/overlay_utils.cpp - src/signal_display.cpp - src/steering_wheel_display.cpp - src/gear_display.cpp - src/speed_display.cpp - src/turn_signals_display.cpp - src/traffic_display.cpp - src/speed_limit_display.cpp -) - -add_library(${PROJECT_NAME} SHARED - ${display_moc_files} - ${headers_to_not_moc} - ${display_source_files} -) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) -target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic) +find_package(Qt5 REQUIRED Core Widgets) +set(QT_LIBRARIES Qt5::Widgets) +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +add_definitions(-DQT_NO_KEYWORDS) -target_include_directories( - ${PROJECT_NAME} PUBLIC - $ - $ - ${Qt5Widgets_INCLUDE_DIRS} - ${OpenCV_INCLUDE_DIRS} +ament_auto_add_library(${PROJECT_NAME}_lib SHARED + DIRECTORY src ) -target_link_libraries( - ${PROJECT_NAME} PUBLIC - rviz_ogre_vendor::OgreMain - rviz_ogre_vendor::OgreOverlay +target_link_libraries(${PROJECT_NAME}_lib + ${QT_LIBRARIES} ) - -target_compile_definitions(${PROJECT_NAME} PRIVATE "${PROJECT_NAME}_BUILDING_LIBRARY") - -# prevent pluginlib from using boost -target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") - +# Export the plugin to be imported by rviz2 pluginlib_export_plugin_description_file(rviz_common plugins_description.xml) -ament_target_dependencies(${PROJECT_NAME} PUBLIC - rviz_common - rviz_rendering - autoware_vehicle_msgs - tier4_planning_msgs - autoware_perception_msgs -) - -ament_export_include_directories(include) -ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET) -ament_export_dependencies( - rviz_common - rviz_ogre_vendor -) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() -endif() - -install( - TARGETS ${PROJECT_NAME} - EXPORT ${PROJECT_NAME} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include -) - -install( - DIRECTORY include/ - DESTINATION include -) - -install( - TARGETS - DESTINATION lib/${PROJECT_NAME} -) - -# Copy the assets directory to the installation directory -install( - DIRECTORY assets/ - DESTINATION share/${PROJECT_NAME}/assets -) - -add_definitions(-DQT_NO_KEYWORDS) - -ament_package( - CONFIG_EXTRAS "autoware_string_stamped_rviz_plugin-extras.cmake" +ament_auto_package( + INSTALL_TO_SHARE + plugins_description.xml ) diff --git a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/package.xml b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/package.xml index be18156ac40d9..77d8f0797a615 100644 --- a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/package.xml +++ b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/package.xml @@ -12,13 +12,13 @@ BSD-3-Clause ament_index_cpp + autoware_internal_debug_msgs autoware_perception_msgs autoware_vehicle_msgs boost rviz_common rviz_ogre_vendor rviz_rendering - tier4_planning_msgs ament_lint_auto autoware_lint_common diff --git a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/plugins_description.xml b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/plugins_description.xml index 05ef72b7b2ea3..247c278f0d4ae 100644 --- a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/plugins_description.xml +++ b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/plugins_description.xml @@ -1,5 +1,5 @@ - + String staped overlay plugin for the 3D view. diff --git a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped.cpp b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped_overlay_display.cpp similarity index 95% rename from visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped.cpp rename to visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped_overlay_display.cpp index a9c4181c5fbea..e76bc85cb2f32 100644 --- a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped.cpp +++ b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped_overlay_display.cpp @@ -45,9 +45,10 @@ // POSSIBILITY OF SUCH DAMAGE.S SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#include "jsk_overlay_utils.hpp" #include "string_stamped_overlay_display.hpp" +#include "jsk_overlay_utils.hpp" + #include #include @@ -58,7 +59,7 @@ #include #include -namespace rviz_plugins +namespace autoware::string_stamped_rviz_plugin { StringStampedOverlayDisplay::StringStampedOverlayDisplay() { @@ -169,7 +170,7 @@ void StringStampedOverlayDisplay::update(float wall_dt, float ros_dt) } void StringStampedOverlayDisplay::processMessage( - const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) + const autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) { if (!isEnabled()) { return; @@ -191,7 +192,8 @@ void StringStampedOverlayDisplay::updateVisualization() overlay_->setDimensions(overlay_->getTextureWidth(), overlay_->getTextureHeight()); } -} // namespace rviz_plugins +} // namespace autoware::string_stamped_rviz_plugin #include -PLUGINLIB_EXPORT_CLASS(rviz_plugins::StringStampedOverlayDisplay, rviz_common::Display) +PLUGINLIB_EXPORT_CLASS( + autoware::string_stamped_rviz_plugin::StringStampedOverlayDisplay, rviz_common::Display) diff --git a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped.hpp b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped_overlay_display.hpp similarity index 85% rename from visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped.hpp rename to visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped_overlay_display.hpp index c197bf6a361a3..7d4f2a13d5659 100644 --- a/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped.hpp +++ b/visualization/autoware_overlay_rviz_plugin/autoware_string_stamped_overlay_rviz_plugin/src/string_stamped_overlay_display.hpp @@ -45,8 +45,8 @@ // POSSIBILITY OF SUCH DAMAGE.S SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#ifndef STRING_STAMPED_HPP_ -#define STRING_STAMPED_HPP_ +#ifndef STRING_STAMPED_OVERLAY_DISPLAY_HPP_ +#define STRING_STAMPED_OVERLAY_DISPLAY_HPP_ #include #include @@ -61,12 +61,12 @@ #endif -#include +#include -namespace rviz_plugins +namespace autoware::string_stamped_rviz_plugin { class StringStampedOverlayDisplay -: public rviz_common::RosTopicDisplay +: public rviz_common::RosTopicDisplay { Q_OBJECT @@ -84,7 +84,8 @@ private Q_SLOTS: protected: void update(float wall_dt, float ros_dt) override; - void processMessage(const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) override; + void processMessage( + const autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) override; jsk_rviz_plugins::OverlayObject::Ptr overlay_; rviz_common::properties::ColorProperty * property_text_color_; rviz_common::properties::IntProperty * property_left_; @@ -100,8 +101,8 @@ private Q_SLOTS: static constexpr int hand_width_ = 4; std::mutex mutex_; - tier4_debug_msgs::msg::StringStamped::ConstSharedPtr last_msg_ptr_; + autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr last_msg_ptr_; }; -} // namespace rviz_plugins +} // namespace autoware::string_stamped_rviz_plugin -#endif // STRING_STAMPED_HPP_ +#endif // STRING_STAMPED_OVERLAY_DISPLAY_HPP_