Initial commit of files
This commit is contained in:
12
tests/gps/CMakeLists.txt
Normal file
12
tests/gps/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
set(NAME gps)
|
||||
project(Cnomicon-Test)
|
||||
set(TARGET ${NAME}_test)
|
||||
|
||||
# includes
|
||||
include_directories(../include/libgps++ ../include)
|
||||
link_directories(../lib)
|
||||
link_libraries(gps++ net++ net kmlbase kmldom kmlengine pthread rt)
|
||||
|
||||
# executables
|
||||
add_executable(${TARGET} ${TARGET}.cpp)
|
||||
49
tests/gps/gps_test.cpp
Normal file
49
tests/gps/gps_test.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user