INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
gbxnovatelacfr/driver.h
1 /*
2  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3  * http://gearbox.sf.net/
4  * Copyright (c) 2004-2010 Matthew Ridley, Ben Upcroft, Michael Moser
5  *
6  * This distribution is licensed to you under the terms described in
7  * the LICENSE file included in this distribution.
8  *
9  */
10 
11 #ifndef GBXNOVATELACFR_DRIVER_H
12 #define GBXNOVATELACFR_DRIVER_H
13 
14 #include <cstdlib>
15 #include <string>
16 #include <memory>
17 #include <vector>
18 
19 // forward declarations
20 // users don't need to know about serial devices or Tracers or imu decoders
21 namespace gbxserialacfr{
22  class Serial;
23 }
24 namespace gbxutilacfr{
25  class Tracer;
26 }
27 namespace gbxnovatelutilacfr{
28  class ImuDecoder;
29 }
30 
33 namespace gbxnovatelacfr{
34 
37 public:
40  SimpleConfig(std::string serialDevice, int baudRate, std::string imuType, std::vector<double > &imuToGpsOffset):
41  serialDevice_(serialDevice),
42  baudRate_(baudRate),
43  imuType_(imuType),
44  imuToGpsOffset_(imuToGpsOffset) {};
45 
47  //
53  bool isValid() const;
55  std::string toString() const;
56 
57  std::string serialDevice_;
58  int baudRate_;
59  std::string imuType_;
60  std::vector<double > imuToGpsOffset_;
61 };
62 
65 public:
66  GpsOnlyConfig(std::string serialDevice, int baudRate):
67  serialDevice_(serialDevice),
68  baudRate_(baudRate) {};
69 
71  //
75  bool isValid() const;
76  std::string toString() const;
77 
78  std::string serialDevice_;
79  int baudRate_;
80 };
81 
83 //
87 class Config{
88 public:
90  //
92  Config(const SimpleConfig &simpleCfg);
94  //
96  Config(const GpsOnlyConfig &gpsOnlyCfg);
98  Config();
99 
101  //
109  bool isValid();
111  std::string toString() const;
112 
114  //
116  std::string serialDevice_;
117  int baudRate_;
119 
121  //
123  bool enableImu_;
124  std::string imuType_;
125 
129  //
131  bool enableInsPva_;
132  bool enableGpsPos_;
133  bool enableGpsVel_;
134  bool enableRawImu_;
136 
138 
143  //
145  double dtInsPva_;
146  double dtGpsPos_;
147  double dtGpsVel_;
149 
151 
153  //
155  std::vector<double > imuToGpsOffset_;
156  std::vector<double > imuToGpsOffsetUncertainty_;
157  bool enableInsOffset_;
158  std::vector<double > insOffset_;
160 
162 
164  //
167  bool enableSBAS_;
168  bool enableRTK_;
170 
172 
178  //
180  bool enableSetImuOrientation_;
181  int setImuOrientation_;
182  bool enableVehicleBodyRotation_;
183  std::vector<double > vehicleBodyRotation_;
184  std::vector<double > vehicleBodyRotationUncertainty_;
185 
187 private:
188 };
189 
194  Ok,
197 };
198 
200 std::string toString( StatusMessageType type );
201 
202 
204 //
217  DeltaPos=10,
223  InsBad=16,
225  Pending=18,
227  UnknownGpsSolutionStatusType
228 };
229 
231 std::string toString( GpsSolutionStatusType type );
232 
234 //
237  None=0,
253  Single=16,
254  PsrDiff=17,
255  Waas=18,
257  Omnistar=20,
269  L1Float=32,
272  L1Int=48,
273  WideInt=49,
276  Ins=52,
277  InsPsrSp=53,
283  CdGps=66,
284  UnknownGpsPosVelType
285 };
286 
288 std::string toString( GpsPosVelType type );
289 
291 enum DataType {
300 };
301 
303 class GenericData {
304  public:
305  virtual ~GenericData(){};
306  virtual DataType type() const=0;
307  virtual std::string toString() const=0;
308  private:
309 };
310 
312 class InsPvaData : public GenericData {
313  public:
314  DataType type() const {
315  return InsPva;
316  }
317  std::string toString() const;
318  int gpsWeekNr;
319  double secIntoWeek;
320  double latitude;
321  double longitude;
322  double height;
323 
326  //
328  double northVelocity;
329  double eastVelocity;
330  double upVelocity;
331 
333 
336  //
338  double roll;
339  double pitch;
340  double azimuth;
341 
343 
344  StatusMessageType statusMessageType;
345  std::string statusMessage;
346 
349 };
350 
352 class BestGpsPosData : public GenericData {
353  public:
354  DataType type() const {
355  return BestGpsPos;
356  }
357  std::string toString() const;
358  int gpsWeekNr;
359  unsigned int msIntoWeek;
360  GpsSolutionStatusType solutionStatus; //
361  GpsPosVelType positionType; //
362  double latitude;
363  double longitude;
364  double heightAMSL;
365  float undulation;
366  unsigned int datumId; //
369  float sigmaHeight;
370  char baseStationId[4]; //
371  float diffAge;
372  float solutionAge;
377 
378  StatusMessageType statusMessageType;
379  std::string statusMessage;
380 
383 };
384 
386 class BestGpsVelData : public GenericData {
387  public:
388  DataType type() const {
389  return BestGpsVel;
390  }
391  std::string toString() const;
392  int gpsWeekNr;
393  unsigned int msIntoWeek;
394  GpsSolutionStatusType solutionStatus; //
395  GpsPosVelType velocityType; //
396  float latency;
397  float diffAge;
400  double verticalSpeed;
401 
402  StatusMessageType statusMessageType;
403  std::string statusMessage;
404 
407 };
408 
410 class RawImuData : public GenericData {
411  public:
412  DataType type() const {
413  return RawImu;
414  }
415  std::string toString() const;
416  int gpsWeekNr;
417  double secIntoWeek;
418  //
423  double zDeltaV;
424  double yDeltaV;
425  double xDeltaV;
426 
428 
432  //
434  double zDeltaAng;
435  double yDeltaAng;
436  double xDeltaAng;
437 
439 
440  StatusMessageType statusMessageType;
441  std::string statusMessage;
442 
445 };
446 
449 class Driver {
450 public:
451 
454  //
456 
458  //
460  Driver( const Config &cfg);
463  Driver( const Config &cfg, gbxutilacfr::Tracer &tracer);
465  ~Driver();
466 
472  std::auto_ptr<GenericData> read();
473 
474 private:
475 
476  // does the leg-work for the constructor (via the following guys)
477  void configure();
478  // establish a serial connection to the receiver
479  void connectToHardware();
480  // set parameters related to the IMU
481  void configureImu();
482  // set parameters related to the INS
483  void configureIns();
484  // set parameters related to GPS
485  void configureGps();
486  // turn on data messages we are interested in
487  void requestData();
488 
489  std::auto_ptr<gbxnovatelutilacfr::ImuDecoder> imuDecoder_;
490 
491  std::auto_ptr<gbxserialacfr::Serial> serial_;
492  int baud_;
493 
494  Config config_;
495  std::auto_ptr<gbxutilacfr::Tracer> tracerInternal_;
496  gbxutilacfr::Tracer& tracer_;
497 };
498 
499 
500 } // namespace
502 #endif
 

Generated for GearBox by  doxygen 1.4.5