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

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

gps

File size: 1.4 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]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>
[51]22#include <GpsData.h>
[3]23
24using std::string;
25using namespace flair::core;
26
[15]27namespace flair {
28namespace sensor {
[3]29
[15]30SimuGps::SimuGps(const FrameworkManager *parent, string name,
[51]31                 NmeaGps::NMEAFlags_t NMEAFlags, uint8_t priority)
32    : Thread(parent, name, priority), NmeaGps(parent, name, NMEAFlags) {}
[3]33
[15]34SimuGps::~SimuGps() {
35  SafeStop();
36  Join();
[3]37}
38
[15]39void SimuGps::Run(void) {
40  // double lat=0;
[51]41  char buf[500];
42  nmeaGPGGA gga;
43  nmeaGPVTG vtg;
[15]44  SetPeriodMS(500);
45  WarnUponSwitches(true);
[3]46
[51]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
[15]55  while (!ToBeStopped()) {
56    WaitPeriod();
[51]57
58    nmea_gen_GPGGA(buf,sizeof(buf),&gga);
59    parseFrame(buf,sizeof(buf));
[15]60    position->SetCoordinates(49.402313, 2.795463, 0);
61    //      lat+=.5;
62  }
[3]63
[15]64  WarnUponSwitches(false);
[3]65}
66
67} // end namespace sensor
68} // end namespace framewor
Note: See TracBrowser for help on using the repository browser.