root/juggler/branches/2.2/modules/gadgeteer/test/FastrakTest.cpp

Revision 19737, 1.1 kB (checked in by aronb, 2 years ago)

- Finish writing simple Fastrak test.

  • Property svn:eol-style set to native
Line 
1 #include <iostream>
2 #include <FastrakStandalone.h>
3 #include <string>
4 #include <vpr/Util/Debug.h>
5 #include <gmtl/Matrix.h>
6 #include <gmtl/Generate.h>
7 #include <gmtl/Output.h>
8
9 int main()
10 {
11    FastrakStandalone fastrak("/dev/ttyS0", 115200);
12    fastrak.open();
13    fastrak.setUnits(Fastrak::CENTIMETERS);
14    fastrak.setHemisphere(1, Fastrak::FORWARD_HEM);
15    fastrak.setHemisphere(2, Fastrak::FORWARD_HEM);
16    fastrak.setHemisphere(3, Fastrak::FORWARD_HEM);
17    fastrak.setHemisphere(4, Fastrak::FORWARD_HEM);
18    fastrak.setStylusButtonEnabled(1, false);
19    fastrak.setStylusButtonEnabled(2, false);
20    fastrak.setStylusButtonEnabled(3, false);
21    fastrak.setStylusButtonEnabled(4, false);
22
23    fastrak.init();
24    fastrak.getStationStatus(1);
25    while(true)
26    {
27       fastrak.readData();
28       for (unsigned int i = 1; i < 5; i ++)
29       {
30          gmtl::Matrix44f& matrix = fastrak.getStationPosition(i);
31          gmtl::Vec3f pos = gmtl::makeTrans<gmtl::Vec3f>(matrix);
32          std::cout << i << ": Position: " << pos << std::endl;
33       }
34       std::cout << std::endl;
35    }
36    fastrak.close();
37 }
Note: See TracBrowser for help on using the browser.