ros::init_options::NoSigintHandler not used in teleop_turtle_key.cpp

asked 2018-12-03 12:07:32 -0500

Elric gravatar image

updated 2018-12-03 12:09:01 -0500

I've just started to learn ROS and I have read that ros::init can handle Sigint.

If I don't want to let ros::init handle SigInt, I have to set it in ros::init options using ros::init_options::NoSigintHandler, but in the code of teleop_turtle_key.cpp, they don't use that initialization option. They just do:

 void quit(int sig)
 {
   (void)sig;
   tcsetattr(kfd, TCSANOW, &cooked);
   ros::shutdown();
   exit(0);
 }

 int main(int argc, char** argv)
 {
   ros::init(argc, argv, "teleop_turtle");
   TeleopTurtle teleop_turtle;

   signal(SIGINT,quit);

   teleop_turtle.keyLoop();

   return(0);
 }

They only use signal(SIGINT,quit); and nothing else.

Is that correct?

edit retag flag offensive close merge delete