Skip to content

Commit

Permalink
refactor(tier4_localization_rviz_plugin): apply clang-tidy (tier4#1608)
Browse files Browse the repository at this point in the history
* refactor(tier4_localization_rviz_plugin): apply clang-tidy

* ci(pre-commit): autofix

* refactor: add NOLINT

* refactor: fix readability-identifier-naming

* ci(pre-commit): autofix

* fix: build error

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and boyali committed Oct 3, 2022
1 parent 299a6d4 commit 7e69a06
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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; // Properties are deleted by Qt

void PoseHistory::onInitialize()
{
MFDClass::onInitialize();
lines_.reset(new rviz_rendering::BillboardLine(scene_manager_, scene_node_));
lines_ = std::make_unique<rviz_rendering::BillboardLine>(scene_manager_, scene_node_);
}

void PoseHistory::onEnable() { subscribe(); }
Expand All @@ -65,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();
}
}
}
Expand Down Expand Up @@ -95,18 +92,18 @@ void PoseHistory::processMessage(const geometry_msgs::msg::PoseStamped::ConstSha
history_.emplace_back(message);
last_stamp_ = message->header.stamp;

updateHistory();
update_history();
}

void PoseHistory::updateHistory()
void PoseHistory::update_history()
{
const auto buffer_size = static_cast<size_t>(property_buffer_size_->getInt());
while (buffer_size < history_.size()) {
history_.pop_front();
}
}

void PoseHistory::updateLines()
void PoseHistory::update_lines()
{
Ogre::ColourValue color = rviz_common::properties::qtToOgre(property_line_color_->getColor());
color.a = property_line_alpha_->getFloat();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -47,23 +44,24 @@ class PoseHistory : public rviz_common::MessageFilterDisplay<geometry_msgs::msg:
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;
void onEnable() override;
void onDisable() override;
void update(float wall_dt, float ros_dt) override;

private Q_SLOTS:
void subscribe();
void unsubscribe();
void processMessage(const geometry_msgs::msg::PoseStamped::ConstSharedPtr message);

private: // NOLINT for Qt
void updateHistory();
void updateLines();

private:
void subscribe() override;
void unsubscribe() override;
void processMessage(const geometry_msgs::msg::PoseStamped::ConstSharedPtr message) override;
void update_history();
void update_lines();

std::string target_frame_;
std::deque<geometry_msgs::msg::PoseStamped::ConstSharedPtr> history_;
std::unique_ptr<rviz_rendering::BillboardLine> lines_;
Expand Down

0 comments on commit 7e69a06

Please sign in to comment.