diff --git a/button_rviz_plugin/CMakeLists.txt b/button_rviz_plugin/CMakeLists.txt index a4ff67b..9e5fa40 100644 --- a/button_rviz_plugin/CMakeLists.txt +++ b/button_rviz_plugin/CMakeLists.txt @@ -5,28 +5,14 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rviz_common REQUIRED) -find_package(rviz_rendering REQUIRED) +find_package(ament_cmake_auto REQUIRED) +ament_auto_find_build_dependencies() set(CMAKE_AUTOMOC ON) -add_library(${PROJECT_NAME} SHARED +ament_auto_add_library(${PROJECT_NAME} SHARED src/button_panel.cpp ) -ament_target_dependencies(${PROJECT_NAME} - rviz_common - rviz_rendering -) -install(TARGETS - ${PROJECT_NAME} - EXPORT ${PROJECT_NAME} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include -) pluginlib_export_plugin_description_file(rviz_common plugins_description.xml) @@ -37,4 +23,4 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() -ament_package() +ament_auto_package() diff --git a/button_rviz_plugin/src/button_handler.hpp b/button_rviz_plugin/include/button_rviz_plugin/button_handler.hpp similarity index 100% rename from button_rviz_plugin/src/button_handler.hpp rename to button_rviz_plugin/include/button_rviz_plugin/button_handler.hpp diff --git a/button_rviz_plugin/package.xml b/button_rviz_plugin/package.xml index 20b584c..bd2ccb9 100644 --- a/button_rviz_plugin/package.xml +++ b/button_rviz_plugin/package.xml @@ -7,10 +7,11 @@ Ar-Ray-code MIT - ament_cmake + ament_cmake_auto rviz_common rviz_rendering + std_msgs ament_lint_auto ament_lint_common diff --git a/button_rviz_plugin/src/button_panel.cpp b/button_rviz_plugin/src/button_panel.cpp index 9bdef5b..c664d56 100644 --- a/button_rviz_plugin/src/button_panel.cpp +++ b/button_rviz_plugin/src/button_panel.cpp @@ -14,13 +14,6 @@ #include "button_panel.hpp" -#include -#include - -#include -#include -#include - namespace button_rviz_plugin { EmptyButton::EmptyButton(QWidget * parent) @@ -34,22 +27,13 @@ EmptyButton::EmptyButton(QWidget * parent) topic_combo_ = new QComboBox(); topic_combo_->setEditable(true); layout_1st->addWidget(topic_combo_); - // layout->addLayout(layout_1st); - // QHBoxLayout * layout_3rd = new QHBoxLayout; a_button_ = new QPushButton("click"); layout_1st->addWidget(a_button_); layout->addLayout(layout_1st); - setLayout(layout); interval_timer_ = new QTimer(this); - - connect(interval_timer_, &QTimer::timeout, this, &EmptyButton::onTick); - connect(enable_check_, &QCheckBox::stateChanged, this, &EmptyButton::onCheckChange); - connect(a_button_, &QPushButton::clicked, this, &EmptyButton::onClickA); - - interval_timer_->start(100); } void EmptyButton::onInitialize() @@ -57,6 +41,12 @@ void EmptyButton::onInitialize() button_handler_.setRosNodePtr( this->getDisplayContext()->getRosNodeAbstraction().lock()->get_raw_node()); updateTopicList(); + + connect(interval_timer_, &QTimer::timeout, this, &EmptyButton::onTick); + connect(enable_check_, &QCheckBox::stateChanged, this, &EmptyButton::onCheckChange); + connect(a_button_, &QPushButton::clicked, this, &EmptyButton::onClickA); + + interval_timer_->start(100); } void EmptyButton::onCheckChange(int state) diff --git a/button_rviz_plugin/src/button_panel.hpp b/button_rviz_plugin/src/button_panel.hpp index e3f6e04..72d9cf4 100644 --- a/button_rviz_plugin/src/button_panel.hpp +++ b/button_rviz_plugin/src/button_panel.hpp @@ -14,12 +14,20 @@ #pragma once -#include #include +#include +#include +#include + +#include +// Q_MOC_RUN is defined when this file is processed by moc #ifndef Q_MOC_RUN -#include "button_handler.hpp" +#include "button_rviz_plugin/button_handler.hpp" #include + +#include +#include #endif namespace button_rviz_plugin