oem7_imu.cpp
Go to the documentation of this file.
1 //
3 // Copyright (c) 2020 NovAtel Inc.
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 //
24 
26 
27 
28 #include <cmath> // PI
29 
30 namespace novatel_oem7_driver
31 {
32 
33 const double ONE_G = 9.80665;
34 
38 inline double arcsecondsToRadians(double arcsecs)
39 {
40  return arcsecs * M_PI / (180.0 * 3600.0);
41 }
42 
46 inline double degreesToRadians(double degrees)
47 {
48  return degrees * M_PI / 180.0;
49 }
50 
54 inline double feetToMeters(double feet)
55 {
56  return feet / 3.2808;
57 }
58 
59 
60 bool
62  oem7_imu_type_t imu_type,
63  imu_rate_t imu_rate,
64  double& gyro_scale,
65  double& acc_scale)
66 {
67  // Refer to RAWIMUSX in OEM7 documentation.
68 
69  switch(imu_type)
70  {
71  case IMU_TYPE_LN200:
72  gyro_scale = pow(2.0, -19);
73  acc_scale = pow(2.0, -14);
74  break;
75 
82  gyro_scale = pow(2.0, -33);
83  acc_scale = feetToMeters(pow(2.0, -27));
84  break;
85 
88  gyro_scale = pow(2.0, -33);
89  acc_scale = feetToMeters(pow(2.0, -26));
90  break;
91 
92 
93  case IMU_TYPE_IMAR_FSAS:
94  gyro_scale = arcsecondsToRadians(0.1 / pow(2, 8));
95  acc_scale = 0.05 / pow(2.0, 15);
96  break;
97 
98  case IMU_TYPE_ISA100C:
100  gyro_scale = 1.0E-9;
101  acc_scale = 2.0E-8;
102  break;
103 
104  case IMU_TYPE_ADIS16488:
105  gyro_scale = degreesToRadians(720.0/pow(2,31));
106  acc_scale = 200.0 / pow(2, 31);
107  break;
108 
109  case IMU_TYPE_STIM300:
110  case IMU_TYPE_STIM_300D:
111  gyro_scale = degreesToRadians(pow(2,-21));
112  acc_scale = pow(2, -22);
113  break;
114 
115  case IMU_TYPE_KVH_1750:
116  gyro_scale = 0.1 / (3600.0 * 256.0);
117  acc_scale = 0.05 * pow(2.0, -15);
118  break;
119 
120  case IMU_TYPE_EPSON_G320:
122  gyro_scale = degreesToRadians(0.008 / pow(2.0, 16)) / imu_rate;
123  acc_scale = ( (0.2 / pow(2.0, 16)) * (ONE_G/1000.0) ) / imu_rate;
124  break;
125 
129  gyro_scale = pow(2.0, -33);
130  acc_scale = pow(2.0, -29);
131  break;
132 
133 
134  case IMU_TYPE_EPSON_G370:
135  gyro_scale = degreesToRadians(0.0151515/ pow(2.0, 16)) / imu_rate;
136  acc_scale = ((0.4 / pow(2.0, 16)) * (ONE_G/1000.0)) / imu_rate;
137  break;
138 
139  case IMU_TYPE_KVH_COTS:
140  gyro_scale = 0.1 / (3600.0 * 256.0);
141  acc_scale = 0.05 / pow(2.0, 15);
142  break;
143 
144  case IMU_TYPE_UNKNOWN: // Unsupported
145  default:
146  return false;
147  };
148 
149  return true;
150 
151 }
152 
153 
154 }
double degreesToRadians(double degrees)
int imu_rate_t
IMU message output rate. Refer to INSCONFIG in the OEM7 manual.s.
Definition: oem7_imu.hpp:59
double feetToMeters(double feet)
Definition: oem7_imu.cpp:54
bool getImuRawScaleFactors(oem7_imu_type_t imu_type, imu_rate_t imu_rate, double &gyro_scale, double &acc_scale)
Definition: oem7_imu.cpp:61
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
const double ONE_G
Definition: oem7_imu.cpp:33
oem7_imu_type_t
IMUs supported on OEM7 products; refer to INSCONFIG in the OEM7 manual.
Definition: oem7_imu.hpp:29
double arcsecondsToRadians(double arcsecs)
Definition: oem7_imu.cpp:38


novatel_oem7_driver
Author(s):
autogenerated on Sun Mar 19 2023 02:17:36