Skip to content

Commit

Permalink
chore(glog): add initialization check (#6792)
Browse files Browse the repository at this point in the history
Signed-off-by: Takamasa Horibe <[email protected]>
  • Loading branch information
TakaHoribe authored May 9, 2024
1 parent baeeab5 commit 788b2e3
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 36 deletions.
2 changes: 1 addition & 1 deletion common/glog_component/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion common/glog_component/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>libgoogle-glog-dev</depend>
<depend>glog</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>

Expand Down
6 changes: 4 additions & 2 deletions common/glog_component/src/glog_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <rclcpp_components/register_node_macro.hpp>
Expand Down
2 changes: 0 additions & 2 deletions evaluator/perception_online_evaluator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion evaluator/perception_online_evaluator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<depend>diagnostic_msgs</depend>
<depend>eigen</depend>
<depend>geometry_msgs</depend>
<depend>glog</depend>
<depend>lanelet2_extension</depend>
<depend>libgoogle-glog-dev</depend>
<depend>motion_utils</depend>
<depend>nav_msgs</depend>
<depend>object_recognition_utils</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PredictedObjects>(
"~/input/objects", 1, std::bind(&PerceptionOnlineEvaluatorNode::onObjects, this, _1));
Expand Down
2 changes: 1 addition & 1 deletion localization/ndt_scan_matcher/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<depend>diagnostic_msgs</depend>
<depend>fmt</depend>
<depend>geometry_msgs</depend>
<depend>libgoogle-glog-dev</depend>
<depend>glog</depend>
<depend>libpcl-all-dev</depend>
<depend>localization_util</depend>
<depend>nav_msgs</depend>
Expand Down
6 changes: 4 additions & 2 deletions localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<NDTScanMatcher>();
Expand Down
2 changes: 1 addition & 1 deletion localization/pose_estimator_arbiter/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<depend>autoware_auto_mapping_msgs</depend>
<depend>diagnostic_msgs</depend>
<depend>geometry_msgs</depend>
<depend>glog</depend>
<depend>lanelet2_extension</depend>
<depend>libgoogle-glog-dev</depend>
<depend>magic_enum</depend>
<depend>pcl_conversions</depend>
<depend>pcl_ros</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<pose_estimator_arbiter::PoseEstimatorArbiter>();
Expand Down
2 changes: 1 addition & 1 deletion localization/yabloc/yabloc_common/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<depend>autoware_auto_mapping_msgs</depend>
<depend>cv_bridge</depend>
<depend>geometry_msgs</depend>
<depend>glog</depend>
<depend>lanelet2_core</depend>
<depend>lanelet2_extension</depend>
<depend>libgoogle-glog-dev</depend>
<depend>pcl_conversions</depend>
<depend>rclcpp</depend>
<depend>sensor_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<yabloc::ground_server::GroundServer>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion perception/map_based_prediction/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

<depend>autoware_auto_perception_msgs</depend>
<depend>autoware_perception_msgs</depend>
<depend>glog</depend>
<depend>interpolation</depend>
<depend>lanelet2_extension</depend>
<depend>libgoogle-glog-dev</depend>
<depend>motion_utils</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>("enable_delay_compensation");
prediction_time_horizon_ = declare_parameter<double>("prediction_time_horizon");
lateral_control_time_horizon_ =
Expand Down
5 changes: 1 addition & 4 deletions perception/multi_object_tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion perception/multi_object_tracker/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<depend>autoware_auto_perception_msgs</depend>
<depend>diagnostic_updater</depend>
<depend>eigen</depend>
<depend>glog</depend>
<depend>kalman_filter</depend>
<depend>libgoogle-glog-dev</depend>
<depend>mussp</depend>
<depend>object_recognition_utils</depend>
<depend>rclcpp</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion perception/radar_object_tracker/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<depend>autoware_auto_perception_msgs</depend>
<depend>eigen</depend>
<depend>glog</depend>
<depend>kalman_filter</depend>
<depend>lanelet2_extension</depend>
<depend>libgoogle-glog-dev</depend>
<depend>mussp</depend>
<depend>nlohmann-json-dev</depend>
<depend>object_recognition_utils</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<autoware_auto_perception_msgs::msg::DetectedObjects>(
Expand Down
2 changes: 1 addition & 1 deletion perception/tracking_object_merger/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<depend>autoware_auto_perception_msgs</depend>
<depend>eigen</depend>
<depend>libgoogle-glog-dev</depend>
<depend>glog</depend>
<depend>mussp</depend>
<depend>object_recognition_utils</depend>
<depend>rclcpp</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TrackedObjects>(
Expand Down

0 comments on commit 788b2e3

Please sign in to comment.