All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
viewVvSample.cpp
1 
11 #include "UrgCtrl.h"
12 #include <cstdlib>
13 #include <iostream>
14 
15 using namespace qrk;
16 using namespace std;
17 
18 
20 int main(int argc, char *argv[])
21 {
22  //const char device[] = "COM3";
23  const char device[] = "/dev/ttyACM0";
24 
25  UrgCtrl urg;
26  if (! urg.connect(device)) {
27  printf("UrgCtrl::connect: %s\n", urg.what());
28  exit(1);
29  }
30 
31  vector<string> lines;
32 
33  // Receive version information
34  urg.versionLines(lines);
35  if (lines.empty()) {
36  cerr << "UrgCtrl::versionLines: " << urg.what() << endl;
37  exit(1);
38  }
39 
40  // Output
41  for (vector<string>::iterator it = lines.begin();
42  it != lines.end(); ++it) {
43  cout << *it << endl;
44  }
45 
46  return 0;
47 }