-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rviz): add new plugin to show string stamped
Signed-off-by: satoshi-ota <[email protected]>
- Loading branch information
1 parent
5049ea7
commit 97d3c76
Showing
9 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
project(tier4_string_viewer_rviz_plugin) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
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) | ||
|
||
ament_auto_add_library(${PROJECT_NAME} SHARED | ||
src/string_viewer_panel.hpp | ||
src/string_viewer_panel.cpp | ||
) | ||
target_link_libraries(${PROJECT_NAME} | ||
${QT_LIBRARIES} | ||
) | ||
pluginlib_export_plugin_description_file(rviz_common plugins/plugin_description.xml) | ||
|
||
ament_auto_package( | ||
INSTALL_TO_SHARE | ||
icons | ||
plugins | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# tier4_datetime_rviz_plugin | ||
|
||
## Purpose | ||
|
||
This plugin displays the ROS Time and Wall Time in rviz. | ||
|
||
## Assumptions / Known limits | ||
|
||
TBD. | ||
|
||
## Usage | ||
|
||
1. Start rviz and select panels/Add new panel. | ||
![select_panel](./images/select_panels.png) | ||
2. Select tier4_datetime_rviz_plugin/AutowareDateTimePanel and press OK. | ||
![select_datetime_plugin](./images/select_datetime_plugin.png) |
Binary file added
BIN
+561 Bytes
common/tier4_string_viewer_rviz_plugin/icons/classes/AutowareDateTimePanel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+65.3 KB
common/tier4_string_viewer_rviz_plugin/images/select_datetime_plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>tier4_string_viewer_rviz_plugin</name> | ||
<version>0.0.0</version> | ||
<description>The tier4_string_viewer_rviz_plugin package</description> | ||
<maintainer email="[email protected]">Takagi, Isamu</maintainer> | ||
<license>Apache License 2.0</license> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
<buildtool_depend>autoware_cmake</buildtool_depend> | ||
|
||
<depend>libqt5-core</depend> | ||
<depend>libqt5-gui</depend> | ||
<depend>libqt5-widgets</depend> | ||
<depend>qtbase5-dev</depend> | ||
<depend>rclcpp</depend> | ||
<depend>rviz_common</depend> | ||
<depend>tier4_debug_msgs</depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>autoware_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
<rviz plugin="${prefix}/plugins/plugin_description.xml"/> | ||
</export> | ||
</package> |
9 changes: 9 additions & 0 deletions
9
common/tier4_string_viewer_rviz_plugin/plugins/plugin_description.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<library path="tier4_string_viewer_rviz_plugin"> | ||
|
||
<class | ||
type="StringViewerPanel" | ||
base_class_type="rviz_common::Panel"> | ||
<description>StringViewerPanel</description> | ||
</class> | ||
|
||
</library> |
49 changes: 49 additions & 0 deletions
49
common/tier4_string_viewer_rviz_plugin/src/string_viewer_panel.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "string_viewer_panel.hpp" | ||
|
||
#include <QHBoxLayout> | ||
#include <QTimer> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <ctime> | ||
|
||
StringViewerPanel::StringViewerPanel(QWidget * parent) : rviz_common::Panel(parent) | ||
{ | ||
contents_ = new QLabel; | ||
|
||
auto * layout = new QHBoxLayout(this); | ||
layout->addWidget(contents_); | ||
setLayout(layout); | ||
} | ||
|
||
void StringViewerPanel::onInitialize() | ||
{ | ||
raw_node_ = this->getDisplayContext()->getRosNodeAbstraction().lock()->get_raw_node(); | ||
|
||
sub_string_ = raw_node_->create_subscription<tier4_debug_msgs::msg::StringStamped>( | ||
"/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner/debug/" | ||
"internal_state", | ||
rclcpp::QoS{1}, std::bind(&StringViewerPanel::on_string, this, std::placeholders::_1)); | ||
} | ||
|
||
void StringViewerPanel::on_string(const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg) | ||
{ | ||
contents_->setText(msg->data.c_str()); | ||
contents_->setWordWrap(true); | ||
} | ||
|
||
#include <pluginlib/class_list_macros.hpp> | ||
PLUGINLIB_EXPORT_CLASS(StringViewerPanel, rviz_common::Panel) |
46 changes: 46 additions & 0 deletions
46
common/tier4_string_viewer_rviz_plugin/src/string_viewer_panel.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef STRING_VIEWER_PANEL_HPP_ | ||
#define STRING_VIEWER_PANEL_HPP_ | ||
|
||
#include <QLabel> | ||
#include <rviz_common/display_context.hpp> | ||
#include <rviz_common/panel.hpp> | ||
#include <rviz_common/ros_integration/ros_node_abstraction_iface.hpp> | ||
|
||
#include <tier4_debug_msgs/msg/string_stamped.hpp> | ||
|
||
class QLineEdit; | ||
|
||
class StringViewerPanel : public rviz_common::Panel | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit StringViewerPanel(QWidget * parent = nullptr); | ||
|
||
void onInitialize() override; | ||
|
||
private: | ||
void on_string(const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg); | ||
|
||
QLabel * contents_; | ||
|
||
rclcpp::Node::SharedPtr raw_node_; | ||
|
||
rclcpp::Subscription<tier4_debug_msgs::msg::StringStamped>::SharedPtr sub_string_; | ||
}; | ||
|
||
#endif // STRING_VIEWER_PANEL_HPP_ |