Skip to content

Commit

Permalink
update 1028
Browse files Browse the repository at this point in the history
  • Loading branch information
Ar-Ray-code committed Oct 28, 2024
1 parent 6620462 commit c43a94f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
22 changes: 4 additions & 18 deletions button_rviz_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -37,4 +23,4 @@ if(BUILD_TESTING)
ament_lint_auto_find_test_dependencies()
endif()

ament_package()
ament_auto_package()
File renamed without changes.
3 changes: 2 additions & 1 deletion button_rviz_plugin/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>rviz_common</depend>
<depend>rviz_rendering</depend>
<depend>std_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
22 changes: 6 additions & 16 deletions button_rviz_plugin/src/button_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@

#include "button_panel.hpp"

#include <rviz_common/config.hpp>
#include <rviz_common/display_context.hpp>

#include <QPainter>
#include <QMouseEvent>
#include <QSizePolicy>

namespace button_rviz_plugin
{
EmptyButton::EmptyButton(QWidget * parent)
Expand All @@ -34,29 +27,26 @@ 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()
{
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)
Expand Down
12 changes: 10 additions & 2 deletions button_rviz_plugin/src/button_panel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@

#pragma once

#include <QtWidgets>
#include <QComboBox>
#include <QMouseEvent>
#include <QPainter>
#include <QSizePolicy>

#include <QtWidgets>

// 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 <rviz_common/panel.hpp>

#include <rviz_common/config.hpp>
#include <rviz_common/display_context.hpp>
#endif

namespace button_rviz_plugin
Expand Down

0 comments on commit c43a94f

Please sign in to comment.