watson_ins_driver.h
Go to the documentation of this file.
1 /*
2  * This file is part of https://github.com/AutonomousVehicleLaboratory/watson_ins.git
3  * Copyright 2019 AVL
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, version 3.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef WATSON_INS_H
18 #define WATSON_INS_H
19 #include <serial/serial.h>
20 #include "sensor_msgs/NavSatFix.h"
21 #include "sensor_msgs/Imu.h"
22 
23 // NOTE: Change this data structure depending on the enabled Watson channels.
24 // Yes, I know, unfortunately, for sake of code compactness, the driver will
25 // have to be recompiled everytime the INS output channels are modified.
26 //
27 // This struct is overlayed on top of the received buffer from the INS, and the
28 // string fields can then be directly accessed.
29 //
30 struct ins_data_t {
31  char dataType[2]; // 0
32  char timestamp[9]; // 1
33  char roll[7]; // 4
34  char pitch[6]; // 3
35  char yaw[6]; // 2
36  char xAccel[6]; // 5
37  char yAccel[6]; // 6
38  char zAccel[6]; // 7
39  char forwardAccel[6]; // 8, NOTE: not used
40  char lateralAccel[6]; // 9, NOTE: not used
41  char verticalAccel[6]; // 10, NOTE: not used
42  char xAngleRate[6]; // 11
43  char yAngleRate[6]; // 12
44  char zAngleRate[6]; // 13
45  char hedingRate[6]; // 14, NOTE: not used
46  char forwardVel[7]; // 15, NOTE: not used
47  char lat[10];// 16
48  char lon[11];// 17
49  char alt[5]; // 18
50  char _cr[1]; // 19
51 };
52 
54  public:
55  WatsonINSDriver(std::string path, int baud, int timeout_ms);
56  ~WatsonINSDriver();
57  void read(sensor_msgs::Imu &imuMsg,
58  sensor_msgs::NavSatFix &fixMsg,
59  bool &validImu, bool &validFix);
60 
61  private:
62  static const int readRetryCount = 10;
64  int gpsMsgSeq;
65  struct ins_data_t insData;
66 
67  bool validCmd(void);
68  void parseIMU(sensor_msgs::Imu &imuMsg);
69  void parseGPS(sensor_msgs::NavSatFix &gpsMsg);
70 };
71 #endif /* WATSON_INS_H */
char timestamp[9]
char hedingRate[6]
char xAngleRate[6]
char verticalAccel[6]
char yAngleRate[6]
char lateralAccel[6]
char forwardAccel[6]
char zAngleRate[6]
char forwardVel[7]
char dataType[2]
serial::Serial * serDev


watson_ins
Author(s): David Paz , Nathan Chan
autogenerated on Sat Jan 11 2020 03:23:08