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 0dfc666c64dea..cb107d4abdb75 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 @@ -59,7 +59,7 @@ private Q_SLOTS: void unsubscribe(); void processMessage(const geometry_msgs::msg::PoseStamped::ConstSharedPtr message); -private: +private: // NOLINT for Qt void updateHistory(); void updateLines(); diff --git a/common/tier4_perception_rviz_plugin/src/tools/car_pose.cpp b/common/tier4_perception_rviz_plugin/src/tools/car_pose.cpp index 0a9ea758877ea..aa2c198b35c8b 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/car_pose.cpp +++ b/common/tier4_perception_rviz_plugin/src/tools/car_pose.cpp @@ -99,7 +99,7 @@ CarInitialPoseTool::CarInitialPoseTool() void CarInitialPoseTool::onInitialize() { - PoseTool::onInitialize(); + rviz_plugins::InteractiveObjectTool::onInitialize(); setName("2D Dummy Car"); updateTopic(); } @@ -184,7 +184,7 @@ BusInitialPoseTool::BusInitialPoseTool() void BusInitialPoseTool::onInitialize() { - PoseTool::onInitialize(); + rviz_plugins::InteractiveObjectTool::onInitialize(); setName("2D Dummy Bus"); updateTopic(); } diff --git a/common/tier4_perception_rviz_plugin/src/tools/car_pose.hpp b/common/tier4_perception_rviz_plugin/src/tools/car_pose.hpp index 1fa78da223a1f..43afe7db95dcd 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/car_pose.hpp +++ b/common/tier4_perception_rviz_plugin/src/tools/car_pose.hpp @@ -61,16 +61,16 @@ class CarInitialPoseTool : public InteractiveObjectTool { public: CarInitialPoseTool(); - void onInitialize(); - Object createObjectMsg() const override; + void onInitialize() override; + [[nodiscard]] Object createObjectMsg() const override; }; class BusInitialPoseTool : public InteractiveObjectTool { public: BusInitialPoseTool(); - void onInitialize(); - Object createObjectMsg() const override; + void onInitialize() override; + [[nodiscard]] Object createObjectMsg() const override; }; } // namespace rviz_plugins diff --git a/common/tier4_perception_rviz_plugin/src/tools/delete_all_objects.hpp b/common/tier4_perception_rviz_plugin/src/tools/delete_all_objects.hpp index 4c559445208da..11b3e569d326c 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/delete_all_objects.hpp +++ b/common/tier4_perception_rviz_plugin/src/tools/delete_all_objects.hpp @@ -67,16 +67,15 @@ class DeleteAllObjectsTool : public rviz_default_plugins::tools::PoseTool public: DeleteAllObjectsTool(); - virtual ~DeleteAllObjectsTool() {} - virtual void onInitialize(); + void onInitialize() override; protected: - virtual void onPoseSet(double x, double y, double theta); + void onPoseSet(double x, double y, double theta) override; private Q_SLOTS: void updateTopic(); -private: +private: // NOLINT for Qt rclcpp::Clock::SharedPtr clock_; rclcpp::Publisher::SharedPtr dummy_object_info_pub_; diff --git a/common/tier4_perception_rviz_plugin/src/tools/interactive_object.cpp b/common/tier4_perception_rviz_plugin/src/tools/interactive_object.cpp index 61924dc8802a6..5f0233221963e 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/interactive_object.cpp +++ b/common/tier4_perception_rviz_plugin/src/tools/interactive_object.cpp @@ -62,7 +62,6 @@ InteractiveObject::InteractiveObject(const Ogre::Vector3 & point) { velocity_ = Ogre::Vector3::ZERO; point_ = point; - theta_ = 0.0; std::mt19937 gen(std::random_device{}()); std::independent_bits_engine bit_eng(gen); diff --git a/common/tier4_perception_rviz_plugin/src/tools/interactive_object.hpp b/common/tier4_perception_rviz_plugin/src/tools/interactive_object.hpp index 9dbe5335ecc8d..5513e93600466 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/interactive_object.hpp +++ b/common/tier4_perception_rviz_plugin/src/tools/interactive_object.hpp @@ -89,9 +89,8 @@ class InteractiveObject { public: explicit InteractiveObject(const Ogre::Vector3 & point); - ~InteractiveObject() {} - std::array uuid() const; + [[nodiscard]] std::array uuid() const; void twist(geometry_msgs::msg::Twist & twist) const; void transform(tf2::Transform & tf_map2object) const; void update(const Ogre::Vector3 & point); @@ -99,25 +98,26 @@ class InteractiveObject double distance(const Ogre::Vector3 & point); private: - std::array uuid_; + std::array uuid_{}; Ogre::Vector3 point_; Ogre::Vector3 velocity_; - double theta_; + double theta_{0.0}; }; class InteractiveObjectCollection { public: InteractiveObjectCollection(); - ~InteractiveObjectCollection() {} void select(const Ogre::Vector3 & point); boost::optional> reset(); boost::optional> create(const Ogre::Vector3 & point); boost::optional> remove(const Ogre::Vector3 & point); boost::optional> update(const Ogre::Vector3 & point); - boost::optional twist(const std::array & uuid) const; - boost::optional transform(const std::array & uuid) const; + [[nodiscard]] boost::optional twist( + const std::array & uuid) const; + [[nodiscard]] boost::optional transform( + const std::array & uuid) const; private: size_t nearest(const Ogre::Vector3 & point); @@ -130,17 +130,16 @@ class InteractiveObjectTool : public rviz_default_plugins::tools::PoseTool Q_OBJECT public: - virtual ~InteractiveObjectTool() = default; - virtual void onInitialize(); + void onInitialize() override; int processMouseEvent(rviz_common::ViewportMouseEvent & event) override; int processKeyEvent(QKeyEvent * event, rviz_common::RenderPanel * panel) override; - virtual Object createObjectMsg() const = 0; + [[nodiscard]] virtual Object createObjectMsg() const = 0; protected Q_SLOTS: virtual void updateTopic(); -protected: +protected: // NOLINT for Qt rclcpp::Clock::SharedPtr clock_; rclcpp::Publisher::SharedPtr dummy_object_info_pub_; @@ -161,7 +160,7 @@ protected Q_SLOTS: private: void publishObjectMsg(const std::array & uuid, const uint32_t action); - void onPoseSet(double x, double y, double theta); + void onPoseSet(double x, double y, double theta) override; InteractiveObjectCollection objects_; }; diff --git a/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.cpp b/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.cpp index dc95371ef5c22..caf85cdae1358 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.cpp +++ b/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.cpp @@ -93,7 +93,7 @@ PedestrianInitialPoseTool::PedestrianInitialPoseTool() void PedestrianInitialPoseTool::onInitialize() { - PoseTool::onInitialize(); + rviz_plugins::InteractiveObjectTool::onInitialize(); setName("2D Dummy Pedestrian"); updateTopic(); } diff --git a/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.hpp b/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.hpp index b19aacc91c2c0..195ec8e2a3a6d 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.hpp +++ b/common/tier4_perception_rviz_plugin/src/tools/pedestrian_pose.hpp @@ -61,8 +61,8 @@ class PedestrianInitialPoseTool : public InteractiveObjectTool { public: PedestrianInitialPoseTool(); - void onInitialize(); - Object createObjectMsg() const override; + void onInitialize() override; + [[nodiscard]] Object createObjectMsg() const override; }; } // namespace rviz_plugins diff --git a/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.cpp b/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.cpp index 5fa7ff773e77a..81885f8931928 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.cpp +++ b/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.cpp @@ -88,7 +88,7 @@ UnknownInitialPoseTool::UnknownInitialPoseTool() void UnknownInitialPoseTool::onInitialize() { - PoseTool::onInitialize(); + rviz_plugins::InteractiveObjectTool::onInitialize(); setName("2D Dummy Unknown"); updateTopic(); } diff --git a/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.hpp b/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.hpp index 04556805b3ff0..2bc3129b51321 100644 --- a/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.hpp +++ b/common/tier4_perception_rviz_plugin/src/tools/unknown_pose.hpp @@ -56,8 +56,8 @@ class UnknownInitialPoseTool : public InteractiveObjectTool { public: UnknownInitialPoseTool(); - void onInitialize(); - Object createObjectMsg() const override; + void onInitialize() override; + [[nodiscard]] Object createObjectMsg() const override; }; } // namespace rviz_plugins