From 157f5d37fe4c0c4d74c2fb29d6db6447a5aeef11 Mon Sep 17 00:00:00 2001 From: Tomoya Kimura Date: Tue, 6 Sep 2022 13:46:51 +0900 Subject: [PATCH] fix(tier4_vehicle_rviz_plugin): initialization vehicle rviz plugin (#1379) (#109) 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 Signed-off-by: Takeshi Miura Co-authored-by: Takeshi Miura <57553950+1222-takeshi@users.noreply.github.com> --- .../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;