00001
00011 #include "UrgDevice.h"
00012 #include <cstdlib>
00013 #include <cstdio>
00014
00015 using namespace qrk;
00016 using namespace std;
00017
00018
00020 int main(int argc, char *argv[])
00021 {
00022
00023 #ifdef WINDOWS_OS
00024 const char device[] = "COM3";
00025 #else
00026 const char device[] = "/dev/ttyACM0";
00027 #endif
00028
00029 UrgDevice urg;
00030 if (! urg.connect(device)) {
00031 printf("UrgDevice::connect: %s\n", urg.what());
00032 exit(1);
00033 }
00034
00035
00036
00037 enum { CaptureTimes = 1 };
00038 for (int i = 0; i < CaptureTimes; ++i) {
00039 long timestamp = 0;
00040 vector<long> data;
00041
00042
00043 int n = urg.capture(data, ×tamp);
00044
00045
00046 printf("timestamp: %ld\n", timestamp);
00047 for (int j = 0; j < n; ++j) {
00048
00049
00050 printf("%d:%ld, ", j, data[j]);
00051 }
00052 printf("\n");
00053 }
00054
00055 #ifdef MSC
00056 getchar();
00057 #endif
00058
00059 return 0;
00060 }