source: flair-src/trunk/lib/FlairSensorActuator/src/SimuGps.cpp@ 51

Last change on this file since 51 was 51, checked in by Sanahuja Guillaume, 8 years ago

gps

File size: 1.4 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2014/05/26
6// filename: SimuGps.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class for a simulation GPS
14//
15//
16/*********************************************************************/
17
18#include "SimuGps.h"
19#include <FrameworkManager.h>
20#include <string.h>
21#include <GeoCoordinate.h>
22#include <GpsData.h>
23
24using std::string;
25using namespace flair::core;
26
27namespace flair {
28namespace sensor {
29
30SimuGps::SimuGps(const FrameworkManager *parent, string name,
31 NmeaGps::NMEAFlags_t NMEAFlags, uint8_t priority)
32 : Thread(parent, name, priority), NmeaGps(parent, name, NMEAFlags) {}
33
34SimuGps::~SimuGps() {
35 SafeStop();
36 Join();
37}
38
39void SimuGps::Run(void) {
40 // double lat=0;
41 char buf[500];
42 nmeaGPGGA gga;
43 nmeaGPVTG vtg;
44 SetPeriodMS(500);
45 WarnUponSwitches(true);
46
47 gga.sig=1;
48 gga.satinuse=2;
49 gga.lat=49.402313;
50 gga.lon=2.795463;
51
52 vtg.spn=1;
53 vtg.dir=0;
54
55 while (!ToBeStopped()) {
56 WaitPeriod();
57
58 nmea_gen_GPGGA(buf,sizeof(buf),&gga);
59 parseFrame(buf,sizeof(buf));
60 position->SetCoordinates(49.402313, 2.795463, 0);
61 // lat+=.5;
62 }
63
64 WarnUponSwitches(false);
65}
66
67} // end namespace sensor
68} // end namespace framewor
Note: See TracBrowser for help on using the repository browser.