From e423c83665a317ac94bf693bdb696d7b69e6712c Mon Sep 17 00:00:00 2001 From: h-ohta Date: Wed, 17 Aug 2022 16:58:07 +0900 Subject: [PATCH 1/9] refactor(tier4_localization_rviz_plugin): apply clang-tidy --- .../src/pose_history/pose_history_display.cpp | 7 ++----- .../src/pose_history/pose_history_display.hpp | 19 +++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp index f31eb833419fb..ccc9254006065 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp @@ -42,15 +42,12 @@ PoseHistory::PoseHistory() : last_stamp_(0, 0, RCL_ROS_TIME) property_line_width_->setMin(0.0); } -PoseHistory::~PoseHistory() -{ - // Properties are deleted by Qt -} +PoseHistory::~PoseHistory() = default; void PoseHistory::onInitialize() { MFDClass::onInitialize(); - lines_.reset(new rviz_rendering::BillboardLine(scene_manager_, scene_node_)); + lines_ = std::make_unique(scene_manager_, scene_node_); } void PoseHistory::onEnable() { subscribe(); } diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index cb107d4abdb75..e5a30946c74f9 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -27,16 +27,13 @@ namespace rviz_rendering { class BillboardLine; } // namespace rviz_rendering -namespace rviz_common -{ -namespace properties +namespace rviz_common::properties { class ColorProperty; class FloatProperty; class IntProperty; class BoolProperty; -} // namespace properties -} // namespace rviz_common +} // namespace rviz_common::properties namespace rviz_plugins { @@ -54,16 +51,14 @@ class PoseHistory : public rviz_common::MessageFilterDisplay history_; std::unique_ptr lines_; From 83861715cff635db058ea0e86687f80373fdbd01 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Aug 2022 08:00:42 +0000 Subject: [PATCH 2/9] ci(pre-commit): autofix --- .../src/pose_history/pose_history_display.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index e5a30946c74f9..c03b99dd9f7ad 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -58,7 +58,6 @@ class PoseHistory : public rviz_common::MessageFilterDisplay history_; std::unique_ptr lines_; From 96b963a994274923630e4e0f8bfdd7a3497ee699 Mon Sep 17 00:00:00 2001 From: h-ohta Date: Wed, 17 Aug 2022 18:50:33 +0900 Subject: [PATCH 3/9] refactor: add NOLINT --- .../src/pose_history/pose_history_display.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index c03b99dd9f7ad..562a039478fb5 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -37,7 +37,7 @@ class BoolProperty; namespace rviz_plugins { -class PoseHistory : public rviz_common::MessageFilterDisplay +class PoseHistory : public rviz_common::MessageFilterDisplay // NOLINT [cppcoreguidelines-special-member-functions] { Q_OBJECT From 9278e714bdbd29ca344976e9a2b26fdb93b41370 Mon Sep 17 00:00:00 2001 From: h-ohta Date: Wed, 17 Aug 2022 18:51:30 +0900 Subject: [PATCH 4/9] refactor: fix readability-identifier-naming --- .../src/pose_history/pose_history_display.cpp | 4 ++-- .../src/pose_history/pose_history_display.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp index ccc9254006065..8d0389863fd9f 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp @@ -95,7 +95,7 @@ void PoseHistory::processMessage(const geometry_msgs::msg::PoseStamped::ConstSha updateHistory(); } -void PoseHistory::updateHistory() +void PoseHistory::update_history() { const auto buffer_size = static_cast(property_buffer_size_->getInt()); while (buffer_size < history_.size()) { @@ -103,7 +103,7 @@ void PoseHistory::updateHistory() } } -void PoseHistory::updateLines() +void PoseHistory::update_lines() { Ogre::ColourValue color = rviz_common::properties::qtToOgre(property_line_color_->getColor()); color.a = property_line_alpha_->getFloat(); diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index 562a039478fb5..9a9d64002bda4 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -55,8 +55,8 @@ class PoseHistory : public rviz_common::MessageFilterDisplay history_; From aaa0bc18fd407aa74aaddec600ab835a764f7e86 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Aug 2022 09:53:51 +0000 Subject: [PATCH 5/9] ci(pre-commit): autofix --- .../src/pose_history/pose_history_display.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index 9a9d64002bda4..083e64ca06343 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -37,7 +37,9 @@ class BoolProperty; namespace rviz_plugins { -class PoseHistory : public rviz_common::MessageFilterDisplay // NOLINT [cppcoreguidelines-special-member-functions] +class PoseHistory +: public rviz_common::MessageFilterDisplay< + geometry_msgs::msg::PoseStamped> // NOLINT [cppcoreguidelines-special-member-functions] { Q_OBJECT From 5e855993250a94494d9a8d05e03097162d4e6e0e Mon Sep 17 00:00:00 2001 From: h-ohta Date: Thu, 18 Aug 2022 10:33:01 +0900 Subject: [PATCH 6/9] fix: build error --- .../src/pose_history/pose_history_display.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp index 8d0389863fd9f..f4555a1b4c1c9 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp @@ -62,7 +62,7 @@ void PoseHistory::update(float wall_dt, float ros_dt) if (!history_.empty()) { lines_->clear(); if (property_line_view_->getBool()) { - updateLines(); + update_lines(); } } } @@ -92,7 +92,7 @@ void PoseHistory::processMessage(const geometry_msgs::msg::PoseStamped::ConstSha history_.emplace_back(message); last_stamp_ = message->header.stamp; - updateHistory(); + update_history(); } void PoseHistory::update_history() From 2191d4e3918b3a0e247939ef5445d21a1cf8e24a Mon Sep 17 00:00:00 2001 From: h-ohta Date: Fri, 19 Aug 2022 18:55:41 +0900 Subject: [PATCH 7/9] fix: define copy/move constructor/assign-operator --- .../src/pose_history/pose_history_display.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index 083e64ca06343..cdeb7cef7c576 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -39,13 +39,17 @@ namespace rviz_plugins { class PoseHistory : public rviz_common::MessageFilterDisplay< - geometry_msgs::msg::PoseStamped> // NOLINT [cppcoreguidelines-special-member-functions] + geometry_msgs::msg::PoseStamped> { Q_OBJECT public: PoseHistory(); ~PoseHistory() override; + PoseHistory(const PoseHistory &) = delete; + PoseHistory(const PoseHistory &&) = delete; + PoseHistory& operator=(const PoseHistory &) = delete; + PoseHistory& operator=(const PoseHistory &&) = delete; protected: void onInitialize() override; From 84127dfeabbe4048498e5de0a2a7a7d9c18c3da6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Aug 2022 09:57:27 +0000 Subject: [PATCH 8/9] ci(pre-commit): autofix --- .../src/pose_history/pose_history_display.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp index cdeb7cef7c576..c47f6a3f099aa 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.hpp @@ -37,9 +37,7 @@ class BoolProperty; namespace rviz_plugins { -class PoseHistory -: public rviz_common::MessageFilterDisplay< - geometry_msgs::msg::PoseStamped> +class PoseHistory : public rviz_common::MessageFilterDisplay { Q_OBJECT @@ -48,8 +46,8 @@ class PoseHistory ~PoseHistory() override; PoseHistory(const PoseHistory &) = delete; PoseHistory(const PoseHistory &&) = delete; - PoseHistory& operator=(const PoseHistory &) = delete; - PoseHistory& operator=(const PoseHistory &&) = delete; + PoseHistory & operator=(const PoseHistory &) = delete; + PoseHistory & operator=(const PoseHistory &&) = delete; protected: void onInitialize() override; From 4f15ed0b1a78135fd27bdca3788d719b5e26dbbd Mon Sep 17 00:00:00 2001 From: h-ohta Date: Fri, 19 Aug 2022 19:27:08 +0900 Subject: [PATCH 9/9] chore: add comment --- .../src/pose_history/pose_history_display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp index f4555a1b4c1c9..e1d1c45414f25 100644 --- a/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp +++ b/common/tier4_localization_rviz_plugin/src/pose_history/pose_history_display.cpp @@ -42,7 +42,7 @@ PoseHistory::PoseHistory() : last_stamp_(0, 0, RCL_ROS_TIME) property_line_width_->setMin(0.0); } -PoseHistory::~PoseHistory() = default; +PoseHistory::~PoseHistory() = default; // Properties are deleted by Qt void PoseHistory::onInitialize() {