-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/radar_object_clustering_param
- Loading branch information
Showing
99 changed files
with
3,246 additions
and
1,230 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
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
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,31 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
project(tier4_metrics_rviz_plugin) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
find_package(Qt5 REQUIRED Core Widgets Charts) | ||
set(QT_WIDGETS_LIB Qt5::Widgets) | ||
set(QT_CHARTS_LIB Qt5::Charts) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
add_definitions(-DQT_NO_KEYWORDS) | ||
|
||
ament_auto_add_library(${PROJECT_NAME} SHARED | ||
src/metrics_visualize_panel.cpp | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
${QT_WIDGETS_LIB} | ||
${QT_CHARTS_LIB} | ||
) | ||
|
||
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-error=deprecated-copy -Wno-error=pedantic) | ||
# Export the plugin to be imported by rviz2 | ||
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_metrics_rviz_plugin | ||
|
||
## Purpose | ||
|
||
This plugin panel to visualize `planning_evaluator` output. | ||
|
||
## Inputs / Outputs | ||
|
||
| Name | Type | Description | | ||
| ---------------------------------------- | --------------------------------------- | ------------------------------------- | | ||
| `/diagnostic/planning_evaluator/metrics` | `diagnostic_msgs::msg::DiagnosticArray` | Subscribe `planning_evaluator` output | | ||
|
||
## HowToUse | ||
|
||
1. Start rviz and select panels/Add new panel. | ||
2. Select MetricsVisualizePanel and press OK. |
Binary file added
BIN
+18.4 KB
evaluator/tier4_metrics_rviz_plugin/icons/classes/MetricsVisualizePanel.png
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,30 @@ | ||
<?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_metrics_rviz_plugin</name> | ||
<version>0.0.0</version> | ||
<description>The tier4_metrics_rviz_plugin package</description> | ||
<maintainer email="[email protected]">Satoshi OTA</maintainer> | ||
<maintainer email="[email protected]">Kyoichi Sugahara</maintainer> | ||
<maintainer email="[email protected]">Maxime CLEMENT</maintainer> | ||
<license>Apache License 2.0</license> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
<buildtool_depend>autoware_cmake</buildtool_depend> | ||
|
||
<depend>diagnostic_msgs</depend> | ||
<depend>libqt5-core</depend> | ||
<depend>libqt5-gui</depend> | ||
<depend>libqt5-widgets</depend> | ||
<depend>qtbase5-dev</depend> | ||
<depend>rclcpp</depend> | ||
<depend>rviz_common</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> |
5 changes: 5 additions & 0 deletions
5
evaluator/tier4_metrics_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,5 @@ | ||
<library path="tier4_metrics_rviz_plugin"> | ||
<class type="rviz_plugins::MetricsVisualizePanel" base_class_type="rviz_common::Panel"> | ||
<description>MetricsVisualizePanel</description> | ||
</class> | ||
</library> |
86 changes: 86 additions & 0 deletions
86
evaluator/tier4_metrics_rviz_plugin/src/metrics_visualize_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,86 @@ | ||
// Copyright 2024 TIER IV, Inc. All rights reserved. | ||
// | ||
// 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 "metrics_visualize_panel.hpp" | ||
|
||
#include <rviz_common/display_context.hpp> | ||
|
||
#include <X11/Xlib.h> | ||
|
||
#include <algorithm> | ||
#include <optional> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace rviz_plugins | ||
{ | ||
MetricsVisualizePanel::MetricsVisualizePanel(QWidget * parent) | ||
: rviz_common::Panel(parent), grid_(new QGridLayout()) | ||
{ | ||
setLayout(grid_); | ||
} | ||
|
||
void MetricsVisualizePanel::onInitialize() | ||
{ | ||
using std::placeholders::_1; | ||
|
||
raw_node_ = this->getDisplayContext()->getRosNodeAbstraction().lock()->get_raw_node(); | ||
|
||
sub_ = raw_node_->create_subscription<DiagnosticArray>( | ||
"/diagnostic/planning_evaluator/metrics", rclcpp::QoS{1}, | ||
std::bind(&MetricsVisualizePanel::onMetrics, this, _1)); | ||
|
||
const auto period = std::chrono::milliseconds(static_cast<int64_t>(1e3 / 10)); | ||
timer_ = raw_node_->create_wall_timer(period, [&]() { onTimer(); }); | ||
} | ||
|
||
void MetricsVisualizePanel::onTimer() | ||
{ | ||
std::lock_guard<std::mutex> message_lock(mutex_); | ||
|
||
for (auto & [name, metric] : metrics_) { | ||
metric.updateGraph(); | ||
metric.updateTable(); | ||
} | ||
} | ||
|
||
void MetricsVisualizePanel::onMetrics(const DiagnosticArray::ConstSharedPtr msg) | ||
{ | ||
std::lock_guard<std::mutex> message_lock(mutex_); | ||
|
||
const auto time = msg->header.stamp.sec + msg->header.stamp.nanosec * 1e-9; | ||
|
||
constexpr size_t GRAPH_COL_SIZE = 5; | ||
for (size_t i = 0; i < msg->status.size(); ++i) { | ||
const auto & status = msg->status.at(i); | ||
|
||
if (metrics_.count(status.name) == 0) { | ||
auto metric = Metric(status); | ||
metrics_.emplace(status.name, metric); | ||
grid_->addWidget(metric.getTable(), i / GRAPH_COL_SIZE * 2, i % GRAPH_COL_SIZE); | ||
grid_->setRowStretch(i / GRAPH_COL_SIZE * 2, false); | ||
grid_->addWidget(metric.getChartView(), i / GRAPH_COL_SIZE * 2 + 1, i % GRAPH_COL_SIZE); | ||
grid_->setRowStretch(i / GRAPH_COL_SIZE * 2 + 1, true); | ||
grid_->setColumnStretch(i % GRAPH_COL_SIZE, true); | ||
} | ||
|
||
metrics_.at(status.name).updateData(time, status); | ||
} | ||
} | ||
|
||
} // namespace rviz_plugins | ||
|
||
#include <pluginlib/class_list_macros.hpp> | ||
PLUGINLIB_EXPORT_CLASS(rviz_plugins::MetricsVisualizePanel, rviz_common::Panel) |
Oops, something went wrong.