installed signal handler to terminate robot more quickly when ctrl+c is pressed

This commit is contained in:
Ruixiang Du
2020-11-05 12:49:14 +08:00
parent a45f249043
commit 86b729deb3

View File

@@ -8,13 +8,21 @@
using namespace westonrobot;
ScoutBase robot;
void DetachRobot(int signal) {
robot.Disconnect();
robot.Terminate();
}
int main(int argc, char **argv) {
// setup ROS node
ros::init(argc, argv, "scout_odom");
ros::NodeHandle node(""), private_node("~");
std::signal(SIGINT, DetachRobot);
// instantiate a robot object
ScoutBase robot;
ScoutROSMessenger messenger(&robot, &node);
// fetch parameters before connecting to robot