From 788b2e324b0121fcbb028c8f20f176cb8cbf8bf3 Mon Sep 17 00:00:00 2001 From: Takamasa Horibe Date: Thu, 9 May 2024 12:13:00 +0900 Subject: [PATCH] chore(glog): add initialization check (#6792) Signed-off-by: Takamasa Horibe --- common/glog_component/CMakeLists.txt | 2 +- common/glog_component/package.xml | 2 +- common/glog_component/src/glog_component.cpp | 6 ++++-- evaluator/perception_online_evaluator/CMakeLists.txt | 2 -- evaluator/perception_online_evaluator/package.xml | 2 +- .../src/perception_online_evaluator_node.cpp | 6 ++++-- localization/ndt_scan_matcher/package.xml | 2 +- localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp | 6 ++++-- localization/pose_estimator_arbiter/package.xml | 2 +- .../pose_estimator_arbiter/pose_estimator_arbiter_node.cpp | 6 ++++-- localization/yabloc/yabloc_common/package.xml | 2 +- .../yabloc_common/src/ground_server/ground_server_node.cpp | 6 ++++-- .../src/camera_corrector/camera_particle_corrector_node.cpp | 6 ++++-- perception/map_based_prediction/package.xml | 2 +- .../map_based_prediction/src/map_based_prediction_node.cpp | 6 ++++-- perception/multi_object_tracker/CMakeLists.txt | 5 +---- perception/multi_object_tracker/package.xml | 2 +- .../multi_object_tracker/src/multi_object_tracker_node.cpp | 6 ++++-- perception/radar_object_tracker/package.xml | 2 +- .../radar_object_tracker_node/radar_object_tracker_node.cpp | 6 ++++-- perception/tracking_object_merger/package.xml | 2 +- .../src/decorative_tracker_merger.cpp | 6 ++++-- 22 files changed, 51 insertions(+), 36 deletions(-) diff --git a/common/glog_component/CMakeLists.txt b/common/glog_component/CMakeLists.txt index c2a68d0130b37..a233914cc1524 100644 --- a/common/glog_component/CMakeLists.txt +++ b/common/glog_component/CMakeLists.txt @@ -8,7 +8,7 @@ autoware_package() ament_auto_add_library(glog_component SHARED src/glog_component.cpp ) -target_link_libraries(glog_component glog) +target_link_libraries(glog_component glog::glog) rclcpp_components_register_node(glog_component PLUGIN "GlogComponent" diff --git a/common/glog_component/package.xml b/common/glog_component/package.xml index 0d6e7daac1de3..6feedd090f2c6 100644 --- a/common/glog_component/package.xml +++ b/common/glog_component/package.xml @@ -13,7 +13,7 @@ ament_cmake_auto autoware_cmake - libgoogle-glog-dev + glog rclcpp rclcpp_components diff --git a/common/glog_component/src/glog_component.cpp b/common/glog_component/src/glog_component.cpp index 9e7e70da6c884..7fd9c923d23c9 100644 --- a/common/glog_component/src/glog_component.cpp +++ b/common/glog_component/src/glog_component.cpp @@ -17,8 +17,10 @@ GlogComponent::GlogComponent(const rclcpp::NodeOptions & node_options) : Node("glog_component", node_options) { - google::InitGoogleLogging("glog_component"); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging("glog_component"); + google::InstallFailureSignalHandler(); + } } #include diff --git a/evaluator/perception_online_evaluator/CMakeLists.txt b/evaluator/perception_online_evaluator/CMakeLists.txt index 3d967ea6d86ce..b323d07a882e8 100644 --- a/evaluator/perception_online_evaluator/CMakeLists.txt +++ b/evaluator/perception_online_evaluator/CMakeLists.txt @@ -6,8 +6,6 @@ autoware_package() find_package(pluginlib REQUIRED) -find_package(glog REQUIRED) - ament_auto_add_library(${PROJECT_NAME}_node SHARED src/metrics_calculator.cpp src/${PROJECT_NAME}_node.cpp diff --git a/evaluator/perception_online_evaluator/package.xml b/evaluator/perception_online_evaluator/package.xml index 18dde41c99566..3f855e2f1f887 100644 --- a/evaluator/perception_online_evaluator/package.xml +++ b/evaluator/perception_online_evaluator/package.xml @@ -21,8 +21,8 @@ diagnostic_msgs eigen geometry_msgs + glog lanelet2_extension - libgoogle-glog-dev motion_utils nav_msgs object_recognition_utils diff --git a/evaluator/perception_online_evaluator/src/perception_online_evaluator_node.cpp b/evaluator/perception_online_evaluator/src/perception_online_evaluator_node.cpp index f97ec68b75126..0fcdd77f4d515 100644 --- a/evaluator/perception_online_evaluator/src/perception_online_evaluator_node.cpp +++ b/evaluator/perception_online_evaluator/src/perception_online_evaluator_node.cpp @@ -43,8 +43,10 @@ PerceptionOnlineEvaluatorNode::PerceptionOnlineEvaluatorNode( { using std::placeholders::_1; - google::InitGoogleLogging("perception_online_evaluator_node"); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging("perception_online_evaluator_node"); + google::InstallFailureSignalHandler(); + } objects_sub_ = create_subscription( "~/input/objects", 1, std::bind(&PerceptionOnlineEvaluatorNode::onObjects, this, _1)); diff --git a/localization/ndt_scan_matcher/package.xml b/localization/ndt_scan_matcher/package.xml index 0913ee04174f5..b9a1f7dbad1bd 100644 --- a/localization/ndt_scan_matcher/package.xml +++ b/localization/ndt_scan_matcher/package.xml @@ -22,7 +22,7 @@ diagnostic_msgs fmt geometry_msgs - libgoogle-glog-dev + glog libpcl-all-dev localization_util nav_msgs diff --git a/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp b/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp index 6e2ed022f531e..785055eef3700 100644 --- a/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp +++ b/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp @@ -20,8 +20,10 @@ int main(int argc, char ** argv) { - google::InitGoogleLogging(argv[0]); // NOLINT - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging(argv[0]); // NOLINT + google::InstallFailureSignalHandler(); + } rclcpp::init(argc, argv); auto ndt_scan_matcher = std::make_shared(); diff --git a/localization/pose_estimator_arbiter/package.xml b/localization/pose_estimator_arbiter/package.xml index b416d42c8617f..480b323f3031d 100644 --- a/localization/pose_estimator_arbiter/package.xml +++ b/localization/pose_estimator_arbiter/package.xml @@ -15,8 +15,8 @@ autoware_auto_mapping_msgs diagnostic_msgs geometry_msgs + glog lanelet2_extension - libgoogle-glog-dev magic_enum pcl_conversions pcl_ros diff --git a/localization/pose_estimator_arbiter/src/pose_estimator_arbiter/pose_estimator_arbiter_node.cpp b/localization/pose_estimator_arbiter/src/pose_estimator_arbiter/pose_estimator_arbiter_node.cpp index e48507948520b..20aaaf10abaab 100644 --- a/localization/pose_estimator_arbiter/src/pose_estimator_arbiter/pose_estimator_arbiter_node.cpp +++ b/localization/pose_estimator_arbiter/src/pose_estimator_arbiter/pose_estimator_arbiter_node.cpp @@ -18,8 +18,10 @@ int main(int argc, char * argv[]) { - google::InitGoogleLogging(argv[0]); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging(argv[0]); + google::InstallFailureSignalHandler(); + } rclcpp::init(argc, argv); auto node = std::make_shared(); diff --git a/localization/yabloc/yabloc_common/package.xml b/localization/yabloc/yabloc_common/package.xml index 710ec0aeb75f8..213057f428c38 100644 --- a/localization/yabloc/yabloc_common/package.xml +++ b/localization/yabloc/yabloc_common/package.xml @@ -19,9 +19,9 @@ autoware_auto_mapping_msgs cv_bridge geometry_msgs + glog lanelet2_core lanelet2_extension - libgoogle-glog-dev pcl_conversions rclcpp sensor_msgs diff --git a/localization/yabloc/yabloc_common/src/ground_server/ground_server_node.cpp b/localization/yabloc/yabloc_common/src/ground_server/ground_server_node.cpp index ff50eeee0421d..4e032ff72c998 100644 --- a/localization/yabloc/yabloc_common/src/ground_server/ground_server_node.cpp +++ b/localization/yabloc/yabloc_common/src/ground_server/ground_server_node.cpp @@ -18,8 +18,10 @@ int main(int argc, char ** argv) { - google::InitGoogleLogging(argv[0]); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging(argv[0]); + google::InstallFailureSignalHandler(); + } rclcpp::init(argc, argv); rclcpp::spin(std::make_shared()); diff --git a/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_node.cpp b/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_node.cpp index 4def604030c95..01378f05a0ac8 100644 --- a/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_node.cpp +++ b/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_node.cpp @@ -18,8 +18,10 @@ int main(int argc, char * argv[]) { - google::InitGoogleLogging(argv[0]); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging(argv[0]); + google::InstallFailureSignalHandler(); + } namespace mpf = yabloc::modularized_particle_filter; rclcpp::init(argc, argv); diff --git a/perception/map_based_prediction/package.xml b/perception/map_based_prediction/package.xml index 8efea9efa1844..0db8d757ee540 100644 --- a/perception/map_based_prediction/package.xml +++ b/perception/map_based_prediction/package.xml @@ -17,9 +17,9 @@ autoware_auto_perception_msgs autoware_perception_msgs + glog interpolation lanelet2_extension - libgoogle-glog-dev motion_utils rclcpp rclcpp_components diff --git a/perception/map_based_prediction/src/map_based_prediction_node.cpp b/perception/map_based_prediction/src/map_based_prediction_node.cpp index 56dc1c2293583..dac8cc0829e3c 100644 --- a/perception/map_based_prediction/src/map_based_prediction_node.cpp +++ b/perception/map_based_prediction/src/map_based_prediction_node.cpp @@ -715,8 +715,10 @@ void replaceObjectYawWithLaneletsYaw( MapBasedPredictionNode::MapBasedPredictionNode(const rclcpp::NodeOptions & node_options) : Node("map_based_prediction", node_options), debug_accumulated_time_(0.0) { - google::InitGoogleLogging("map_based_prediction_node"); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging("map_based_prediction_node"); + google::InstallFailureSignalHandler(); + } enable_delay_compensation_ = declare_parameter("enable_delay_compensation"); prediction_time_horizon_ = declare_parameter("prediction_time_horizon"); lateral_control_time_horizon_ = diff --git a/perception/multi_object_tracker/CMakeLists.txt b/perception/multi_object_tracker/CMakeLists.txt index 41d150ef0ba1b..46af1f9b9a1de 100644 --- a/perception/multi_object_tracker/CMakeLists.txt +++ b/perception/multi_object_tracker/CMakeLists.txt @@ -48,16 +48,13 @@ ament_auto_add_library(multi_object_tracker_node SHARED target_link_libraries(multi_object_tracker_node Eigen3::Eigen + glog::glog ) ament_auto_add_executable(${PROJECT_NAME} src/multi_object_tracker_node.cpp ) -target_link_libraries(${PROJECT_NAME} - multi_object_tracker_node glog -) - ament_auto_package(INSTALL_TO_SHARE launch config diff --git a/perception/multi_object_tracker/package.xml b/perception/multi_object_tracker/package.xml index 4033f85eafb8a..1e4a90d8cc08c 100644 --- a/perception/multi_object_tracker/package.xml +++ b/perception/multi_object_tracker/package.xml @@ -16,8 +16,8 @@ autoware_auto_perception_msgs diagnostic_updater eigen + glog kalman_filter - libgoogle-glog-dev mussp object_recognition_utils rclcpp diff --git a/perception/multi_object_tracker/src/multi_object_tracker_node.cpp b/perception/multi_object_tracker/src/multi_object_tracker_node.cpp index f20aedf16efef..c6eed297c02c4 100644 --- a/perception/multi_object_tracker/src/multi_object_tracker_node.cpp +++ b/perception/multi_object_tracker/src/multi_object_tracker_node.cpp @@ -20,8 +20,10 @@ int main(int argc, char ** argv) { - google::InitGoogleLogging(argv[0]); // NOLINT - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging(argv[0]); // NOLINT + google::InstallFailureSignalHandler(); + } rclcpp::init(argc, argv); rclcpp::NodeOptions options; diff --git a/perception/radar_object_tracker/package.xml b/perception/radar_object_tracker/package.xml index a371d9054966a..3697903e77e41 100644 --- a/perception/radar_object_tracker/package.xml +++ b/perception/radar_object_tracker/package.xml @@ -16,9 +16,9 @@ autoware_auto_perception_msgs eigen + glog kalman_filter lanelet2_extension - libgoogle-glog-dev mussp nlohmann-json-dev object_recognition_utils diff --git a/perception/radar_object_tracker/src/radar_object_tracker_node/radar_object_tracker_node.cpp b/perception/radar_object_tracker/src/radar_object_tracker_node/radar_object_tracker_node.cpp index e4b394256101d..460578699e780 100644 --- a/perception/radar_object_tracker/src/radar_object_tracker_node/radar_object_tracker_node.cpp +++ b/perception/radar_object_tracker/src/radar_object_tracker_node/radar_object_tracker_node.cpp @@ -196,8 +196,10 @@ RadarObjectTrackerNode::RadarObjectTrackerNode(const rclcpp::NodeOptions & node_ tf_listener_(tf_buffer_) { // glog for debug - google::InitGoogleLogging("radar_object_tracker"); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging("radar_object_tracker"); + google::InstallFailureSignalHandler(); + } // Create publishers and subscribers detected_object_sub_ = create_subscription( diff --git a/perception/tracking_object_merger/package.xml b/perception/tracking_object_merger/package.xml index 027a7bf26d2c4..5912675c819fc 100644 --- a/perception/tracking_object_merger/package.xml +++ b/perception/tracking_object_merger/package.xml @@ -15,7 +15,7 @@ autoware_auto_perception_msgs eigen - libgoogle-glog-dev + glog mussp object_recognition_utils rclcpp diff --git a/perception/tracking_object_merger/src/decorative_tracker_merger.cpp b/perception/tracking_object_merger/src/decorative_tracker_merger.cpp index 2273ad6504e2a..5ff016379dd18 100644 --- a/perception/tracking_object_merger/src/decorative_tracker_merger.cpp +++ b/perception/tracking_object_merger/src/decorative_tracker_merger.cpp @@ -88,8 +88,10 @@ DecorativeTrackerMergerNode::DecorativeTrackerMergerNode(const rclcpp::NodeOptio tf_listener_(tf_buffer_) { // glog for debug - google::InitGoogleLogging("decorative_object_merger_node"); - google::InstallFailureSignalHandler(); + if (!google::IsGoogleLoggingInitialized()) { + google::InitGoogleLogging("decorative_object_merger_node"); + google::InstallFailureSignalHandler(); + } // Subscriber sub_main_objects_ = create_subscription(