EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVs_AbsoluteIMU.h
1 
2 // EVs_AbsoluteIMU.h
3 //
4 // This is a class for reading from AbsoluteIMU, made by Mindsensors.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=169
6 
7 // Initial version: 2013-01-22 by Michael Giles
8 // Modified for EVShield: 2015-2-16 by Michael Giles
9 // Large parts of the code is ported from the NXC library for the device,
10 // written by Deepak Patil.Deepak Patil
11 
12 /*
13  This library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU Lesser General Public
15  License as published by the Free Software Foundation; either
16  version 2.1 of the License, or (at your option) any later version.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27 
28 
29 #ifndef EVs_AbsoluteIMU_H
30 #define EVs_AbsoluteIMU_H
31 
36 #define IMU_Command 0x41
37 
38 #include "EVShieldI2C.h"
39 
45 {
46  short mx_h;
47  short mx_l;
48  short my_h;
49  short my_l;
50  short mz_h;
51  short mz_l;
53  int mx;
54  int my;
55  int mz;
56  int error;
57 };
58 
63 struct gyro
64 {
65  short gx_h;
66  short gx_l;
67  short gy_h;
68  short gy_l;
69  short gz_h;
70  short gz_l;
72  int gx;
73  int gy;
74  int gz;
75  int error;
76 };
77 
82 struct accl
83 {
84  short tx;
85  short ty;
86  short tz;
88  short ax_h;
89  short ax_l;
90  short ay_h;
91  short ay_l;
92  short az_h;
93  short az_l;
95  int ax;
96  int ay;
97  int az;
98  int error;
99 };
100 
105 struct cmps
106 {
107  int heading;
109  short heading_h;
110  short heading_l;
112  int error;
113 };
114 
119 {
120 public:
122  EVs_AbsoluteIMU(uint8_t i2c_address = 0x22);
123 
125  uint8_t issueCommand(char command);
126 
131  void readGyro(gyro & currGyro);
132 
137  void readCompass(cmps & currCompass);
138 
143  void readAccelerometer(accl & currAccelerometer);
144 
149  void readMagneticField(magnetic_field & currMagnetic_field);
153  bool beginCompassCalibration();
157  bool endCompassCalibration();
158 };
159 
160 #endif
short heading_h
Definition: EVs_AbsoluteIMU.h:109
Definition: EVs_AbsoluteIMU.h:63
int ax
Definition: EVs_AbsoluteIMU.h:95
int gz
Definition: EVs_AbsoluteIMU.h:74
short gx_l
Definition: EVs_AbsoluteIMU.h:66
int error
Definition: EVs_AbsoluteIMU.h:98
short gy_l
Definition: EVs_AbsoluteIMU.h:68
Definition: EVs_AbsoluteIMU.h:105
short ax_h
Definition: EVs_AbsoluteIMU.h:88
int mz
Definition: EVs_AbsoluteIMU.h:55
int gx
Definition: EVs_AbsoluteIMU.h:72
This class interfaces with AbsoluteIMU sensor attached to EVShield.
Definition: EVs_AbsoluteIMU.h:118
short gy_h
Definition: EVs_AbsoluteIMU.h:67
int heading
Definition: EVs_AbsoluteIMU.h:107
short tx
Definition: EVs_AbsoluteIMU.h:84
short ay_l
Definition: EVs_AbsoluteIMU.h:91
int az
Definition: EVs_AbsoluteIMU.h:97
Definition: EVs_AbsoluteIMU.h:82
int my
Definition: EVs_AbsoluteIMU.h:54
short mz_l
Definition: EVs_AbsoluteIMU.h:51
int gy
Definition: EVs_AbsoluteIMU.h:73
short ay_h
Definition: EVs_AbsoluteIMU.h:90
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
short my_h
Definition: EVs_AbsoluteIMU.h:48
Definition: EVs_AbsoluteIMU.h:44
short mz_h
Definition: EVs_AbsoluteIMU.h:50
short heading_l
Definition: EVs_AbsoluteIMU.h:110
short ty
Definition: EVs_AbsoluteIMU.h:85
int error
Definition: EVs_AbsoluteIMU.h:56
short tz
Definition: EVs_AbsoluteIMU.h:86
int ay
Definition: EVs_AbsoluteIMU.h:96
int mx
Definition: EVs_AbsoluteIMU.h:53
short gx_h
Definition: EVs_AbsoluteIMU.h:65
int error
Definition: EVs_AbsoluteIMU.h:75
int error
Definition: EVs_AbsoluteIMU.h:112
short mx_h
Definition: EVs_AbsoluteIMU.h:46
short my_l
Definition: EVs_AbsoluteIMU.h:49
short az_l
Definition: EVs_AbsoluteIMU.h:93
short mx_l
Definition: EVs_AbsoluteIMU.h:47
short ax_l
Definition: EVs_AbsoluteIMU.h:89
short gz_h
Definition: EVs_AbsoluteIMU.h:69
short gz_l
Definition: EVs_AbsoluteIMU.h:70
short az_h
Definition: EVs_AbsoluteIMU.h:92