Showing
23 changed files
with
111 additions
and
1823 deletions
legacy/applications/testmtiqt.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../libs/libhmi.so"/> | ||
5 | + <library path="../libs/libmti.so"/> | ||
6 | + </libraries> | ||
7 | + <components> | ||
8 | + <component id="mti" type="MTiTracker"/> | ||
9 | + <component id="repere" type="RotateView"/> | ||
10 | + <component id="__statemachine__" type="StateMachine"> | ||
11 | + <statemachine> | ||
12 | + <first name="start"/> | ||
13 | + <last name="end"/> | ||
14 | + <transitions/> | ||
15 | + </statemachine> | ||
16 | + </component> | ||
17 | + </components> | ||
18 | + <constants/> | ||
19 | + </context> | ||
20 | + <processes> | ||
21 | + <process controller="__statemachine__"> | ||
22 | + <sheet id="start"> | ||
23 | + <preconnections> | ||
24 | + <invoke destination="mti" slot="setDevice(QString)" type="string">/dev/ttyUSB0</invoke> | ||
25 | + <invoke destination="mti" slot="setOrientationOutput(bool)" type="bool">true</invoke> | ||
26 | + <invoke destination="mti" slot="setPort(int)" type="int">4</invoke> | ||
27 | + <invoke destination="mti" slot="setQuaternionOutput()" type="void"/> | ||
28 | + <invoke destination="mti" slot="setThreaded(bool)" type="bool">true</invoke> | ||
29 | + <invoke destination="mti" slot="setTimeStampedOutput()" type="void"/> | ||
30 | + <invoke destination="mti" slot="setMagneticFilter(bool)" type="bool">true</invoke> | ||
31 | + </preconnections> | ||
32 | + <connections> | ||
33 | + <link source="mti" signal="sendQuaternion(float*)" destination="repere" slot="setQuaternion(float*)"/> | ||
34 | + </connections> | ||
35 | + <postconnections> | ||
36 | + <invoke destination="mti" slot="init()" type="void"/> | ||
37 | + <invoke destination="repere" slot="show()" type="void"/> | ||
38 | + <invoke destination="mti" slot="start()" type="void"/> | ||
39 | + </postconnections> | ||
40 | + </sheet> | ||
41 | + </process> | ||
42 | + </processes> | ||
43 | +</application> |
legacy/applications/testueye.xml
0 → 100644
1 | +<application mode="gui"> | ||
2 | + <context> | ||
3 | + <libraries> | ||
4 | + <library path="../libs/hmi"/> | ||
5 | + <library path="../libs/images"/> | ||
6 | + <library path="../libs/ueye"/> | ||
7 | + <library path="../libs/common"/> | ||
8 | + <library path="../libs/ocv"/> | ||
9 | + </libraries> | ||
10 | + <components> | ||
11 | + <component id="met" type="UEyeCamera"/> | ||
12 | + <component id="rcv" type="RawCVImageConvertor"/> | ||
13 | + <component id="tt" type="TokenTrigger"/> | ||
14 | + <component id="ips" type="ImagePointSelector"/> | ||
15 | + <component id="__statemachine__" type="StateMachine"> | ||
16 | + <statemachine> | ||
17 | + <first name=""/> | ||
18 | + <last name="E"/> | ||
19 | + <transitions> | ||
20 | + <transition source="S" destination="E" token="end"/> | ||
21 | + </transitions> | ||
22 | + </statemachine> | ||
23 | + </component> | ||
24 | + </components> | ||
25 | + <constants/> | ||
26 | + </context> | ||
27 | + <processes> | ||
28 | + <process controller="__statemachine__"> | ||
29 | + <sheet id="S"> | ||
30 | + <preconnections> | ||
31 | + <invoke destination="ips" slot="setPointNumber(int)" type="int">1</invoke> | ||
32 | + <invoke destination="rcv" slot="setChannels(int)" type="int">4</invoke> | ||
33 | + <invoke destination="tt" slot="setToken(QString)" type="string">end</invoke> | ||
34 | + <invoke destination="ips" slot="setBGR2RGB(bool)" type="bool">true</invoke> | ||
35 | + </preconnections> | ||
36 | + <connections> | ||
37 | + <link source="met" signal="sendImage(int,int,char*)" destination="rcv" slot="convertRaw(int,int,char*)"/> | ||
38 | + <link source="rcv" signal="rawProcessed(IplImage*)" destination="ips" slot="setImage(IplImage*)"/> | ||
39 | + <link source="ips" signal="clicked()" destination="tt" slot="tic()"/> | ||
40 | + <link source="tt" signal="sendToken(QString)" destination="__statemachine__" slot="setToken(QString)"/> | ||
41 | + </connections> | ||
42 | + <postconnections> | ||
43 | + <invoke destination="met" slot="initDevice()" type="void"/> | ||
44 | + <invoke destination="met" slot="setFrameRate(double)" type="double">10.0</invoke> | ||
45 | + <invoke destination="met" slot="setThreaded(bool)" type="bool">true</invoke> | ||
46 | + <invoke destination="ips" slot="show()" type="void"/> | ||
47 | + <invoke destination="met" slot="start()" type="void"/> | ||
48 | + </postconnections> | ||
49 | + </sheet> | ||
50 | + <sheet id="E"> | ||
51 | + <preconnections> | ||
52 | + <invoke destination="met" slot="stop()" type="void"/> | ||
53 | + <invoke destination="ips" slot="hide()" type="void"/> | ||
54 | + </preconnections> | ||
55 | + <connections/> | ||
56 | + <postconnections/> | ||
57 | + </sheet> | ||
58 | + </process> | ||
59 | + </processes> | ||
60 | +</application> |
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE QtCreatorProject> | 2 | <!DOCTYPE QtCreatorProject> |
3 | -<!-- Written by Qt Creator 2.4.1, 2012-05-04T11:55:36. --> | 3 | +<!-- Written by Qt Creator 2.4.1, 2012-05-04T15:48:00. --> |
4 | <qtcreator> | 4 | <qtcreator> |
5 | <data> | 5 | <data> |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | ... | ... |
... | @@ -24,3 +24,7 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME} | ... | @@ -24,3 +24,7 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME} |
24 | arcslibrary.variable_out = SOURCES | 24 | arcslibrary.variable_out = SOURCES |
25 | QMAKE_EXTRA_COMPILERS += arcslibrary | 25 | QMAKE_EXTRA_COMPILERS += arcslibrary |
26 | 26 | ||
27 | + | ||
28 | +DESTDIR=../libs | ||
29 | +DLL_DESTDIR=../libs | ||
30 | + | ... | ... |
legacy/input/tracker/gps.pro
deleted
100644 → 0
1 | -unix: TEMPLATE = lib | ||
2 | -win32: TEMPLATE = vclib | ||
3 | - | ||
4 | -LANGUAGE = C++ | ||
5 | - | ||
6 | -HEADERS += nmea.h | ||
7 | - | ||
8 | -SOURCES += nmea.cpp | ||
9 | - | ||
10 | -FORMS = gpswidget.ui | ||
11 | - | ||
12 | -HEADERS += gpswwidget.h | ||
13 | -HEADERS += gpstracker.h | ||
14 | -HEADERS += gpstranslator.h | ||
15 | -HEADERS += gpslog.h | ||
16 | -HEADERS += gpstoogr.h | ||
17 | -HEADERS += triggps.h | ||
18 | -HEADERS += synsensor.h | ||
19 | -HEADERS += synchro.h | ||
20 | - | ||
21 | -SOURCES += gpstracker.cpp | ||
22 | -SOURCES += gpstranslator.cpp | ||
23 | -SOURCES += gpslog.cpp | ||
24 | -SOURCES += gpstoogr.cpp | ||
25 | -SOURCES += triggps.cpp | ||
26 | -SOURCES += synsensor.cpp | ||
27 | -SOURCES += synchro.cpp | ||
28 | -HEADERS+= gpsserial.h | ||
29 | -SOURCES+= gpsserial.cpp | ||
30 | - | ||
31 | -SOURCES += lib.cpp | ||
32 | - | ||
33 | -MOC_DIR = ./moc | ||
34 | -UI_DIR = ./ui | ||
35 | -OBJECTS_DIR = ./obj | ||
36 | - | ||
37 | - | ||
38 | -CONFIG += qt thread release | ||
39 | - | ||
40 | -unix { | ||
41 | -INCLUDEPATH+=/usr/local/include | ||
42 | -LIBS+= -L/usr/local/lib | ||
43 | - | ||
44 | -HAS_OPENCV = $$system(/sbin/ldconfig -p | grep -F libopencv-) | ||
45 | -HAS_CV = $$system(/sbin/ldconfig -p | grep -F libcv.) | ||
46 | -HAS_CXCORE = $$system(/sbin/ldconfig -p | grep -F libcxcore.) | ||
47 | -HAS_HIGHGUI= $$system(/sbin/ldconfig -p | grep -F libhighgui.) | ||
48 | -HAS_CVAUX = &&system(/sbin/ldconfig -p | grep -F libcvaux-) | ||
49 | - | ||
50 | -!isEmpty(HAS_OPENCV) { | ||
51 | - message("libopencv found") | ||
52 | - LIBS += -lopencv | ||
53 | -} | ||
54 | - | ||
55 | -!isEmpty(HAS_CV) { | ||
56 | - message("libcv found") | ||
57 | - LIBS += -lcv | ||
58 | -} | ||
59 | - | ||
60 | -!isEmpty(HAS_CXCORE) { | ||
61 | - message("libcxcore found") | ||
62 | - LIBS += -lcxcore | ||
63 | -} | ||
64 | - | ||
65 | -!isEmpty(HAS_HIGHGUI) { | ||
66 | - message("libhighgui found") | ||
67 | - LIBS += -lhighgui | ||
68 | -} | ||
69 | - | ||
70 | -!isEmpty(HAS_CVAUX) { | ||
71 | - message("libcvaux found") | ||
72 | - LIBS += -lcvaux | ||
73 | -} | ||
74 | - | ||
75 | -} | ||
76 | - | ||
77 | -win32 { | ||
78 | -INCLUDEPATH+=$$(ARCSDIR)/include | ||
79 | -LIBS += -L$$(ARCSDIR)/lib -lcv -lcxcore -lcvaux -lhighgui | ||
80 | -CONFIG += dll exceptions | ||
81 | -DEFINES += _CRT_SECURE_NO_DEPRECATE | ||
82 | -} | ||
83 | - | ||
84 | -unix: QMAKE_POST_LINK=mv *.so* ../../../libs | ||
85 | -win32: DLLDESTDIR = ../../../libs |
legacy/input/tracker/gps.xml
deleted
100644 → 0
1 | -<application> | ||
2 | - <defines/> | ||
3 | - <libraries> | ||
4 | - <library name="../../../libs/libgps.so" /> | ||
5 | - </libraries> | ||
6 | - <objects> | ||
7 | - <object classname="GPSWWidget" persistent="true" id="widget" /> | ||
8 | - <object classname="GPSTracker" persistent="true" id="gpstrack" /> | ||
9 | - </objects> | ||
10 | - <sheets> | ||
11 | - <sheet id="start" > | ||
12 | - <preconnection> | ||
13 | - <init value="115200" type="int" slot="setBaudrate(int)" object="gpstrack" /> | ||
14 | - <init value="/dev/tts/USB0" type="string" slot="setDevice(QString)" object="gpstrack" /> | ||
15 | - <init value="1000" type="int" slot="setPeriod(int)" object="gpstrack" /> | ||
16 | - <init value="true" type="bool" slot="setThreaded(bool)" object="gpstrack" /> | ||
17 | - <init value="9" type="int" slot="setFrameCount(int)" object="gpstrack" /> | ||
18 | - <init value="" type="void" slot="init()" object="gpstrack" /> | ||
19 | - <init value="" type="void" slot="show()" object="widget" /> | ||
20 | - </preconnection> | ||
21 | - <connection> | ||
22 | - <wire objsource="gpstrack" objdest="widget" signal="sendNMEAFrame(NMEAFrame)" slot="displayNMEAFrame(NMEAFrame)" /> | ||
23 | - </connection> | ||
24 | - <postconnection> | ||
25 | - <init value="" type="void" slot="start()" object="gpstrack" /> | ||
26 | - </postconnection> | ||
27 | - </sheet> | ||
28 | - </sheets> | ||
29 | - <statemachine terminal="end" initial="start" /> | ||
30 | -</application> |
legacy/input/tracker/gps_start.sh
deleted
100755 → 0
legacy/input/tracker/gpsserial.cpp
deleted
100644 → 0
1 | -#include "gpsserial.h" | ||
2 | -#include <cstdio> | ||
3 | - | ||
4 | - | ||
5 | -GPSSerial::GPSSerial() | ||
6 | -{ | ||
7 | - portOpen = false; | ||
8 | -} | ||
9 | - | ||
10 | - | ||
11 | -bool GPSSerial::openPort(const int portNumber, BaudRates baudrate, const unsigned long inqueueSize, const unsigned long outqueueSize) | ||
12 | -{ | ||
13 | - if (portOpen) | ||
14 | - return true ; | ||
15 | - | ||
16 | - char filename[15]; | ||
17 | -#ifdef WIN32 | ||
18 | - sprintf(filename,"\\\\.\\COM%d",portNumber); | ||
19 | -#else | ||
20 | - sprintf(filename,"/dev/ttyS%d",portNumber); | ||
21 | -#endif | ||
22 | - return openPort(filename, baudrate, inqueueSize, outqueueSize); | ||
23 | -} | ||
24 | - | ||
25 | - | ||
26 | -bool GPSSerial::openPort(const char *portName, BaudRates baudrate, const unsigned long inqueueSize, const unsigned long outqueueSize) | ||
27 | -{ | ||
28 | - if (portOpen) | ||
29 | - return true ; | ||
30 | - | ||
31 | -#ifdef WIN32 | ||
32 | - | ||
33 | - wchar_t wPortName[15]; | ||
34 | - mbstowcs(wPortName,portName, 15); | ||
35 | - | ||
36 | - fd = CreateFile((LPCWSTR)wPortName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); | ||
37 | - if (fd == INVALID_HANDLE_VALUE) | ||
38 | - return false; | ||
39 | - | ||
40 | - // Once here, port is open | ||
41 | - portOpen = true; | ||
42 | - | ||
43 | - //Get the current state & then change it | ||
44 | - DCB dcb; | ||
45 | - | ||
46 | - GetCommState(fd, &dcb); // Get current state | ||
47 | - | ||
48 | - dcb.BaudRate = baudrate; // Setup the baud rate | ||
49 | - dcb.Parity = NOPARITY; // Setup the Parity | ||
50 | - dcb.ByteSize = 8; // Setup the data bits | ||
51 | - dcb.StopBits = ONESTOPBIT; // Setup the stop bits | ||
52 | - dcb.fDsrSensitivity = FALSE; // Setup the flow control | ||
53 | - dcb.fOutxCtsFlow = FALSE; // NoFlowControl: | ||
54 | - dcb.fOutxDsrFlow = FALSE; | ||
55 | - dcb.fOutX = FALSE; | ||
56 | - dcb.fInX = FALSE; | ||
57 | - if (!SetCommState(fd, (LPDCB)&dcb)) | ||
58 | - { | ||
59 | - portOpen = false; | ||
60 | - return false; | ||
61 | - } | ||
62 | - | ||
63 | - // Set COM timeouts | ||
64 | - COMMTIMEOUTS CommTimeouts; | ||
65 | - | ||
66 | - GetCommTimeouts(fd,&CommTimeouts); // Fill CommTimeouts structure | ||
67 | - | ||
68 | - // immediate return if data is available, wait 1ms otherwise | ||
69 | - CommTimeouts.ReadTotalTimeoutConstant = 1; | ||
70 | - CommTimeouts.ReadIntervalTimeout = MAXDWORD; | ||
71 | - CommTimeouts.ReadTotalTimeoutMultiplier = MAXDWORD; | ||
72 | - | ||
73 | - // immediate return whether data is available or not | ||
74 | - SetCommTimeouts(fd, &CommTimeouts); // Set CommTimeouts structure | ||
75 | - | ||
76 | - // Other initialization functions | ||
77 | - SetupComm(fd,inqueueSize,outqueueSize); // Set queue size | ||
78 | - | ||
79 | - SetCommMask(fd, EV_CTS | EV_DSR | EV_BREAK | EV_RING | EV_RXCHAR); | ||
80 | - | ||
81 | - // Remove any 'old' data in buffer | ||
82 | - PurgeComm(fd, PURGE_TXCLEAR | PURGE_RXCLEAR); | ||
83 | - | ||
84 | - return true; | ||
85 | -#else | ||
86 | - struct termios options; | ||
87 | - | ||
88 | - /* Open port */ | ||
89 | - fd = open(portName, O_RDONLY | O_NOCTTY); | ||
90 | - | ||
91 | - | ||
92 | - if (fd < 0) | ||
93 | - return false; | ||
94 | - | ||
95 | - // Once here, port is open | ||
96 | - portOpen = true; | ||
97 | - | ||
98 | - /* Start configuring of port for non-canonical transfer mode */ | ||
99 | - // Get current options for the port | ||
100 | - tcgetattr(fd, &options); | ||
101 | - | ||
102 | - // Set baudrate. | ||
103 | - cfsetispeed(&options, baudrate); | ||
104 | - cfsetospeed(&options, baudrate); | ||
105 | - | ||
106 | - // Enable the receiver and set local mode | ||
107 | - options.c_cflag = (CLOCAL | CREAD | CSIZE | CS8 ); | ||
108 | - // Set character size to data bits and set no parity Mask the characte size bits | ||
109 | - //options.c_cflag &= ~(CSIZE|PARENB); | ||
110 | - //options.c_cflag |= CS8; // Select 8 data bits | ||
111 | - //options.c_cflag &= ~CSTOPB; // send 1 stop bit | ||
112 | - // Disable hardware flow control | ||
113 | - //options.c_cflag &= ~CRTSCTS; | ||
114 | - options.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); | ||
115 | - // Disable software flow control | ||
116 | - options.c_iflag &= 0; //~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); | ||
117 | - // Set Raw output | ||
118 | - options.c_oflag &= ~OPOST; | ||
119 | - // Timeout 0.005 sec for first byte, read minimum of 0 bytes | ||
120 | - options.c_cc[VMIN] = 0; | ||
121 | - options.c_cc[VTIME] = 5; | ||
122 | - | ||
123 | - // Set the new options for the port | ||
124 | - if ( tcsetattr(fd,TCSANOW, &options) < 0) | ||
125 | - { | ||
126 | - portOpen = false; | ||
127 | - return false; | ||
128 | - } | ||
129 | - | ||
130 | - tcflush(fd, TCIOFLUSH); | ||
131 | - | ||
132 | - return true; | ||
133 | -#endif | ||
134 | -} | ||
135 | - | ||
136 | - | ||
137 | -void GPSSerial::flush() | ||
138 | -{ | ||
139 | - if (portOpen) | ||
140 | - { | ||
141 | -#ifdef WIN32 | ||
142 | - PurgeComm(fd, PURGE_TXCLEAR | PURGE_RXCLEAR); | ||
143 | -#else | ||
144 | - tcflush(fd, TCIOFLUSH); | ||
145 | -#endif | ||
146 | - } | ||
147 | -} | ||
148 | - | ||
149 | - | ||
150 | -void GPSSerial::close() | ||
151 | -{ | ||
152 | - if (portOpen) | ||
153 | - { | ||
154 | -#ifdef WIN32 | ||
155 | - flush(); | ||
156 | - CloseHandle(fd); | ||
157 | -#else | ||
158 | - ::close(fd); | ||
159 | -#endif | ||
160 | - } | ||
161 | - portOpen = false; | ||
162 | -} | ||
163 | - | ||
164 | - | ||
165 | -int GPSSerial::readNMEAFrame(unsigned char* buffer, int maxSize) | ||
166 | -{ | ||
167 | - if (!portOpen) | ||
168 | - return 0; | ||
169 | - | ||
170 | - buffer[maxSize-1] = '\0'; | ||
171 | - int i=0; | ||
172 | - | ||
173 | -#ifdef WIN32 | ||
174 | - DWORD bytes; | ||
175 | - BOOL retval; | ||
176 | - do | ||
177 | - { | ||
178 | - retval = ReadFile(fd, &buffer[i], 1 , &bytes, NULL); | ||
179 | - i += bytes ; | ||
180 | - | ||
181 | - } while ( i < maxSize - 1 && buffer[i-1] != '\x0a' && retval ); | ||
182 | -#else | ||
183 | - int bytes; | ||
184 | - do | ||
185 | - { | ||
186 | - bytes = read(fd, &buffer[i],1); | ||
187 | - i ++ ; | ||
188 | - } while ( i < maxSize - 1 && buffer[i-1] != '\x0a' && bytes > 0); | ||
189 | -#endif | ||
190 | - buffer[i] = '\0'; | ||
191 | - return i; | ||
192 | -} | ||
193 | - | ||
194 | -int GPSSerial::waitNMEAFrame(unsigned char* buffer, int maxSize) | ||
195 | -{ | ||
196 | - if (!portOpen ) | ||
197 | - return 0; | ||
198 | - | ||
199 | -#ifdef WIN32 | ||
200 | - BOOL retval; | ||
201 | - DWORD evt; | ||
202 | - retval = WaitCommEvent(fd,&evt, NULL); | ||
203 | - if (retval ) | ||
204 | - { | ||
205 | - if (evt & EV_DSR || evt & EV_CTS || evt & EV_RXCHAR ) | ||
206 | - readNMEAFrame(buffer, maxSize); | ||
207 | - else return 0; | ||
208 | - } | ||
209 | - else | ||
210 | - return 0; | ||
211 | -#else | ||
212 | - struct timeval tv; | ||
213 | - int retval; | ||
214 | - fd_set rfds; | ||
215 | - FD_ZERO(&rfds); | ||
216 | - FD_SET(fd,&rfds); | ||
217 | - | ||
218 | - tv.tv_sec = 10 ; | ||
219 | - tv.tv_usec = 0 ; | ||
220 | - | ||
221 | - retval = select(fd + 1, &rfds, NULL,NULL, &tv); | ||
222 | - | ||
223 | - if (retval == -1) | ||
224 | - return 0; | ||
225 | - else | ||
226 | - return readNMEAFrame(buffer, maxSize); | ||
227 | -#endif | ||
228 | -} |
legacy/input/tracker/gpsserial.h
deleted
100644 → 0
1 | -#ifndef __GPSSERIAL_H__ | ||
2 | -#define __GPSSERIAL_H__ | ||
3 | - | ||
4 | -#ifdef WIN32 | ||
5 | -#include <windows.h> | ||
6 | -#include <conio.h> | ||
7 | -#include <time.h> | ||
8 | -#else | ||
9 | -#include <fcntl.h> /* POSIX Standard: 6.5 File Control Operations */ | ||
10 | -#include <termios.h> /* terminal i/o system, talks to /dev/tty* ports */ | ||
11 | -#include <unistd.h> /* Read function */ | ||
12 | -#include <sys/time.h> /* gettimeofday function */ | ||
13 | -#include <sys/select.h> | ||
14 | -#endif | ||
15 | - | ||
16 | - | ||
17 | -/*! \brief Low-level class for serial connection with GPS. | ||
18 | - * | ||
19 | - * This class is intended to be cross-platform as much as possible. | ||
20 | - * It establishes a serial connection to a GPS. The intent is to recieve NMEA frames. | ||
21 | - * \author Jean-Yves Didier | ||
22 | - * \date February, the 4th, 2008. | ||
23 | - * \ingroup gps | ||
24 | - */ | ||
25 | -class GPSSerial | ||
26 | -{ | ||
27 | -public: | ||
28 | - GPSSerial(); //!< GPS Constructor | ||
29 | - ~GPSSerial() { close(); } //!< GPS Destructor | ||
30 | - | ||
31 | - | ||
32 | - /*! \brief Portable baudrates definitions | ||
33 | - */ | ||
34 | -#ifdef WIN32 | ||
35 | - enum BaudRates { PBR_110 = CBR_110, PBR_300 = CBR_300, PBR_600 = CBR_600, | ||
36 | - PBR_1200 = CBR_1200, PBR_2400 = CBR_2400, PBR_4800 = CBR_4800, | ||
37 | - PBR_9600 = CBR_9600, PBR_19200 = CBR_19200, PBR_38400 = CBR_38400, | ||
38 | - PBR_57600 = CBR_57600, PBR_115200 = CBR_115200 }; | ||
39 | -#else | ||
40 | - enum BaudRates { PBR_110 = B110, PBR_300 = B300, PBR_600 = B600, | ||
41 | - PBR_1200 = B1200, PBR_2400 = B2400, PBR_4800 = B4800, | ||
42 | - PBR_9600 = B9600, PBR_19200 = B19200, PBR_38400 = B38400, | ||
43 | - PBR_57600 = B57600, PBR_115200 = B115200 }; | ||
44 | -#endif | ||
45 | - | ||
46 | - | ||
47 | - /*! \brief Opens the serial connection between PC and GPS | ||
48 | - * | ||
49 | - * This method is mainly intended to connect a serial connection sous windows. | ||
50 | - * | ||
51 | - * \param portNumber a port number, that is to say the number of the COM port. | ||
52 | - */ | ||
53 | - bool openPort(const int portNumber, BaudRates baudrate = PBR_4800, const unsigned long inqueueSize = 4096, const unsigned long outqueueSize = 1024); | ||
54 | - | ||
55 | - /*! \brief Opens the serial connection between PC and GPS | ||
56 | - * | ||
57 | - * This method is the generic purpose connection tool. | ||
58 | - * You just need to indicate which file is representing the serial port. | ||
59 | - * Under unix, this might be <tt>/dev/ttyS0</tt> whereas under windows it should be <tt>\\\\.\\COM0</tt> | ||
60 | - * To simplify configuration: the serial port is intended to communicate with these parameters : | ||
61 | - * <ul> | ||
62 | - * <li> 8 bits for each data byte ;</li> | ||
63 | - * <li> no parity check ;</li> | ||
64 | - * <li> 1 bit stop ;</li> | ||
65 | - * <li> no hardware control.</li> | ||
66 | - * </ul> | ||
67 | - * \param portName name of the file representing the serial device. | ||
68 | - * \param baudrate a baudrate for serial communication ; | ||
69 | - * \param inqueueSize (for windows use only) the queue size for input ; | ||
70 | - * \param outqueueSize (for windows use only) the queue size for output. | ||
71 | - * \return <tt>true</tt> if the communication is established, <tt>false</tt> otherwise. | ||
72 | - */ | ||
73 | - bool openPort(const char *portName, BaudRates baudrate = PBR_4800, const unsigned long inqueueSize = 4096, const unsigned long outqueueSize = 1024); | ||
74 | - | ||
75 | - | ||
76 | - bool isPortOpen() const { return portOpen; } | ||
77 | - /*! \brief Waits for an NMEA Frame from the serial line. | ||
78 | - * | ||
79 | - * This uses something similar to the select system call under unix. | ||
80 | - * \param buffer a buffer where NMEA Frame should be written. Note this buffer should be allocated. | ||
81 | - * \param maxSize the buffer size. | ||
82 | - * \return the number of read characters. | ||
83 | - */ | ||
84 | - int waitNMEAFrame(unsigned char* buffer,int maxSize=128); | ||
85 | - | ||
86 | - /*! \brief Reads an NMEA Frame from the serial line. | ||
87 | - * | ||
88 | - * \param buffer a buffer where NMEA Frame should be written. Note this buffer should be allocated. | ||
89 | - * \param maxSize the buffer size. | ||
90 | - * \return the number of read characters. | ||
91 | - */ | ||
92 | - int readNMEAFrame(unsigned char* buffer,int maxSize=128); | ||
93 | - | ||
94 | - void close();//!< Closes the serial port | ||
95 | - void flush();//!< Flushes all the data in the internal buffer associated to serial line. | ||
96 | - | ||
97 | - | ||
98 | -private: | ||
99 | -#ifdef WIN32 | ||
100 | - HANDLE fd ; | ||
101 | -#else | ||
102 | - int fd; | ||
103 | -#endif | ||
104 | - bool portOpen; | ||
105 | -}; | ||
106 | - | ||
107 | - | ||
108 | - | ||
109 | - | ||
110 | -#endif //__GPSSERIAL_H__ |
legacy/input/tracker/gpstester.cpp
deleted
100644 → 0
1 | -#include "gpsserial.h" | ||
2 | -#include <iostream> | ||
3 | - | ||
4 | -/* Simple GPS serial test program | ||
5 | - compile with : | ||
6 | - g++ gpstester.cpp gpsserial.cpp -o testgps | ||
7 | -*/ | ||
8 | - | ||
9 | - | ||
10 | -int main(int argc, char* argv[]) | ||
11 | -{ | ||
12 | - GPSSerial gps; | ||
13 | - int i; | ||
14 | - | ||
15 | - gps.openPort("/dev/rfcomm0", GPSSerial::PBR_115200); | ||
16 | - unsigned char frame[128]; | ||
17 | - | ||
18 | - if (!gps.isPortOpen()) | ||
19 | - { | ||
20 | - std::cerr << "Port not opened" << std::endl; | ||
21 | - } | ||
22 | - | ||
23 | - for(int i=0; i < 100; i++) | ||
24 | - { | ||
25 | - int res; | ||
26 | - res = gps.readNMEAFrame(frame,128); | ||
27 | - if (res > 3) | ||
28 | - std::cout << "Frame #" << i << " " << res << " " << frame ; | ||
29 | - } | ||
30 | - gps.close(); | ||
31 | - | ||
32 | - return 0; | ||
33 | -} |
legacy/input/tracker/gpstracker.cpp
deleted
100644 → 0
1 | -#include "gpstracker.h" | ||
2 | - | ||
3 | -#define NUM_BAUDRATES 11 | ||
4 | - | ||
5 | -long unsigned int GPSTracker::baudrates[][2] = { | ||
6 | - { GPSSerial::PBR_110, 110 }, { GPSSerial::PBR_300, 300 }, { GPSSerial::PBR_600, 600 }, | ||
7 | - { GPSSerial::PBR_1200, 1200 }, { GPSSerial::PBR_2400, 2400 }, { GPSSerial::PBR_4800, 4800 }, | ||
8 | - { GPSSerial::PBR_9600, 9600 }, { GPSSerial::PBR_19200, 19200}, { GPSSerial::PBR_38400, 38400 }, | ||
9 | - { GPSSerial::PBR_57600, 57600 }, { GPSSerial::PBR_115200, 115200 }}; | ||
10 | - | ||
11 | - | ||
12 | -GPSTracker::GPSTracker(QObject* parent, const char* name) : QObject(parent, name) | ||
13 | -{ | ||
14 | - period = 0; | ||
15 | - baudrate = GPSSerial::PBR_4800; | ||
16 | - port = 0; | ||
17 | - frameCount =1; | ||
18 | - device = "/etc/ttyS0" ; | ||
19 | - autoSend = false; | ||
20 | - initialized = false; | ||
21 | -} | ||
22 | - | ||
23 | -GPSTracker::~GPSTracker() | ||
24 | -{ | ||
25 | - if (gps.isPortOpen()) | ||
26 | - { | ||
27 | - gps.flush(); | ||
28 | - gps.close(); | ||
29 | - } | ||
30 | -} | ||
31 | - | ||
32 | - | ||
33 | -void GPSTracker::init() | ||
34 | -{ | ||
35 | - | ||
36 | -#ifdef WIN32 | ||
37 | - if (!gps.openPort(port, (GPSSerial::BaudRates)computeRealBaudrate())) | ||
38 | -#else | ||
39 | - if (!gps.openPort(device.ascii(),(GPSSerial::BaudRates)computeRealBaudrate())) | ||
40 | -#endif | ||
41 | - { | ||
42 | - #ifdef WIN32 | ||
43 | - std::cerr << "[GPS] Cannot access GPS. num port" << port << std::endl; | ||
44 | - #else | ||
45 | - std::cerr << "[GPS] Cannot access GPS. " << device.ascii() << std::endl; | ||
46 | - #endif | ||
47 | - | ||
48 | - return ; | ||
49 | - } | ||
50 | - | ||
51 | - initialized = true; | ||
52 | - startTime.start(); // = QTime::currentTime(); | ||
53 | - double ts = startTime.getValue();//(double)(startTime.hour()*3600 + startTime.minute()*60 + startTime.second()) | ||
54 | - //+ (double)(startTime.msec())/1000.0; | ||
55 | - std::cout<<std::fixed<<"[GPS] start "<<ts<<std::endl; | ||
56 | - emit sendStartTime(ts); | ||
57 | -} | ||
58 | - | ||
59 | - | ||
60 | -void GPSTracker::start() | ||
61 | -{ | ||
62 | - if (!initialized) | ||
63 | - return ; | ||
64 | - | ||
65 | - //std::cout << "[GPS] Starting recieving GPS Frames" << std::endl; | ||
66 | - | ||
67 | - if (autoSend) | ||
68 | - { | ||
69 | - std::cout << "[GPS] GPS in threaded mode" << std::endl; | ||
70 | - connect( &selfTimer, SIGNAL(timeout()), this, SLOT(sendData())); | ||
71 | - selfTimer.start(period); | ||
72 | - gps.flush(); | ||
73 | - } | ||
74 | -} | ||
75 | - | ||
76 | -void GPSTracker::stop() | ||
77 | -{ | ||
78 | - if (!initialized) | ||
79 | - return ; | ||
80 | - | ||
81 | - if (autoSend) | ||
82 | - { | ||
83 | - selfTimer.stop(); | ||
84 | - disconnect(&selfTimer, SIGNAL(timeout()), this, SLOT(sendData())); | ||
85 | - } | ||
86 | -} | ||
87 | - | ||
88 | -void GPSTracker::sendData() | ||
89 | -{ | ||
90 | - if( !initialized) | ||
91 | - return; | ||
92 | - | ||
93 | - unsigned char frameContent[128]; | ||
94 | - int res; | ||
95 | - | ||
96 | - //std::cout << "[GPS] Recieving frames " << std::endl; | ||
97 | - startTime.start(); | ||
98 | - | ||
99 | - // emit sendTimeStamp(startTime.getValue()); | ||
100 | - //std::cout << "[GPS] elapsed time " << startTime.getValue() << std::endl; | ||
101 | - for (int i = 0; i < frameCount; i++) | ||
102 | - { | ||
103 | - do | ||
104 | - { | ||
105 | - res = gps.readNMEAFrame(frameContent,128); | ||
106 | - } while (res < 3); | ||
107 | - emit sendTimeStamp(startTime.getValue()); | ||
108 | - sendNMEAFrame(NMEAFrame(QString((char*)frameContent))); | ||
109 | - } | ||
110 | - // std::cout << "[GPS] frames sent" << std::endl; | ||
111 | -} | ||
112 | - | ||
113 | -long unsigned int GPSTracker::computeRealBaudrate() | ||
114 | -{ | ||
115 | - if (baudrate > baudrates[NUM_BAUDRATES-1][1]) | ||
116 | - return baudrates[NUM_BAUDRATES-1][0]; | ||
117 | - | ||
118 | - for (int i=1; i< NUM_BAUDRATES; i++) | ||
119 | - { | ||
120 | - if ( baudrate < baudrates[i][1]) | ||
121 | - { | ||
122 | - std::cerr << "[GPS] Setting baudrate to "<< baudrates[i-1][1] << " bps"<<std::endl; | ||
123 | - return baudrates[i-1][0]; | ||
124 | - } | ||
125 | - } | ||
126 | - | ||
127 | - return GPSSerial::PBR_4800 ; | ||
128 | -} |
legacy/input/tracker/gpstracker.h
deleted
100644 → 0
1 | -#ifndef __GPSTRACKER_H__ | ||
2 | -#define __GPSTRACKER_H__ | ||
3 | - | ||
4 | -#include <qobject.h> | ||
5 | -#include <qtimer.h> | ||
6 | - | ||
7 | -#include "gpsserial.h" | ||
8 | -#include "nmea.h" | ||
9 | -#include "../../include/atime.h" | ||
10 | - | ||
11 | - | ||
12 | -/*! \defgroup gps GPS sensor related classes. | ||
13 | - * | ||
14 | - * This is a set of classes built to collect, extract and parse GPS Data using NMEA Frames collected | ||
15 | - * over a serial line. | ||
16 | - * \ingroup tracker | ||
17 | - */ | ||
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | ||
22 | -/*! \brief The ARCS Component to collect GPS data over a serial line. | ||
23 | - * | ||
24 | - * The GPS data collection is performed using a GPSSerial object. | ||
25 | - * \author Jean-Yves Didier | ||
26 | - * \date February, the 4th, 2008. | ||
27 | - * \ingroup gps | ||
28 | - */ | ||
29 | -class GPSTracker : public QObject | ||
30 | -{ | ||
31 | -Q_OBJECT | ||
32 | - | ||
33 | -public: | ||
34 | -GPSTracker(QObject* parent=0, const char* name=0); //!< ARCS Constructor | ||
35 | -~GPSTracker(); //!< ARCS Destructor | ||
36 | - | ||
37 | -public slots: | ||
38 | -/*! \brief The port number to open | ||
39 | - * | ||
40 | - * This should be called before init(). | ||
41 | - * It sets the port number to use to collect serial data from GPS. | ||
42 | - * This is mainly for windows use. | ||
43 | - * \param i the port number to use e.g. if using COM0, you should use 0 as a parameter of this function. | ||
44 | - */ | ||
45 | - void setPort(int i) { port = i;} | ||
46 | - | ||
47 | -/*! \brief The device filename to open. | ||
48 | - * This should be called before init(). | ||
49 | - * \param s the device filename. | ||
50 | - */ | ||
51 | -void setDevice(QString s) { device = s;} | ||
52 | - | ||
53 | -/*!\brief Inits the GPS serial line. | ||
54 | - * From this point, data can be collected. | ||
55 | - */ | ||
56 | -void init(); | ||
57 | -/*! \brief Tells wether the data collection process is pseudo-threaded or not. | ||
58 | - * Events are actually used so this is not really a thread. | ||
59 | - * This must be called before start(). | ||
60 | - * When start() is called, events may be triggered periodically. | ||
61 | - * This event will in return trigger the sendData() slot. | ||
62 | - * \param b Set it to <tt>true</tt> to activate pseudo-threaded behaviour. | ||
63 | - */ | ||
64 | -void setThreaded(bool b) {autoSend = b; } | ||
65 | -/*! \brief Sets the baudrate of the serial line. | ||
66 | - */ | ||
67 | -void setBaudrate(int i) { baudrate = i; } | ||
68 | - | ||
69 | -/*! \brief Sets the period of a data collection cycle. | ||
70 | - * \param i The period expressed in milliseconds. Usually you will have something around 1000 msec. | ||
71 | - */ | ||
72 | -void setPeriod(int i) { period=i; } | ||
73 | - | ||
74 | -/*!\brief Sets the number of frames constituing the data to read. | ||
75 | - * A GPS can send several NMEA frames at the same time. | ||
76 | - * This is intended to group the frame packets in one send. | ||
77 | - * \param i The number of frames returned at once by the GPS reciever. | ||
78 | - */ | ||
79 | -void setFrameCount(int i) { frameCount = i; } | ||
80 | -void start(); //!< Starts the GPS data collection. init() muste have been called before. | ||
81 | -void stop(); //!< Stops the GPS data collection. | ||
82 | - | ||
83 | -/*! \brief The actual collection process | ||
84 | - * | ||
85 | - * Triggers a sendNMEAFrame() signal. | ||
86 | - */ | ||
87 | -void sendData(); | ||
88 | - | ||
89 | -signals: | ||
90 | -void sendNMEAFrame(NMEAFrame); //!< Sends the newly acquired NMEAFrame | ||
91 | -void sendTimeStamp(double); //!< Sends a timestamp associated to the time of nmea frame acquisition | ||
92 | -void sendStartTime(double); | ||
93 | -private: | ||
94 | -long unsigned int computeRealBaudrate(); | ||
95 | - | ||
96 | -static long unsigned int baudrates[][2]; | ||
97 | - | ||
98 | - | ||
99 | -GPSSerial gps; | ||
100 | - | ||
101 | -QTimer selfTimer; | ||
102 | -int period; | ||
103 | -int baudrate; | ||
104 | - | ||
105 | -int port; | ||
106 | -QString device; | ||
107 | -bool autoSend; | ||
108 | -bool initialized; | ||
109 | - | ||
110 | -int frameCount; | ||
111 | - | ||
112 | -ATime startTime; | ||
113 | -}; | ||
114 | - | ||
115 | - | ||
116 | - | ||
117 | -#endif //__GPSTRACKER_H__ |
1 | -#include "gpstranslator.h" | ||
2 | - | ||
3 | - | ||
4 | -GPSTranslator::GPSTranslator(QObject* parent, const char* name) : QObject(parent, name) | ||
5 | -{ | ||
6 | - clearData(); | ||
7 | - frameAmount = 1; | ||
8 | - currentData.validityMask = 0; | ||
9 | - frameCnt = 0; | ||
10 | -} | ||
11 | - | ||
12 | -void GPSTranslator::clearData() | ||
13 | -{ | ||
14 | - currentData.validityMask = 0; | ||
15 | - frameCnt = 0; | ||
16 | -} | ||
17 | - | ||
18 | -double GPSTranslator::nmeaAngleToDouble(NMEAAngle a) | ||
19 | -{ | ||
20 | - double res = a.degrees + a.minutes / 60.0 ; | ||
21 | - switch (a.direction) | ||
22 | - { | ||
23 | - case 'S': case 'E': | ||
24 | - res = -res ; | ||
25 | - } | ||
26 | - return res; | ||
27 | -} | ||
28 | - | ||
29 | -float GPSTranslator::nmeaTimeToFloat(NMEATime t) | ||
30 | -{ | ||
31 | - return (t.seconds + (t.hours * 60 + t.minutes) * 60 ); | ||
32 | -} | ||
33 | - | ||
34 | -void GPSTranslator::handleGGAFrame(NMEAFrameGGA frame) | ||
35 | -{ | ||
36 | - NMEAAngle lon = frame.getLongitude(); | ||
37 | - NMEAAngle lat = frame.getLatitude(); | ||
38 | - NMEATime tm = frame.getUTCTime(); | ||
39 | - | ||
40 | - if (lon.valid && !(currentData.validityMask & GPS_LONG )) | ||
41 | - { | ||
42 | - currentData.longitude = nmeaAngleToDouble(lon); | ||
43 | - currentData.validityMask |= GPS_LONG ; | ||
44 | - } | ||
45 | - | ||
46 | - if (lat.valid && !(currentData.validityMask & GPS_LAT)) | ||
47 | - { | ||
48 | - currentData.latitude = nmeaAngleToDouble(lat); | ||
49 | - currentData.validityMask |= GPS_LAT ; | ||
50 | - } | ||
51 | - | ||
52 | - if (tm.valid && ! (currentData.validityMask & GPS_TIME)) | ||
53 | - { | ||
54 | - currentData.time = nmeaTimeToFloat(tm); | ||
55 | - currentData.validityMask |= GPS_TIME ; | ||
56 | - } | ||
57 | - | ||
58 | - if (! ( currentData.validityMask & GPS_NBSAT) ) | ||
59 | - currentData.nbSat = frame.getSVNumber(); | ||
60 | - if (! ( currentData.validityMask & GPS_Z )) | ||
61 | - currentData.z = frame.getAntennaHeight(); | ||
62 | - if (! ( currentData.validityMask & GPS_DOP)) | ||
63 | - currentData.dop = frame.getDOP(); | ||
64 | - | ||
65 | - currentData.validityMask |= GPS_DOP | GPS_NBSAT | GPS_Z ; | ||
66 | -} | ||
67 | - | ||
68 | -void GPSTranslator::handleRMCFrame(NMEAFrameRMC frame) | ||
69 | -{ | ||
70 | - NMEAAngle lon = frame.getLongitude(); | ||
71 | - NMEAAngle lat = frame.getLatitude(); | ||
72 | - float cape = frame.getTrackAngle(); | ||
73 | - NMEATime tm = frame.getUTCTime(); | ||
74 | - | ||
75 | - if (lon.valid && !(currentData.validityMask & GPS_LONG )) | ||
76 | - { | ||
77 | - currentData.longitude = nmeaAngleToDouble(lon); | ||
78 | - currentData.validityMask |= GPS_LONG ; | ||
79 | - } | ||
80 | - | ||
81 | - if (lat.valid && !(currentData.validityMask & GPS_LAT)) | ||
82 | - { | ||
83 | - currentData.latitude = nmeaAngleToDouble(lat); | ||
84 | - currentData.validityMask |= GPS_LAT ; | ||
85 | - } | ||
86 | - | ||
87 | - if (tm.valid && ! (currentData.validityMask & GPS_TIME)) | ||
88 | - { | ||
89 | - currentData.time = nmeaTimeToFloat(tm); | ||
90 | - currentData.validityMask |= GPS_TIME ; | ||
91 | - } | ||
92 | - | ||
93 | - if (! (currentData.validityMask & GPS_CAPE)) | ||
94 | - { | ||
95 | - currentData.cape = cape; | ||
96 | - currentData.validityMask |= GPS_CAPE ; | ||
97 | - } | ||
98 | -} | ||
99 | - | ||
100 | - | ||
101 | -void GPSTranslator::handleVTGFrame(NMEAFrameVTG frame) | ||
102 | -{ | ||
103 | - float cape = frame.getTrackAngle(); | ||
104 | - | ||
105 | - if ( ! (currentData.validityMask & GPS_CAPE)) | ||
106 | - { | ||
107 | - currentData.cape = cape; | ||
108 | - currentData.validityMask |= GPS_CAPE ; | ||
109 | - } | ||
110 | - | ||
111 | - if ( ! (currentData.validityMask & GPS_SPEED)) | ||
112 | - currentData.speed = frame.getKMSpeed(); | ||
113 | - | ||
114 | - currentData.validityMask |= GPS_SPEED; | ||
115 | -} | ||
116 | - | ||
117 | -void GPSTranslator::setNMEAFrame(NMEAFrame nmea) | ||
118 | -{ | ||
119 | - | ||
120 | - if (nmea.extractType() == "GGA" ) | ||
121 | - handleGGAFrame(NMEAFrameGGA(nmea)); | ||
122 | - | ||
123 | - if (nmea.extractType() == "RMC" ) | ||
124 | - handleRMCFrame(NMEAFrameRMC(nmea)); | ||
125 | - | ||
126 | - if (nmea.extractType() == "VTG") | ||
127 | - handleVTGFrame(NMEAFrameVTG(nmea)); | ||
128 | - | ||
129 | - /* put here something to determine how many frames have been processed */ | ||
130 | - | ||
131 | - frameCnt ++ ; | ||
132 | - if (frameCnt == frameAmount) | ||
133 | - { | ||
134 | - emit sendGPSData(currentData); | ||
135 | - clearData(); | ||
136 | - } | ||
137 | -} | ||
138 | - | ||
139 | - | ||
140 | - | ||
141 | - | ||
142 | - | ||
143 | - | ||
144 | - |
legacy/input/tracker/gpstranslator.h
deleted
100644 → 0
1 | -#ifndef __GPS_TRANSLATOR_H__ | ||
2 | -#define __GPS_TRANSLATOR_H__ | ||
3 | - | ||
4 | -#include <qobject.h> | ||
5 | - | ||
6 | -#include "nmea.h" | ||
7 | - | ||
8 | - | ||
9 | -//* \todo maintain compatibility of structs | ||
10 | - | ||
11 | -enum GPSValidity { | ||
12 | - GPS_TIME = 0x01, | ||
13 | - GPS_LONG = 0x02, | ||
14 | - GPS_LAT = 0x04, | ||
15 | - GPS_DOP = 0x08, | ||
16 | - GPS_NBSAT = 0x10, | ||
17 | - GPS_Z = 0x20, | ||
18 | - GPS_SPEED = 0x40, | ||
19 | - GPS_CAPE = 0x80 | ||
20 | -}; | ||
21 | - | ||
22 | - | ||
23 | -/*! \brief This structure should contain the data gathered from | ||
24 | - * the GPS reciever. | ||
25 | - * | ||
26 | - * The GPS data needed are : | ||
27 | - * <ul> | ||
28 | - * <li>the clock ;</li> | ||
29 | - * <li>dop (hdop and pdop) if available ; </li> | ||
30 | - * <li>nb_sat ;</li> | ||
31 | - * <li>longitude ;</li> | ||
32 | - * <li>latiude ; </li> | ||
33 | - * <li>speed over ground ;</li> | ||
34 | - * <li>cape </li> | ||
35 | - * </ul> | ||
36 | - * \ingroup gps | ||
37 | - */ | ||
38 | -typedef struct { | ||
39 | - float time; //!< time elapsed since 00:00 | ||
40 | - float dop; //!< dop factor | ||
41 | - int nbSat; //!< number of satelites | ||
42 | - double longitude; //!< longitude | ||
43 | - double latitude; //!< latitude | ||
44 | - double z; //!< height | ||
45 | - float speed; //!< speed over ground | ||
46 | - double cape; //!< direction | ||
47 | - unsigned char validityMask; | ||
48 | -} GPSData ; | ||
49 | - | ||
50 | - | ||
51 | -/*! \brief This class should handle NMEA Frames and translate them into a GPSData structure. | ||
52 | - * | ||
53 | - * \author Jean-Yves Didier | ||
54 | - * \date September, the 26th, 2008 | ||
55 | - * \ingroup gps | ||
56 | - */ | ||
57 | -class GPSTranslator : public QObject | ||
58 | -{ | ||
59 | -Q_OBJECT | ||
60 | - | ||
61 | -public: | ||
62 | - GPSTranslator(QObject* parent = 0, const char* name=0); //!< ARCS Constructor | ||
63 | - | ||
64 | -public slots: | ||
65 | - void setFrameAmount(int i) { frameAmount = i; } //!< Sets the number of frame to process before sending gps data. | ||
66 | - void setNMEAFrame(NMEAFrame nmea); //!< Sets the nmea frame to process | ||
67 | - | ||
68 | -signals: | ||
69 | - void sendGPSData(GPSData gd); //!< Sends the newly processed GPS Data | ||
70 | - | ||
71 | -private: | ||
72 | - void handleGGAFrame(NMEAFrameGGA frame); | ||
73 | - void handleRMCFrame(NMEAFrameRMC frame); | ||
74 | - void handleVTGFrame(NMEAFrameVTG frame); | ||
75 | - | ||
76 | - void clearData(); | ||
77 | - double nmeaAngleToDouble(NMEAAngle a); | ||
78 | - float nmeaTimeToFloat(NMEATime t); | ||
79 | - | ||
80 | - int frameAmount; | ||
81 | - GPSData currentData; | ||
82 | - int frameCnt; | ||
83 | -}; | ||
84 | - | ||
85 | -#endif //__GPS_TRANSLATOR_H__ |
legacy/input/tracker/gpswidget.ui
deleted
100644 → 0
1 | -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> | ||
2 | -<class>GPSWidget</class> | ||
3 | -<widget class="QWidget"> | ||
4 | - <property name="name"> | ||
5 | - <cstring>GPSWidget</cstring> | ||
6 | - </property> | ||
7 | - <property name="geometry"> | ||
8 | - <rect> | ||
9 | - <x>0</x> | ||
10 | - <y>0</y> | ||
11 | - <width>203</width> | ||
12 | - <height>140</height> | ||
13 | - </rect> | ||
14 | - </property> | ||
15 | - <property name="caption"> | ||
16 | - <string>GPS Values</string> | ||
17 | - </property> | ||
18 | - <widget class="QLabel"> | ||
19 | - <property name="name"> | ||
20 | - <cstring>label2</cstring> | ||
21 | - </property> | ||
22 | - <property name="geometry"> | ||
23 | - <rect> | ||
24 | - <x>10</x> | ||
25 | - <y>10</y> | ||
26 | - <width>70</width> | ||
27 | - <height>21</height> | ||
28 | - </rect> | ||
29 | - </property> | ||
30 | - <property name="text"> | ||
31 | - <string>Latitude :</string> | ||
32 | - </property> | ||
33 | - </widget> | ||
34 | - <widget class="QLabel"> | ||
35 | - <property name="name"> | ||
36 | - <cstring>label1</cstring> | ||
37 | - </property> | ||
38 | - <property name="geometry"> | ||
39 | - <rect> | ||
40 | - <x>10</x> | ||
41 | - <y>40</y> | ||
42 | - <width>70</width> | ||
43 | - <height>21</height> | ||
44 | - </rect> | ||
45 | - </property> | ||
46 | - <property name="text"> | ||
47 | - <string>Longitude :</string> | ||
48 | - </property> | ||
49 | - </widget> | ||
50 | - <widget class="QLabel"> | ||
51 | - <property name="name"> | ||
52 | - <cstring>label4</cstring> | ||
53 | - </property> | ||
54 | - <property name="geometry"> | ||
55 | - <rect> | ||
56 | - <x>10</x> | ||
57 | - <y>70</y> | ||
58 | - <width>70</width> | ||
59 | - <height>21</height> | ||
60 | - </rect> | ||
61 | - </property> | ||
62 | - <property name="text"> | ||
63 | - <string>DOP :</string> | ||
64 | - </property> | ||
65 | - </widget> | ||
66 | - <widget class="QLabel"> | ||
67 | - <property name="name"> | ||
68 | - <cstring>latitude</cstring> | ||
69 | - </property> | ||
70 | - <property name="geometry"> | ||
71 | - <rect> | ||
72 | - <x>80</x> | ||
73 | - <y>10</y> | ||
74 | - <width>111</width> | ||
75 | - <height>20</height> | ||
76 | - </rect> | ||
77 | - </property> | ||
78 | - <property name="frameShape"> | ||
79 | - <enum>Box</enum> | ||
80 | - </property> | ||
81 | - <property name="text"> | ||
82 | - <string>-</string> | ||
83 | - </property> | ||
84 | - </widget> | ||
85 | - <widget class="QLabel"> | ||
86 | - <property name="name"> | ||
87 | - <cstring>longitude</cstring> | ||
88 | - </property> | ||
89 | - <property name="geometry"> | ||
90 | - <rect> | ||
91 | - <x>80</x> | ||
92 | - <y>40</y> | ||
93 | - <width>111</width> | ||
94 | - <height>20</height> | ||
95 | - </rect> | ||
96 | - </property> | ||
97 | - <property name="frameShape"> | ||
98 | - <enum>Box</enum> | ||
99 | - </property> | ||
100 | - <property name="text"> | ||
101 | - <string>-</string> | ||
102 | - </property> | ||
103 | - </widget> | ||
104 | - <widget class="QLabel"> | ||
105 | - <property name="name"> | ||
106 | - <cstring>dop</cstring> | ||
107 | - </property> | ||
108 | - <property name="geometry"> | ||
109 | - <rect> | ||
110 | - <x>80</x> | ||
111 | - <y>70</y> | ||
112 | - <width>111</width> | ||
113 | - <height>20</height> | ||
114 | - </rect> | ||
115 | - </property> | ||
116 | - <property name="frameShape"> | ||
117 | - <enum>Box</enum> | ||
118 | - </property> | ||
119 | - <property name="text"> | ||
120 | - <string>-</string> | ||
121 | - </property> | ||
122 | - </widget> | ||
123 | - <widget class="QLCDNumber"> | ||
124 | - <property name="name"> | ||
125 | - <cstring>sv</cstring> | ||
126 | - </property> | ||
127 | - <property name="geometry"> | ||
128 | - <rect> | ||
129 | - <x>120</x> | ||
130 | - <y>100</y> | ||
131 | - <width>70</width> | ||
132 | - <height>30</height> | ||
133 | - </rect> | ||
134 | - </property> | ||
135 | - <property name="numDigits"> | ||
136 | - <number>2</number> | ||
137 | - </property> | ||
138 | - </widget> | ||
139 | - <widget class="QLabel"> | ||
140 | - <property name="name"> | ||
141 | - <cstring>label3</cstring> | ||
142 | - </property> | ||
143 | - <property name="geometry"> | ||
144 | - <rect> | ||
145 | - <x>10</x> | ||
146 | - <y>100</y> | ||
147 | - <width>110</width> | ||
148 | - <height>30</height> | ||
149 | - </rect> | ||
150 | - </property> | ||
151 | - <property name="text"> | ||
152 | - <string>Satellites in view :</string> | ||
153 | - </property> | ||
154 | - </widget> | ||
155 | -</widget> | ||
156 | -<includes> | ||
157 | - <include location="local" impldecl="in declaration">nmea.h</include> | ||
158 | - <include location="local" impldecl="in implementation">gpswidget.ui.h</include> | ||
159 | -</includes> | ||
160 | -<slots> | ||
161 | - <slot specifier="non virtual">displayNMEAFrame( NMEAFrame f )</slot> | ||
162 | -</slots> | ||
163 | -<layoutdefaults spacing="6" margin="11"/> | ||
164 | -</UI> |
legacy/input/tracker/gpswidget.ui.h
deleted
100644 → 0
1 | -/**************************************************************************** | ||
2 | -** ui.h extension file, included from the uic-generated form implementation. | ||
3 | -** | ||
4 | -** If you want to add, delete, or rename functions or slots, use | ||
5 | -** Qt Designer to update this file, preserving your code. | ||
6 | -** | ||
7 | -** You should not define a constructor or destructor in this file. | ||
8 | -** Instead, write your code in functions called init() and destroy(). | ||
9 | -** These will automatically be called by the form's constructor and | ||
10 | -** destructor. | ||
11 | -*****************************************************************************/ | ||
12 | - | ||
13 | - | ||
14 | -/*! \class GPSWidget A simple widget to display GPS values | ||
15 | - * \author Jean-Yves Didier | ||
16 | - * \date February, the 4th, 2008 | ||
17 | - * \ingroup gps | ||
18 | - */ | ||
19 | - | ||
20 | - | ||
21 | -/*! \brief This slot intends to display GPS values | ||
22 | - * \param f A NMEAFrame containing GPS data. | ||
23 | - */ | ||
24 | -void GPSWidget::displayNMEAFrame( NMEAFrame f ) | ||
25 | -{ | ||
26 | - longitude->setText("-NC-"); | ||
27 | - latitude->setText("-NC-"); | ||
28 | - | ||
29 | - //std::cout<<f.getRawFrame()<<std::endl; | ||
30 | - if (f.extractType() == "GGA") | ||
31 | - { | ||
32 | - //std::cout<<"GGA trame"<<std::endl; | ||
33 | - NMEAFrameGGA frame(f); //!< \todo Assess this dirty line. It should do the trick. | ||
34 | - NMEAAngle lon = frame.getLongitude(); | ||
35 | - NMEAAngle lat = frame.getLatitude(); | ||
36 | - | ||
37 | - if (lon.valid) | ||
38 | - { | ||
39 | - QString llon = QString::number(lon.degrees) + "°" + QString::number(lon.minutes) + "' " + lon.direction ; | ||
40 | - longitude->setText(llon); | ||
41 | - longitude->update(); | ||
42 | - std::cout<<"longitude "<<llon<<std::endl; | ||
43 | - } | ||
44 | - | ||
45 | - if (lat.valid) | ||
46 | - { | ||
47 | - QString llat = QString::number(lat.degrees) + "°" + QString::number(lat.minutes) + "' " + lat.direction ; | ||
48 | - latitude->setText(llat); | ||
49 | - latitude->update(); | ||
50 | - std::cout<<"latitude "<<llat<<std::endl; | ||
51 | - } | ||
52 | - | ||
53 | - dop->setText(QString::number(frame.getDOP())); | ||
54 | - dop->update(); | ||
55 | - sv->display(frame.getSVNumber()); | ||
56 | - } | ||
57 | -} |
legacy/input/tracker/gpswwidget.h
deleted
100644 → 0
1 | -#ifndef __GPSWWIDGET_H__ | ||
2 | -#define __GPSWWIDGET_H__ | ||
3 | - | ||
4 | -#include "gpswidget.h" | ||
5 | - | ||
6 | -/*! \brief This is an ARCS wrapper for the GPSWidget control panel. | ||
7 | - * \author Jean-Yves Didier | ||
8 | - * \date February, the 4th, 2008. | ||
9 | - * \ingroup gps | ||
10 | - */ | ||
11 | -class GPSWWidget : public GPSWidget | ||
12 | -{ | ||
13 | -Q_OBJECT | ||
14 | - public: | ||
15 | -/*! ARCS Constructor | ||
16 | - */ | ||
17 | -GPSWWidget(QObject* parent=0, const char* name=0) | ||
18 | - : GPSWidget(dynamic_cast<QWidget*>(parent), name) {} | ||
19 | -}; | ||
20 | - | ||
21 | - | ||
22 | -#endif //__GPSWWIDGET_H__ |
legacy/input/tracker/lib.cpp
deleted
100644 → 0
1 | -#include <metalibrary/metalibrarytoolkit.h> | ||
2 | -#include "gpswwidget.h" | ||
3 | -#include "gpstracker.h" | ||
4 | -#include "gpstranslator.h" | ||
5 | -#include "gpslog.h" | ||
6 | -#include "gpstoogr.h" | ||
7 | -#include "triggps.h" | ||
8 | -#include "synsensor.h" | ||
9 | -#include "synchro.h" | ||
10 | - | ||
11 | -METALIB_BEGIN | ||
12 | -METALIB_OBJECT(GPSTracker) | ||
13 | -METALIB_OBJECT(GPSWWidget) | ||
14 | -METALIB_OBJECT(GPSTranslator) | ||
15 | -METALIB_OBJECT(GPSLogger) | ||
16 | -METALIB_OBJECT(LoadGps) | ||
17 | -METALIB_OBJECT(GpsToOgr) | ||
18 | -METALIB_OBJECT(SetAltitude) | ||
19 | -METALIB_OBJECT(SynSensor) | ||
20 | -METALIB_OBJECT(GpsTrigger) | ||
21 | -METALIB_OBJECT(Synchro) | ||
22 | -METALIB_END |
... | @@ -178,7 +178,7 @@ void MTiTracker::init() | ... | @@ -178,7 +178,7 @@ void MTiTracker::init() |
178 | if (tracker.openPort(qPrintable(device)) != MTRV_OK) | 178 | if (tracker.openPort(qPrintable(device)) != MTRV_OK) |
179 | #endif | 179 | #endif |
180 | { | 180 | { |
181 | - std::cerr << "[MTi] Cannot open device. " << std::endl ; | 181 | + std::cerr << "[MTi] Cannot open device: " << qPrintable(device) << std::endl ; |
182 | return ; | 182 | return ; |
183 | } | 183 | } |
184 | if (tracker.writeMessage(MID_GOTOCONFIG) != MTRV_OK) | 184 | if (tracker.writeMessage(MID_GOTOCONFIG) != MTRV_OK) | ... | ... |
legacy/input/tracker/nmea.cpp
deleted
100644 → 0
1 | -#include "nmea.h" | ||
2 | -#include <qstringlist.h> | ||
3 | -#include <iostream> | ||
4 | - | ||
5 | -bool NMEAFrame::isChecksumValid(QString s) | ||
6 | -{ | ||
7 | - unsigned char checksum = 0; | ||
8 | - int i=0; | ||
9 | - | ||
10 | - if (s[0].latin1() != '$') | ||
11 | - return false; | ||
12 | - | ||
13 | - for ( i=1; i < s.length() && s[i].latin1() != '*'; i++ ) | ||
14 | - checksum ^= (unsigned char)s[i].latin1(); | ||
15 | - | ||
16 | - i++; | ||
17 | - if (s.length() < i + 2) | ||
18 | - return false; | ||
19 | - | ||
20 | - bool ok; | ||
21 | - | ||
22 | - unsigned int cmp = s.mid(i,2).toUInt(&ok, 16); | ||
23 | - | ||
24 | - if (!ok) | ||
25 | - return false; | ||
26 | - | ||
27 | - //std::cout << "Checksum comparison : " << cmp << ", ref=" << (unsigned int)checksum << std::endl; | ||
28 | - | ||
29 | - return (cmp == (unsigned int)checksum ); | ||
30 | -} | ||
31 | - | ||
32 | - | ||
33 | -QString NMEAFrame::extractType() | ||
34 | -{ | ||
35 | - QString head = frame.section(',',0,0); | ||
36 | - | ||
37 | - if (head.isEmpty() || head.length() < 3) | ||
38 | - return QString::null ; | ||
39 | - | ||
40 | - return head.right(3); | ||
41 | -} | ||
42 | - | ||
43 | - | ||
44 | -NMEATime NMEAFrame::parseTime(QString s) | ||
45 | -{ | ||
46 | - NMEATime res; | ||
47 | - res.valid = false; | ||
48 | - | ||
49 | - if (s.isEmpty() || s.length() != 9) | ||
50 | - return res; | ||
51 | - | ||
52 | - bool ok; | ||
53 | - | ||
54 | - res.hours = s.left(2).toInt(&ok) ; | ||
55 | - if (!ok) return res; | ||
56 | - res.minutes = s.mid(2,2).toInt(); | ||
57 | - if (!ok) return res; | ||
58 | - res.seconds = s.right(s.length()-4).toFloat(); | ||
59 | - if (!ok) return res; | ||
60 | - | ||
61 | - if ( res.hours >= 0 && res.hours <= 23 && | ||
62 | - res.minutes >= 0 && res.minutes <= 59 && | ||
63 | - res.seconds >= 0 && res.seconds < 60 ) | ||
64 | - res.valid = true; | ||
65 | - | ||
66 | - return res; | ||
67 | -} | ||
68 | - | ||
69 | - | ||
70 | -NMEAAngle NMEAFrame::parseAngle(QString s, QString t, int n) | ||
71 | -{ | ||
72 | - NMEAAngle res; | ||
73 | - res.valid = false; | ||
74 | - | ||
75 | - | ||
76 | - /*if (s.isEmpty() || t.isEmpty() ) | ||
77 | - return res; | ||
78 | - std::cout << "Angle data passed " << s.ascii() << t.ascii() << n << std::endl;*/ | ||
79 | - | ||
80 | - | ||
81 | - if (s.isEmpty() || t.isEmpty() || t.length() != 1) // pas de test de longueur ici sur s car != norme NMEA | ||
82 | - return res; | ||
83 | - | ||
84 | - if ( n == 2) | ||
85 | - if (t != "N" && t != "S") | ||
86 | - return res; | ||
87 | - | ||
88 | - if ( n == 3) | ||
89 | - if (t != "W" && t != "E") | ||
90 | - return res; | ||
91 | - | ||
92 | - bool ok; | ||
93 | - | ||
94 | - res.degrees = s.left(n).toInt(&ok) ; | ||
95 | - if (!ok) return res; | ||
96 | - res.minutes = s.right(s.length()-n).toFloat(&ok); | ||
97 | - if (!ok) return res; | ||
98 | - | ||
99 | -// if ( t == "S" || t == "W" ) | ||
100 | -// { | ||
101 | -// res.degrees = -res.degrees ; | ||
102 | -// res.minutes = -res.minutes ; | ||
103 | -// } | ||
104 | - res.direction = t[0].latin1(); | ||
105 | - | ||
106 | - res.valid = true; | ||
107 | - | ||
108 | - return res; | ||
109 | -} | ||
110 | - | ||
111 | -/******************************************************************** | ||
112 | - * NMEA GGA Frame | ||
113 | - ********************************************************************/ | ||
114 | - | ||
115 | -void NMEAFrameGGA::parseFrame() | ||
116 | -{ | ||
117 | - QStringList ls = QStringList::split(',',getRawFrame(),true); | ||
118 | - if (ls.count() != 15) | ||
119 | - { | ||
120 | - valid = false; | ||
121 | - return ; | ||
122 | - } | ||
123 | - | ||
124 | - time = parseTime(ls[1]); | ||
125 | - latitude = parseLatitude(ls[2],ls[3]); | ||
126 | - longitude = parseLongitude(ls[4],ls[5]); | ||
127 | - GPSQuality = ls[6].toInt(); | ||
128 | - SVNumber = ls[7].toInt(); | ||
129 | - DOP = ls[8].toFloat(); | ||
130 | - antennaHeight = ls[9].toFloat(); | ||
131 | - geoidSeparation = ls[11].toFloat(); | ||
132 | - | ||
133 | - | ||
134 | - valid = latitude.valid && longitude.valid && time.valid ; | ||
135 | - return ; | ||
136 | -} | ||
137 | - | ||
138 | -void NMEAFrameGGA::dump() | ||
139 | -{ | ||
140 | - //std::cout << "NMEA GGA: time, position, fix" << std::endl; | ||
141 | - if (!valid) | ||
142 | - { | ||
143 | - std::cout << "\tInvalid !" << std::endl; | ||
144 | - return ; | ||
145 | - } | ||
146 | - | ||
147 | - /*std::cout << "\t- time: " << time.hours << ":" << time.minutes << ":" << time.seconds << std::endl | ||
148 | - << "\t- lat : " << latitude.degrees <<"" << latitude.minutes << "' " << latitude.direction << std::endl | ||
149 | - << "\t- lon : " << longitude.degrees <<"" << longitude.minutes << "' " << longitude.direction << std::endl | ||
150 | - << "\t- alt : " << antennaHeight << "m" << std::endl | ||
151 | - << "\t- DOP,SV : " << DOP << "m, " << SVNumber << std::endl;*/ | ||
152 | -} | ||
153 | - | ||
154 | -/******************************************************************** | ||
155 | - * NMEA GLL Frame | ||
156 | - ********************************************************************/ | ||
157 | - | ||
158 | -void NMEAFrameGLL::parseFrame() | ||
159 | -{ | ||
160 | - QStringList ls = QStringList::split(',',getRawFrame(),true); | ||
161 | - if (ls.count() != 8) | ||
162 | - { | ||
163 | - valid = false; | ||
164 | - return ; | ||
165 | - } | ||
166 | - | ||
167 | - time = parseTime(ls[5]); | ||
168 | - | ||
169 | - | ||
170 | - latitude = parseLatitude(ls[1],ls[2]); | ||
171 | - longitude = parseLongitude(ls[3],ls[4]); | ||
172 | - | ||
173 | - valid = latitude.valid && longitude.valid && time.valid ; | ||
174 | - return ; | ||
175 | -} | ||
176 | - | ||
177 | - | ||
178 | -void NMEAFrameGLL::dump() | ||
179 | -{ | ||
180 | - //std::cout << "NMEA GLL: time, position, fix" << std::endl; | ||
181 | - if (!valid) | ||
182 | - { | ||
183 | - std::cout << "\tInvalid !" << std::endl; | ||
184 | - return ; | ||
185 | - } | ||
186 | - | ||
187 | - /*std::cout << "\t- time: " << time.hours << ":" << time.minutes << ":" << time.seconds << std::endl | ||
188 | - << "\t- lat : " << latitude.degrees <<"" << latitude.minutes << "' " << latitude.direction << std::endl | ||
189 | - << "\t- lon : " << longitude.degrees <<"" << longitude.minutes << "' " << longitude.direction << std::endl;*/ | ||
190 | -} | ||
191 | - | ||
192 | -/******************************************************************** | ||
193 | - * NMEA RMC Frame | ||
194 | - ********************************************************************/ | ||
195 | - | ||
196 | -void NMEAFrameRMC::parseFrame() | ||
197 | -{ | ||
198 | - QStringList ls = QStringList::split(',',getRawFrame(),true); | ||
199 | - if (ls.count() != 13) | ||
200 | - { | ||
201 | - valid = false; | ||
202 | - return ; | ||
203 | - } | ||
204 | - | ||
205 | - time = parseTime(ls[1]); | ||
206 | - latitude = parseLatitude(ls[3],ls[4]); | ||
207 | - longitude = parseLongitude(ls[5],ls[6]); | ||
208 | - | ||
209 | - speed = ls[7].toFloat(); | ||
210 | - trackAngle = ls[8].toFloat(); | ||
211 | - UTDate = ls[9].toInt(); | ||
212 | - MAGVariation = ls[10].toFloat(); | ||
213 | - MAGDir = (ls[11])[0].latin1(); | ||
214 | - | ||
215 | - | ||
216 | - valid = latitude.valid && longitude.valid && time.valid ; | ||
217 | - return ; | ||
218 | -} | ||
219 | - | ||
220 | - | ||
221 | -void NMEAFrameRMC::dump() | ||
222 | -{ | ||
223 | - //std::cout << "NMEA RMC: time, position, fix" << std::endl; | ||
224 | - if (!valid) | ||
225 | - { | ||
226 | - std::cout << "\tInvalid !" << std::endl; | ||
227 | - return ; | ||
228 | - } | ||
229 | - | ||
230 | - /*std::cout << "\t- time: " << time.hours << ":" << time.minutes << ":" << time.seconds << std::endl | ||
231 | - << "\t- lat : " << latitude.degrees <<"" << latitude.minutes << "' " << latitude.direction << std::endl | ||
232 | - << "\t- lon : " << longitude.degrees <<"" << longitude.minutes << "' " << longitude.direction << std::endl;*/ | ||
233 | - //!< \todo complete things here for complete dump. | ||
234 | -} | ||
235 | - | ||
236 | - | ||
237 | -/******************************************************************** | ||
238 | - * NMEA VTG Frame | ||
239 | - ********************************************************************/ | ||
240 | - | ||
241 | -void NMEAFrameVTG::parseFrame() | ||
242 | -{ | ||
243 | - QStringList ls = QStringList::split(',',getRawFrame(),true); | ||
244 | - if (ls.count() != 9) | ||
245 | - { | ||
246 | - return ; | ||
247 | - } | ||
248 | - | ||
249 | - knotSpeed = ls[5].toFloat(); | ||
250 | - kmSpeed = ls[7].toFloat(); | ||
251 | - trackAngle = ls[1].toFloat(); | ||
252 | - | ||
253 | - return ; | ||
254 | -} | ||
255 | - | ||
256 | - | ||
257 | -void NMEAFrameVTG::dump() | ||
258 | -{ | ||
259 | - //std::cout << "NMEA VTG: track angle, speed over ground" << std::endl; | ||
260 | - | ||
261 | -// std::cout << "\t- time: " << time.hours << ":" << time.minutes << ":" << time.seconds << std::endl | ||
262 | -// << "\t- lat : " << latitude.degrees <<"" << latitude.minutes << "' " << latitude.direction << std::endl | ||
263 | -// << "\t- lon : " << longitude.degrees <<"" << longitude.minutes << "' " << longitude.direction << std::endl; | ||
264 | - //!< \todo complete things here for complete dump. | ||
265 | -} | ||
266 | - | ||
267 | - |
legacy/input/tracker/nmea.h
deleted
100644 → 0
1 | -#ifndef __NMEA_H__ | ||
2 | -#define __NMEA_H__ | ||
3 | - | ||
4 | -/*! \file nmea.h | ||
5 | - * \brief This file contains classes to handle NMEA messages | ||
6 | - * \author Jean-Yves Didier | ||
7 | - * \date February, the 4th, 2008. | ||
8 | - * \ingroup gps | ||
9 | - */ | ||
10 | - | ||
11 | -#include <qstring.h> | ||
12 | -#include <iostream> | ||
13 | - | ||
14 | - | ||
15 | - | ||
16 | -/*! \brief A structure representing NMEA Time, which is expressed in UTC. | ||
17 | - * \author Jean-Yves Didier | ||
18 | - * \date February, the 4th, 2008. | ||
19 | - * \ingroup gps | ||
20 | - */ | ||
21 | -typedef struct | ||
22 | -{ | ||
23 | - int hours; //!< hours | ||
24 | - int minutes; //!< minutes | ||
25 | - float seconds; //!< seconds | ||
26 | - bool valid; //!< <tt>false</tt> if there were troubles in decoding NMEAFrame | ||
27 | -} NMEATime ; | ||
28 | - | ||
29 | - | ||
30 | -/*! \brief A structure representing NMEA angles, in latitude or in longitude. | ||
31 | - * \author Jean-Yves Didier | ||
32 | - * \date February, the 4th, 2008. | ||
33 | - * \ingroup gps | ||
34 | - */ | ||
35 | -typedef struct | ||
36 | -{ | ||
37 | - int degrees; //!< degrees | ||
38 | - float minutes; //!< minutes | ||
39 | - char direction; //!< direction : should "N" or "S" if it is representing a latitude, "E" or "W" when it is a longitude. | ||
40 | - bool valid; //!< <tt>false</tt> if there were troubles in decoding NMEAFrame | ||
41 | -} NMEAAngle ; | ||
42 | - | ||
43 | - | ||
44 | - | ||
45 | - | ||
46 | -/*! \brief This is typical NMEA Frame handler | ||
47 | - * \author Jean-Yves Didier | ||
48 | - * \date February, the 4th, 2008. | ||
49 | - * \ingroup gps | ||
50 | - */ | ||
51 | -class NMEAFrame | ||
52 | -{ | ||
53 | -public: | ||
54 | - /*! \brief Simple constructor. | ||
55 | - * | ||
56 | - * This constructor can perform a checksum. | ||
57 | - */ | ||
58 | - NMEAFrame(QString s) { frame = s; if (isChecksumRequired()) validChecksum=isChecksumValid(s); else validChecksum=true;} | ||
59 | - NMEAFrame(const NMEAFrame& nf) { frame = nf.frame; validChecksum = nf.validChecksum; } //!< copy constructor. | ||
60 | - virtual ~NMEAFrame() {} //!< Default constructor. | ||
61 | - | ||
62 | - /*! \brief Dumps the content of the frame. | ||
63 | - * | ||
64 | - * This is mainly for debugging purpose. | ||
65 | - * You can override this function to check if your specific NMEA Frame parser is handling data correctly. | ||
66 | - */ | ||
67 | - virtual void dump() { /*std::cout << frame.ascii() << std::endl;*/ } //!< Mostly for debugging purpose. | ||
68 | - | ||
69 | - bool isChecksumValid() { return validChecksum; }//!< Tells wether the checksum for this frame is valid or not. | ||
70 | - QString getRawFrame() const { return frame; }//!< Returns the raw NMEA Frame in its unparsed state. | ||
71 | - | ||
72 | - QString extractType();//!< Returns the type of the NMEA frame. This is usually a 3 letters id. | ||
73 | - | ||
74 | - /*! \brief Tells wether the checksum is required or not for this frame. | ||
75 | - * | ||
76 | - * Most of NMEA Frames require checksum but not all. | ||
77 | - * You should override this method for frames who doesn't require chechsumming. | ||
78 | - */ | ||
79 | - virtual bool isChecksumRequired() { return true;} | ||
80 | - | ||
81 | - /*! \brief computes and compare checksums. | ||
82 | - * | ||
83 | - * A large set of NMEA Frames are embedding checksums. | ||
84 | - * This a xor on all characters between the leading <tt>$</tt> and the trailing <tt>*</tt> | ||
85 | - * which are both excluded. | ||
86 | - * \param s A whole NMEA Frame | ||
87 | - * \return <tt>true</tt> if checksum is corresponding to frame. | ||
88 | - */ | ||
89 | - static bool isChecksumValid(QString s); | ||
90 | - static NMEATime parseTime(QString s); //!< Fills a NMEATime using its NMEA representation \a s. | ||
91 | - static NMEAAngle parseLatitude(QString s,QString t) {return parseAngle(s,t,2);} //!< Fills a NMEAAngle using the NMEA representation of latitudes. | ||
92 | - static NMEAAngle parseLongitude(QString s, QString t) {return parseAngle(s,t,3);} //!< Fills a NMEAAngle using the NMEA representation of longitudes. | ||
93 | - | ||
94 | -protected: | ||
95 | - virtual void parseFrame() {} //!< Classes inheriting this one can override this function to retrieve specific data. | ||
96 | - | ||
97 | -private: | ||
98 | - static NMEAAngle parseAngle(QString s, QString t, int nc); | ||
99 | - QString frame; | ||
100 | - bool validChecksum; | ||
101 | -}; | ||
102 | - | ||
103 | - | ||
104 | -/*! \brief This is an advanced NMEAFrame decoder. It is intended to decode GGA Frames. | ||
105 | - * | ||
106 | - * GGA frames are expressing time, position and fix values. | ||
107 | - * Amongst the values that can be recovered in this frame there are : | ||
108 | - * <ul> | ||
109 | - * <li>UTC Time (getUTCTime()) ;</li> | ||
110 | - * <li>Latitude (getLatitude()) ;</li> | ||
111 | - * <li>Longitude (getLongitude()) ; </li> | ||
112 | - * <li>GPS Quality (getGPSQuality()) ; </li> | ||
113 | - * <li>Number of Satellites in view (getSVNumber()) ; </li> | ||
114 | - * <li>Altitude over the mean see level (getAntennaHeight()) ; </li> | ||
115 | - * <li>Separation over the reference geoid used in WGS84 global localization system; </li> | ||
116 | - * </ul> | ||
117 | - * \author Jean-Yves Didier | ||
118 | - * \date February, the 4th, 2008. | ||
119 | - * \ingroup gps | ||
120 | - */ | ||
121 | -class NMEAFrameGGA : public NMEAFrame | ||
122 | -{ | ||
123 | -public: | ||
124 | - NMEAFrameGGA(QString s):NMEAFrame(s) { parseFrame();} | ||
125 | - NMEAFrameGGA(const NMEAFrame& nf):NMEAFrame(nf) { parseFrame(); } | ||
126 | - virtual ~NMEAFrameGGA() {} | ||
127 | - virtual void dump(); | ||
128 | - | ||
129 | - NMEATime getUTCTime() const {return time; } | ||
130 | - NMEAAngle getLatitude() const {return latitude;} | ||
131 | - NMEAAngle getLongitude() const {return longitude;} | ||
132 | - int getGPSQuality() const {return GPSQuality; } | ||
133 | - int getSVNumber() const {return SVNumber; } | ||
134 | - float getDOP() const { return DOP; } | ||
135 | - float getAntennaHeight() const {return antennaHeight; } | ||
136 | - float getGeoidSeparation() const { return geoidSeparation; } | ||
137 | - | ||
138 | - | ||
139 | - bool isValid() const { return valid; } //!< This will return <tt>false</tt> if there were troubles in decoding this frame. | ||
140 | - | ||
141 | -protected: | ||
142 | - virtual void parseFrame(); | ||
143 | - | ||
144 | -private: | ||
145 | - NMEATime time; | ||
146 | - NMEAAngle latitude; | ||
147 | - NMEAAngle longitude; | ||
148 | - int GPSQuality; | ||
149 | - int SVNumber; | ||
150 | - float DOP; | ||
151 | - float antennaHeight; | ||
152 | - float geoidSeparation ; | ||
153 | - | ||
154 | - bool valid; | ||
155 | -}; | ||
156 | - | ||
157 | -/*! \brief This is an advanced NMEAFrame decoder. It is intended to decode GLL Frames. | ||
158 | - * | ||
159 | - * GLL frames are expressing time and position values. | ||
160 | - * Amongst the values that can be recovered in this frame there are : | ||
161 | - * <ul> | ||
162 | - * <li>UTC Time (getUTCTime()) ;</li> | ||
163 | - * <li>Latitude (getLatitude()) ;</li> | ||
164 | - * <li>Longitude (getLongitude()) ; </li> | ||
165 | - * </ul> | ||
166 | - * \author Jean-Yves Didier | ||
167 | - * \date February, the 4th, 2008. | ||
168 | - * \ingroup gps | ||
169 | - */ | ||
170 | -class NMEAFrameGLL : public NMEAFrame | ||
171 | -{ | ||
172 | -public: | ||
173 | - NMEAFrameGLL(QString s):NMEAFrame(s) { parseFrame();} | ||
174 | - NMEAFrameGLL(const NMEAFrame& nf):NMEAFrame(nf) { parseFrame(); } | ||
175 | - virtual ~NMEAFrameGLL() {} | ||
176 | - virtual void dump(); | ||
177 | - | ||
178 | - NMEATime getUTCTime() const {return time; } | ||
179 | - NMEAAngle getLatitude() const {return latitude;} | ||
180 | - NMEAAngle getLongitude() const {return longitude;} | ||
181 | - | ||
182 | - bool isValid() const { return valid; } //!< This will return <tt>false</tt> if there were troubles in decoding this frame. | ||
183 | - | ||
184 | -protected: | ||
185 | - virtual void parseFrame(); | ||
186 | - | ||
187 | -private: | ||
188 | - NMEATime time; | ||
189 | - NMEAAngle latitude; | ||
190 | - NMEAAngle longitude; | ||
191 | - bool valid; | ||
192 | -}; | ||
193 | - | ||
194 | - | ||
195 | -/*! \brief This is an advanced NMEAFrame decoder. It is intended to decode RMC Frames. | ||
196 | - * | ||
197 | - * RMC frames are expressing the recommended minimum specific GPS/TRANSIT data. | ||
198 | - * Amongst the values that can be recovered in this frame there are : | ||
199 | - * <ul> | ||
200 | - * <li>UTC Time (getUTCTime()) ;</li> | ||
201 | - * <li>Latitude (getLatitude()) ;</li> | ||
202 | - * <li>Longitude (getLongitude()) ; </li> | ||
203 | - * <li>Speed over ground in knots (getSpeed()) ; </li> | ||
204 | - * <li>Track angle in degrees (getTrackAngle()); </li> | ||
205 | - * <li>UT Date: ddmmyy (getUTDate()); </li> | ||
206 | - * <li>Magnetic variation in degrees (getMAGVariation()); </li> | ||
207 | - * <li>Magnetic variation direction (E or W - getMAGDir()). </li> | ||
208 | - * </ul> | ||
209 | - * \author Jean-Yves Didier | ||
210 | - * \date February, the 4th, 2008. | ||
211 | - * \ingroup gps | ||
212 | - */ | ||
213 | - | ||
214 | -class NMEAFrameRMC : public NMEAFrame | ||
215 | -{ | ||
216 | -public: | ||
217 | - NMEAFrameRMC(QString s):NMEAFrame(s) { parseFrame();} | ||
218 | - NMEAFrameRMC(const NMEAFrame& nf):NMEAFrame(nf) { parseFrame(); } | ||
219 | - virtual ~NMEAFrameRMC() {} | ||
220 | - virtual void dump(); | ||
221 | - | ||
222 | - NMEATime getUTCTime() const {return time; } | ||
223 | - NMEAAngle getLatitude() const {return latitude;} | ||
224 | - NMEAAngle getLongitude() const {return longitude;} | ||
225 | - float getSpeed() const { return speed; } | ||
226 | - float getTrackAngle() const { return trackAngle; } | ||
227 | - int getUTDate() const { return UTDate; } | ||
228 | - float getMAGVariation() const { return MAGVariation; } | ||
229 | - char getMAGDir() const { return MAGDir; } | ||
230 | - | ||
231 | - bool isValid() const { return valid; } //!< This will return <tt>false</tt> if there were troubles in decoding this frame. | ||
232 | -protected: | ||
233 | - virtual void parseFrame(); | ||
234 | - | ||
235 | -private: | ||
236 | - NMEATime time; | ||
237 | - NMEAAngle latitude; | ||
238 | - NMEAAngle longitude; | ||
239 | - bool valid; | ||
240 | - float speed; | ||
241 | - float trackAngle; | ||
242 | - int UTDate; | ||
243 | - float MAGVariation; | ||
244 | - char MAGDir; | ||
245 | -}; | ||
246 | - | ||
247 | - | ||
248 | -/*! \brief This is an advanced NMEAFrame decoder. It is intended to decode VTG Frames. | ||
249 | - * | ||
250 | - * VTG frames are expressing the track angle as well as speed over ground. | ||
251 | - * Amongst the values that can be recovered in this frame there are : | ||
252 | - * <ul> | ||
253 | - * <li>Speed over ground in knots (getKnotSpeed()) ; </li> | ||
254 | - * <li>Speed over ground in kilometers per hour (getKMSpeed()) ; </li> | ||
255 | - * <li>Track angle in degrees (getTrackAngle()); </li> | ||
256 | - * </ul> | ||
257 | - * \author Jean-Yves Didier | ||
258 | - * \date February, the 4th, 2008. | ||
259 | - * \ingroup gps | ||
260 | - */ | ||
261 | -class NMEAFrameVTG : public NMEAFrame | ||
262 | -{ | ||
263 | -public: | ||
264 | - NMEAFrameVTG(QString s):NMEAFrame(s) { parseFrame();} | ||
265 | - NMEAFrameVTG(const NMEAFrame& nf):NMEAFrame(nf) { parseFrame(); } | ||
266 | - virtual ~NMEAFrameVTG() {} | ||
267 | - virtual void dump(); | ||
268 | - | ||
269 | - float getKnotSpeed() const { return knotSpeed; } | ||
270 | - float getTrackAngle() const { return trackAngle; } | ||
271 | - float getKMSpeed() const { return kmSpeed; } | ||
272 | - | ||
273 | - | ||
274 | -protected: | ||
275 | - virtual void parseFrame(); | ||
276 | - | ||
277 | -private: | ||
278 | - float knotSpeed; | ||
279 | - float kmSpeed; | ||
280 | - float trackAngle; | ||
281 | -}; | ||
282 | - | ||
283 | - | ||
284 | -/**! \todo Coming soon ! GSA Frame | ||
285 | - */ | ||
286 | - | ||
287 | -#endif //__NMEA_H__ |
... | @@ -49,6 +49,7 @@ SOURCES+= movereader.cpp | ... | @@ -49,6 +49,7 @@ SOURCES+= movereader.cpp |
49 | MOC_DIR = ./moc | 49 | MOC_DIR = ./moc |
50 | OBJECTS_DIR = ./obj | 50 | OBJECTS_DIR = ./obj |
51 | 51 | ||
52 | +QT += opengl | ||
52 | CONFIG += qt thread release opengl | 53 | CONFIG += qt thread release opengl |
53 | 54 | ||
54 | unix { | 55 | unix { |
... | @@ -116,5 +117,5 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME} | ... | @@ -116,5 +117,5 @@ arcslibrary.commands = arcslibmaker ${QMAKE_FILE_NAME} |
116 | arcslibrary.variable_out = SOURCES | 117 | arcslibrary.variable_out = SOURCES |
117 | QMAKE_EXTRA_COMPILERS += arcslibrary | 118 | QMAKE_EXTRA_COMPILERS += arcslibrary |
118 | INCLUDEPATH += $$(ARCSDIR)/include | 119 | INCLUDEPATH += $$(ARCSDIR)/include |
119 | -LIBS += -L$$(ARCSDIR)/lib -larcs | 120 | +LIBS += -L$$(ARCSDIR)/lib -larcs -lGLU |
120 | CONFIG += dll | 121 | CONFIG += dll | ... | ... |
... | @@ -216,40 +216,6 @@ LIBS+= $$system(pkg-config --libs opencv) | ... | @@ -216,40 +216,6 @@ LIBS+= $$system(pkg-config --libs opencv) |
216 | INCLUDEPATH+= $$system(pkg-config --cflags-only-I opencv) | 216 | INCLUDEPATH+= $$system(pkg-config --cflags-only-I opencv) |
217 | 217 | ||
218 | LIBS+= -L/usr/local/lib -L../libs/ -lgps | 218 | LIBS+= -L/usr/local/lib -L../libs/ -lgps |
219 | - | ||
220 | - | ||
221 | -HAS_OPENCV = $$system(/sbin/ldconfig -p | grep -F libopencv-) | ||
222 | -HAS_CV = $$system(/sbin/ldconfig -p | grep -F libcv.) | ||
223 | -HAS_CXCORE = $$system(/sbin/ldconfig -p | grep -F libcxcore.) | ||
224 | -HAS_HIGHGUI= $$system(/sbin/ldconfig -p | grep -F libhighgui.) | ||
225 | -HAS_CVAUX = &&system(/sbin/ldconfig -p | grep -F libcvaux-) | ||
226 | - | ||
227 | -!isEmpty(HAS_OPENCV) { | ||
228 | - message("libopencv found") | ||
229 | - LIBS += -lopencv | ||
230 | -} | ||
231 | - | ||
232 | -!isEmpty(HAS_CV) { | ||
233 | - message("libcv found") | ||
234 | - LIBS += -lcv | ||
235 | -} | ||
236 | - | ||
237 | -!isEmpty(HAS_CXCORE) { | ||
238 | - message("libcxcore found") | ||
239 | - LIBS += -lcxcore | ||
240 | -} | ||
241 | - | ||
242 | -!isEmpty(HAS_HIGHGUI) { | ||
243 | - message("libhighgui found") | ||
244 | - LIBS += -lhighgui | ||
245 | -} | ||
246 | - | ||
247 | -!isEmpty(HAS_CVAUX) { | ||
248 | - message("libcvaux found") | ||
249 | - LIBS += -lcvaux | ||
250 | -} | ||
251 | - | ||
252 | - | ||
253 | } | 219 | } |
254 | 220 | ||
255 | win32 { | 221 | win32 { | ... | ... |
-
Please register or login to post a comment