From 10c51e60cd85a39fbbce8eff6e155bd7bb0e3f67 Mon Sep 17 00:00:00 2001 From: Takeshi Miura Date: Wed, 20 Jul 2022 16:59:19 +0900 Subject: [PATCH 1/3] fix(tier4_planning_rviz_plugin): fix initialize planning_rviz_plugin Signed-off-by: Takeshi Miura --- .../src/tools/max_velocity.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp b/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp index 559b694164af3..f1f07c69b3d9e 100644 --- a/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp +++ b/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp @@ -77,6 +77,7 @@ void MaxVelocityDisplay::onInitialize() overlay_->updateTextureSize(property_length_->getInt(), property_length_->getInt()); overlay_->setPosition(property_left_->getInt(), property_top_->getInt()); overlay_->setDimensions(overlay_->getTextureWidth(), overlay_->getTextureHeight()); + processMessage(last_msg_ptr_); // QColor background_color; // background_color.setAlpha(0); @@ -126,9 +127,9 @@ void MaxVelocityDisplay::unsubscribe() { max_vel_sub_.reset(); } void MaxVelocityDisplay::processMessage( const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg_ptr) { - if (!isEnabled()) { - return; - } + // if (!isEnabled()) { + // return; + // } if (!overlay_->isVisible()) { return; } @@ -172,8 +173,12 @@ void MaxVelocityDisplay::processMessage( font.setBold(true); painter.setFont(font); std::ostringstream velocity_ss; + float velocity = 0.0; + if(msg_ptr != nullptr){ + velocity = msg_ptr->max_velocity; + } velocity_ss << std::fixed << std::setprecision(0) << "limited" << std::endl - << msg_ptr->max_velocity * 3.6 << "km/h"; + << velocity * 3.6 << "km/h"; painter.drawText( static_cast(line_width * 0.5), std::min(static_cast(line_width * 0.5), h - 1), w, std::max(h, 1), Qt::AlignCenter | Qt::AlignVCenter, velocity_ss.str().c_str()); From dfc916406a78fc32ee84d44dd816cedb7ac9d75d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Jul 2022 03:53:12 +0000 Subject: [PATCH 2/3] ci(pre-commit): autofix --- common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp b/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp index f1f07c69b3d9e..4f45f33ef8cea 100644 --- a/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp +++ b/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp @@ -174,7 +174,7 @@ void MaxVelocityDisplay::processMessage( painter.setFont(font); std::ostringstream velocity_ss; float velocity = 0.0; - if(msg_ptr != nullptr){ + if (msg_ptr != nullptr) { velocity = msg_ptr->max_velocity; } velocity_ss << std::fixed << std::setprecision(0) << "limited" << std::endl From df3c3172da54c04f8d670a7f4558c54979a92be3 Mon Sep 17 00:00:00 2001 From: Takeshi Miura Date: Thu, 21 Jul 2022 13:53:46 +0900 Subject: [PATCH 3/3] remove comment out Signed-off-by: Takeshi Miura --- common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp b/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp index 4f45f33ef8cea..9a9f804438f88 100644 --- a/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp +++ b/common/tier4_planning_rviz_plugin/src/tools/max_velocity.cpp @@ -127,9 +127,6 @@ void MaxVelocityDisplay::unsubscribe() { max_vel_sub_.reset(); } void MaxVelocityDisplay::processMessage( const tier4_planning_msgs::msg::VelocityLimit::ConstSharedPtr msg_ptr) { - // if (!isEnabled()) { - // return; - // } if (!overlay_->isVisible()) { return; }