For those of you who were running stuff on the flockbots today. Here's some code you could toss in which will cause the robot to shut down gracefully when the user presses CONTROL-C. It does this by intercepting the SIGINT signal (which is sent by control-C) to clean up stuff appropriately before dying.
// Include this at the top
// put this function somewhere in your code.
// It will be called when the user presses control-c
void handle_control_c (int s)
shutdown_api(); // redundant? Dunno
// before anything else, say:
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = handle_control_c;
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
// now put the rest of your code here