| 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
44 struct magnetic_field
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
118 class EVs_AbsoluteIMU : public EVShieldI2C
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
cmps::heading_h
short heading_h
Definition: EVs_AbsoluteIMU.h:109
gyro
Definition: EVs_AbsoluteIMU.h:63
accl::ax
int ax
Definition: EVs_AbsoluteIMU.h:95
gyro::gz
int gz
Definition: EVs_AbsoluteIMU.h:74
gyro::gx_l
short gx_l
Definition: EVs_AbsoluteIMU.h:66
accl::error
int error
Definition: EVs_AbsoluteIMU.h:98
gyro::gy_l
short gy_l
Definition: EVs_AbsoluteIMU.h:68
cmps
Definition: EVs_AbsoluteIMU.h:105
accl::ax_h
short ax_h
Definition: EVs_AbsoluteIMU.h:88
magnetic_field::mz
int mz
Definition: EVs_AbsoluteIMU.h:55
gyro::gx
int gx
Definition: EVs_AbsoluteIMU.h:72
EVs_AbsoluteIMU
This class interfaces with AbsoluteIMU sensor attached to EVShield.
Definition: EVs_AbsoluteIMU.h:118
gyro::gy_h
short gy_h
Definition: EVs_AbsoluteIMU.h:67
cmps::heading
int heading
Definition: EVs_AbsoluteIMU.h:107
accl::tx
short tx
Definition: EVs_AbsoluteIMU.h:84
accl::ay_l
short ay_l
Definition: EVs_AbsoluteIMU.h:91
accl::az
int az
Definition: EVs_AbsoluteIMU.h:97
accl
Definition: EVs_AbsoluteIMU.h:82
magnetic_field::my
int my
Definition: EVs_AbsoluteIMU.h:54
magnetic_field::mz_l
short mz_l
Definition: EVs_AbsoluteIMU.h:51
gyro::gy
int gy
Definition: EVs_AbsoluteIMU.h:73
accl::ay_h
short ay_h
Definition: EVs_AbsoluteIMU.h:90
EVShieldI2C
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
magnetic_field::my_h
short my_h
Definition: EVs_AbsoluteIMU.h:48
magnetic_field
Definition: EVs_AbsoluteIMU.h:44
magnetic_field::mz_h
short mz_h
Definition: EVs_AbsoluteIMU.h:50
cmps::heading_l
short heading_l
Definition: EVs_AbsoluteIMU.h:110
accl::ty
short ty
Definition: EVs_AbsoluteIMU.h:85
magnetic_field::error
int error
Definition: EVs_AbsoluteIMU.h:56
accl::tz
short tz
Definition: EVs_AbsoluteIMU.h:86
accl::ay
int ay
Definition: EVs_AbsoluteIMU.h:96
magnetic_field::mx
int mx
Definition: EVs_AbsoluteIMU.h:53
gyro::gx_h
short gx_h
Definition: EVs_AbsoluteIMU.h:65
gyro::error
int error
Definition: EVs_AbsoluteIMU.h:75
cmps::error
int error
Definition: EVs_AbsoluteIMU.h:112
magnetic_field::mx_h
short mx_h
Definition: EVs_AbsoluteIMU.h:46
magnetic_field::my_l
short my_l
Definition: EVs_AbsoluteIMU.h:49
accl::az_l
short az_l
Definition: EVs_AbsoluteIMU.h:93
magnetic_field::mx_l
short mx_l
Definition: EVs_AbsoluteIMU.h:47
accl::ax_l
short ax_l
Definition: EVs_AbsoluteIMU.h:89
gyro::gz_h
short gz_h
Definition: EVs_AbsoluteIMU.h:69
gyro::gz_l
short gz_l
Definition: EVs_AbsoluteIMU.h:70
accl::az_h
short az_h
Definition: EVs_AbsoluteIMU.h:92