Added sensors to the robot. Correct exit on sigint.

This commit is contained in:
2016-06-18 17:08:28 -04:00
parent 38ce92b298
commit 0804a2fc37
8 changed files with 60 additions and 18 deletions

View File

@@ -34,20 +34,30 @@ const std::string HOST_NAME = "localhost";
const uint32_t PORT = 6666;
const uint32_t NUM_ROBOTS = 4;
static bool done = false;
extern "C" {
void handler(int signal) {
done = true;
}
void * robot_thread(void * arg) {
IASSS_Robot * robot = static_cast<IASSS_Robot *>(arg);
std::cout << "Running robot thread." << std::endl;
robot->run();
while(!done)
robot->run();
return NULL;
}
}
int main(int argc, char **argv) {
pthread_t robot_threads[NUM_ROBOTS];
std::vector<IASSS_Robot *> robots;
pthread_t robot_threads[NUM_ROBOTS];
std::vector<IASSS_Robot *> robots;
signal(SIGINT, handler);
try {
// Initialize the robot objects and threads.