mirror of
https://github.com/westonrobot/scout_ros.git
synced 2026-01-12 03:15:01 +08:00
installed signal handler to terminate robot more quickly when ctrl+c is pressed
This commit is contained in:
@@ -8,13 +8,21 @@
|
|||||||
|
|
||||||
using namespace westonrobot;
|
using namespace westonrobot;
|
||||||
|
|
||||||
|
ScoutBase robot;
|
||||||
|
|
||||||
|
void DetachRobot(int signal) {
|
||||||
|
robot.Disconnect();
|
||||||
|
robot.Terminate();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
// setup ROS node
|
// setup ROS node
|
||||||
ros::init(argc, argv, "scout_odom");
|
ros::init(argc, argv, "scout_odom");
|
||||||
ros::NodeHandle node(""), private_node("~");
|
ros::NodeHandle node(""), private_node("~");
|
||||||
|
|
||||||
|
std::signal(SIGINT, DetachRobot);
|
||||||
|
|
||||||
// instantiate a robot object
|
// instantiate a robot object
|
||||||
ScoutBase robot;
|
|
||||||
ScoutROSMessenger messenger(&robot, &node);
|
ScoutROSMessenger messenger(&robot, &node);
|
||||||
|
|
||||||
// fetch parameters before connecting to robot
|
// fetch parameters before connecting to robot
|
||||||
|
|||||||
Reference in New Issue
Block a user