From 8c70afef93982483f7888e7f6aa8a91926bea8a2 Mon Sep 17 00:00:00 2001 From: Takeshi Miura <57553950+1222-takeshi@users.noreply.github.com> Date: Wed, 20 Jul 2022 15:45:27 +0900 Subject: [PATCH] fix(tier4_vehicle_rviz_plugin): initialization vehicle rivz plugin (#1379) * fix(tier4_vehicle_rviz_plugin): initialization vehicle rviz plugin Signed-off-by: Takeshi Miura * initialize signal_type Signed-off-by: Takeshi Miura --- .../tier4_vehicle_rviz_plugin/src/tools/console_meter.cpp | 5 ++--- .../tier4_vehicle_rviz_plugin/src/tools/steering_angle.cpp | 5 ++--- common/tier4_vehicle_rviz_plugin/src/tools/turn_signal.cpp | 7 +++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/common/tier4_vehicle_rviz_plugin/src/tools/console_meter.cpp b/common/tier4_vehicle_rviz_plugin/src/tools/console_meter.cpp index 9c52330af5701..f13e971b4d6d6 100644 --- a/common/tier4_vehicle_rviz_plugin/src/tools/console_meter.cpp +++ b/common/tier4_vehicle_rviz_plugin/src/tools/console_meter.cpp @@ -95,10 +95,9 @@ void ConsoleMeterDisplay::update(float wall_dt, float ros_dt) double linear_x = 0; { std::lock_guard message_lock(mutex_); - if (!last_msg_ptr_) { - return; + if (last_msg_ptr_) { + linear_x = last_msg_ptr_->longitudinal_velocity; } - linear_x = last_msg_ptr_->longitudinal_velocity; } QColor background_color; diff --git a/common/tier4_vehicle_rviz_plugin/src/tools/steering_angle.cpp b/common/tier4_vehicle_rviz_plugin/src/tools/steering_angle.cpp index b96aa0906ecb6..18977367afbce 100644 --- a/common/tier4_vehicle_rviz_plugin/src/tools/steering_angle.cpp +++ b/common/tier4_vehicle_rviz_plugin/src/tools/steering_angle.cpp @@ -106,10 +106,9 @@ void SteeringAngleDisplay::update(float wall_dt, float ros_dt) double steering = 0; { std::lock_guard message_lock(mutex_); - if (!last_msg_ptr_) { - return; + if (last_msg_ptr_) { + steering = last_msg_ptr_->steering_tire_angle; } - steering = last_msg_ptr_->steering_tire_angle; } QColor background_color; diff --git a/common/tier4_vehicle_rviz_plugin/src/tools/turn_signal.cpp b/common/tier4_vehicle_rviz_plugin/src/tools/turn_signal.cpp index 1852f0392c063..b9ff54ef44ecd 100644 --- a/common/tier4_vehicle_rviz_plugin/src/tools/turn_signal.cpp +++ b/common/tier4_vehicle_rviz_plugin/src/tools/turn_signal.cpp @@ -103,13 +103,12 @@ void TurnSignalDisplay::update(float wall_dt, float ros_dt) (void)wall_dt; (void)ros_dt; - unsigned int signal_type; + unsigned int signal_type = 0; { std::lock_guard message_lock(mutex_); - if (!last_msg_ptr_) { - return; + if (last_msg_ptr_) { + signal_type = last_msg_ptr_->report; } - signal_type = last_msg_ptr_->report; } QColor background_color;