Files
Cnomicon/tests/gps/gps_test.cpp
2021-01-22 10:16:20 -05:00

50 lines
1.0 KiB
C++

//
// GPS Daemon
// Neal Probert
//
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include "GpsPoint.h"
#include "GpsListener.h"
#include "netlib.h"
extern int optind, opterr, optopt;
int main(int argc, char **argv)
{
// point for extrapolations
GpsPoint Gps;
Gps.SetPosition( 42.0, -83.0, 0.0 );
// data from vehicle
GpsPoint CarFix;
CarFix.Speed = 25.0;
CarFix.Yaw = 45.0;
// time stamp, begin 100msec position extrapolations (9 of them)
for ( int i=1 ; i<11 ; i++ )
{
Gps.Extrapolate( CarFix.Speed, 0.0, CarFix.Yaw, 0.100 );
// new fix
double dist = GpsMath::Distance( 42.0, -83.0, Gps.GetLatitude(), Gps.GetLongitude() );
printf( "%.7g, %.7g, %g\n", Gps.GetLatitude(), Gps.GetLongitude(), dist );
}
}