5
\author Satofumi KAMIMURA
7
$Id: thread_scan.cpp 1854 2010-07-14 00:55:57Z satofumi $
10
#include "UrgDevice.h"
19
#define AUTO_CAPTURE_TEST
22
static int thread_function(void* args)
26
const char* device = static_cast<const char*>(args);
27
if (! urg.connect(device)) {
28
cout << "UrgDevice::connect: " << urg.what() << endl;
31
#if defined(AUTO_CAPTURE_TEST)
32
urg.setCaptureMode(AutoCapture);
35
enum { CaptureTimes = 10 };
38
while (scan_times < CaptureTimes) {
41
if (urg.capture(data, ×tamp)) {
42
cout << device << ": n = " << data.size()
43
<< ", (" << timestamp << ')'
44
<< ", " << scan_times << endl;
47
#if defined(AUTO_CAPTURE_TEST)
48
delay(urg.scanMsec());
58
int main(int argc, char *argv[])
60
// Change the port name appropriately
62
const char *devices[] = {
67
const char *devices[] = {
74
for (int i = 0; i < 2; ++i) {
75
threads[i] = new Thread(thread_function, const_cast<char *>(devices[i]));
79
for (int i = 0; i < 2; ++i) {