From 2042b73010657ee207455d7f87ccf981f8d0a273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Or=C5=A1uli=C4=87?= Date: Thu, 3 Aug 2017 12:29:07 +0200 Subject: [PATCH] Remove custom SIGINT handler from offline node. (#470) --- .../cartographer_ros/offline_node_main.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/cartographer_ros/cartographer_ros/offline_node_main.cc b/cartographer_ros/cartographer_ros/offline_node_main.cc index a59a35a..efe13e1 100644 --- a/cartographer_ros/cartographer_ros/offline_node_main.cc +++ b/cartographer_ros/cartographer_ros/offline_node_main.cc @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -62,10 +61,6 @@ constexpr char kClockTopic[] = "clock"; constexpr char kTfStaticTopic[] = "/tf_static"; constexpr char kTfTopic[] = "tf"; -volatile std::sig_atomic_t sigint_triggered = 0; - -void SigintHandler(int) { sigint_triggered = 1; } - // TODO(hrapp): This is duplicated in node_main.cc. Pull out into a config // unit. std::tuple LoadOptions() { @@ -130,7 +125,7 @@ void Run(const std::vector& bag_filenames) { } for (const string& bag_filename : bag_filenames) { - if (sigint_triggered) { + if (!::ros::ok()) { break; } @@ -148,7 +143,7 @@ void Run(const std::vector& bag_filenames) { // because it gets very inefficient with a large one. std::deque delayed_messages; for (const rosbag::MessageInstance& msg : view) { - if (sigint_triggered) { + if (!::ros::ok()) { break; } @@ -252,9 +247,7 @@ int main(int argc, char** argv) { << "-configuration_basename is missing."; CHECK(!FLAGS_bag_filenames.empty()) << "-bag_filenames is missing."; - std::signal(SIGINT, &::cartographer_ros::SigintHandler); - ::ros::init(argc, argv, "cartographer_offline_node", - ::ros::init_options::NoSigintHandler); + ::ros::init(argc, argv, "cartographer_offline_node"); ::ros::start(); cartographer_ros::ScopedRosLogSink ros_log_sink;