EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVs_LineLeader.h
1 
2 // EVs_LineLeader.h
3 //
4 // This is a class for reading from LineLeader Sensor made by Openelectrons.com.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=111
6 
7 // Initial version: 2010-06-15 by Andrew Sylvester
8 // Modified for EVShield: 2015-02-16 by Michael Giles
9 // Large parts of the code is ported from the NXC library for the device,
10 // written by 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_LineLeader_H
30 #define EVs_LineLeader_H
31 
32 #define LineLeader_Raw_Calibrated 0x49
33 #define LineLeader_Raw_Uncalibrated 0x74
34 #define LineLeader_White_Limit 0x51
35 #define LineLeader_Black_Limit 0x59
36 #define LineLeader_White_Calibration 0x64
37 #define LineLeader_Black_Calibration 0x6C
38 
39 
40 #define LineLeader_Command 0x41
41 #define LineLeader_Steering 0x42
42 #define LineLeader_Average 0x43
43 #define LineLeader_Result 0x44
44 #define LineLeader_SetPoint 0x45
45 #define LineLeader_Kp 0x46
46 #define LineLeader_Ki 0x47
47 #define LineLeader_Kd 0x48
48 #define LineLeader_Kp_Factor 0x61
49 #define LineLeader_Ki_Factor 0x62
50 #define LineLeader_Kd_Factor 0x63
51 
52 #include "EVShieldI2C.h"
53 
58 {
59 public:
61  EVs_LineLeader(uint8_t i2c_address = 0x02);
62 
64  uint8_t issueCommand(char command);
65 
67  bool calibrateWhite();
68 
70  bool calibrateBlack();
71 
73  bool sleep();
74 
76  bool wakeUp();
77 
81 
84  bool resetColorInversion();
85 
89  bool takeSnapshot();
90 
93  bool configureUS();
94 
97  bool configureEurope();
98 
101  bool configureUniversal();
102 
104  uint8_t getSetPoint();
105 
107  bool setSetPoint(uint8_t spoint);
108 
110  uint8_t getKp(uint8_t kp);
111 
113  bool setKp(uint8_t kp);
114 
116  uint8_t getKi(uint8_t ki);
117 
119  bool setKi(uint8_t ki);
120 
122  uint8_t getKd(uint8_t kd);
123 
125  bool setKd(uint8_t kd);
126 
131  uint8_t getKpFactor(uint8_t kpfact);
132 
136  bool setKpFactor(uint8_t kpfact);
137 
142  uint8_t getKiFactor(uint8_t kifact);
143 
147  bool setKiFactor(uint8_t kifact);
148 
153  uint8_t getKdFactor(uint8_t kdfact);
154 
158  bool setKdFactor(uint8_t kdfact);
159 
161  int getSteering();
162 
164  unsigned char getAverage();
165 
167  unsigned char getResult();
168 
173  uint8_t* getRawCalibrated();
174 
178  uint8_t* getRawUncalibrated();
179 
181  uint8_t* getWhiteLimit();
182 
184  uint8_t* getBlackLimit();
185 
187  uint8_t* getWhiteCalibration();
188 
190  uint8_t* getBlackCalibration();
191 
192 };
193 
194 #endif /* LineLeader_H_ */
bool configureEurope()
Definition: EVs_LineLeader.cpp:82
uint8_t getKp(uint8_t kp)
Definition: EVs_LineLeader.cpp:102
bool configureUniversal()
Definition: EVs_LineLeader.cpp:87
bool calibrateWhite()
Definition: EVs_LineLeader.cpp:42
bool setKd(uint8_t kd)
Definition: EVs_LineLeader.cpp:127
bool sleep()
Definition: EVs_LineLeader.cpp:52
uint8_t * getBlackCalibration()
Definition: EVs_LineLeader.cpp:202
unsigned char getResult()
Definition: EVs_LineLeader.cpp:172
uint8_t getKdFactor(uint8_t kdfact)
Definition: EVs_LineLeader.cpp:152
bool setKp(uint8_t kp)
Definition: EVs_LineLeader.cpp:107
bool takeSnapshot()
Definition: EVs_LineLeader.cpp:72
uint8_t getKi(uint8_t ki)
Definition: EVs_LineLeader.cpp:112
uint8_t * getRawUncalibrated()
Definition: EVs_LineLeader.cpp:182
uint8_t issueCommand(char command)
Definition: EVs_LineLeader.cpp:37
uint8_t getKd(uint8_t kd)
Definition: EVs_LineLeader.cpp:122
bool wakeUp()
Definition: EVs_LineLeader.cpp:57
unsigned char getAverage()
Definition: EVs_LineLeader.cpp:167
int getSteering()
Definition: EVs_LineLeader.cpp:162
uint8_t * getWhiteCalibration()
Definition: EVs_LineLeader.cpp:197
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
bool invertLineColorToWhite()
Definition: EVs_LineLeader.cpp:62
uint8_t * getRawCalibrated()
Definition: EVs_LineLeader.cpp:177
bool setKpFactor(uint8_t kpfact)
Definition: EVs_LineLeader.cpp:137
uint8_t getKpFactor(uint8_t kpfact)
Definition: EVs_LineLeader.cpp:132
bool resetColorInversion()
Definition: EVs_LineLeader.cpp:67
bool setKiFactor(uint8_t kifact)
Definition: EVs_LineLeader.cpp:147
EVs_LineLeader(uint8_t i2c_address=0x02)
Definition: EVs_LineLeader.cpp:32
bool setKi(uint8_t ki)
Definition: EVs_LineLeader.cpp:117
uint8_t * getWhiteLimit()
Definition: EVs_LineLeader.cpp:187
uint8_t * getBlackLimit()
Definition: EVs_LineLeader.cpp:192
uint8_t getKiFactor(uint8_t kifact)
Definition: EVs_LineLeader.cpp:142
uint8_t getSetPoint()
Definition: EVs_LineLeader.cpp:92
bool calibrateBlack()
Definition: EVs_LineLeader.cpp:47
This class interfaces with NXTLineLeader sensor attached to EVShield.
Definition: EVs_LineLeader.h:57
bool configureUS()
Definition: EVs_LineLeader.cpp:77
bool setSetPoint(uint8_t spoint)
Definition: EVs_LineLeader.cpp:97
bool setKdFactor(uint8_t kdfact)
Definition: EVs_LineLeader.cpp:157