Added sensors to the robot. Correct exit on sigint.
This commit is contained in:
16
ias_ss.cpp
16
ias_ss.cpp
@@ -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.
|
||||
|
Reference in New Issue
Block a user