Example program to connect to a GPS and read and display data on the terminal. Also tries to connect to a TCM compass through the computer serial port, and use that to set the ArGPS compass data.
#include "Aria.h"
#include "ArGPS.h"
#include "ArGPSConnector.h"
#include "ArTrimbleGPS.h"
#include "ArTCMCompassDirect.h"
#include <iostream>
int main(int argc, char** argv)
{
{
ArLog::log(
ArLog::Terse,
"gpsExample options:\n -printTable Print data to standard output in regular columns rather than a refreshing terminal display, and print more digits of precision");
return 1;
}
{
ArLog::log(
ArLog::Terse,
"gpsExample: Warning: Could not connect to robot. Will not be able to switch GPS power on, or load GPS options from this robot's parameter file.");
}
else
{
}
{
ArLog::log(
ArLog::Terse,
"gpsExample: Error connecting to GPS device. Try -gpsType, -gpsPort, and/or -gpsBaud command-line arguments. Use -help for help.");
return -1;
}
{
(
dynamic_cast<ArSimulatedGPS*
>(gps))->setDummyPosition(42.80709, -71.579047, 100);
}
if(printTable)
gps->
printDataLabelsHeader();
while(true)
{
if(r & ArGPS::ReadError)
{
continue;
}
if(r & ArGPS::ReadUpdated)
{
if(printTable)
{
printf("\n");
}
else
{
printf("\r");
}
fflush(stdout);
continue;
} else {
}
continue;
}
}
return 0;
}