Skip to content

Commit

Permalink
Remove custom SIGINT handler from offline node. (ros#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojura authored and wohe committed Aug 3, 2017
1 parent 63aba81 commit 2042b73
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions cartographer_ros/cartographer_ros/offline_node_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <time.h>
#include <chrono>
#include <csignal>
#include <sstream>
#include <string>
#include <vector>
Expand Down Expand Up @@ -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<NodeOptions, TrajectoryOptions> LoadOptions() {
Expand Down Expand Up @@ -130,7 +125,7 @@ void Run(const std::vector<string>& bag_filenames) {
}

for (const string& bag_filename : bag_filenames) {
if (sigint_triggered) {
if (!::ros::ok()) {
break;
}

Expand All @@ -148,7 +143,7 @@ void Run(const std::vector<string>& bag_filenames) {
// because it gets very inefficient with a large one.
std::deque<rosbag::MessageInstance> delayed_messages;
for (const rosbag::MessageInstance& msg : view) {
if (sigint_triggered) {
if (!::ros::ok()) {
break;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2042b73

Please sign in to comment.