Revision dcf49526 scout/libscout/src/BehaviorProcess.cpp

View differences:

scout/libscout/src/BehaviorProcess.cpp
36 36

  
37 37
#include "BehaviorProcess.h"
38 38
#include "Sensors.h"
39
#include "assert.h"
39
#include <assert.h>
40
#include <signal.h>
41

  
42
// Make the behavior's ok() function return false.
43
void sigint_handler(int sig)
44
{
45
  Behavior::keep_running = false;  
46
}
40 47

  
41 48
int main (int argc, char **argv)
42 49
{
......
58 65
        scoutname = argv[1];
59 66
        behavior_num = atoi(argv[2]);
60 67

  
61
        ros::init(argc, argv, scoutname + "_behavior");
68
        ros::init(argc, argv, scoutname + "_behavior",
69
            ros::init_options::NoSigintHandler);
70

  
71
        // Initialize the signal handler after initializing rosnode.
72
        // Otherwise it will be overwritten and you will be sad.
73
        signal(SIGINT, sigint_handler);
74

  
62 75
        // one Sensor instance per-class
63 76
        Sensors* sensors = new Sensors(scoutname);
64 77
        BehaviorList* list = new BehaviorList();

Also available in: Unified diff