| 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
57 class EVs_LineLeader : public EVShieldI2C
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
80 bool invertLineColorToWhite();
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_ */
EVs_LineLeader::configureEurope
bool configureEurope()
Definition: EVs_LineLeader.cpp:82
EVs_LineLeader::getKp
uint8_t getKp(uint8_t kp)
Definition: EVs_LineLeader.cpp:102
EVs_LineLeader::configureUniversal
bool configureUniversal()
Definition: EVs_LineLeader.cpp:87
EVs_LineLeader::calibrateWhite
bool calibrateWhite()
Definition: EVs_LineLeader.cpp:42
EVs_LineLeader::setKd
bool setKd(uint8_t kd)
Definition: EVs_LineLeader.cpp:127
EVs_LineLeader::sleep
bool sleep()
Definition: EVs_LineLeader.cpp:52
EVs_LineLeader::getBlackCalibration
uint8_t * getBlackCalibration()
Definition: EVs_LineLeader.cpp:202
EVs_LineLeader::getResult
unsigned char getResult()
Definition: EVs_LineLeader.cpp:172
EVs_LineLeader::getKdFactor
uint8_t getKdFactor(uint8_t kdfact)
Definition: EVs_LineLeader.cpp:152
EVs_LineLeader::setKp
bool setKp(uint8_t kp)
Definition: EVs_LineLeader.cpp:107
EVs_LineLeader::takeSnapshot
bool takeSnapshot()
Definition: EVs_LineLeader.cpp:72
EVs_LineLeader::getKi
uint8_t getKi(uint8_t ki)
Definition: EVs_LineLeader.cpp:112
EVs_LineLeader::getRawUncalibrated
uint8_t * getRawUncalibrated()
Definition: EVs_LineLeader.cpp:182
EVs_LineLeader::issueCommand
uint8_t issueCommand(char command)
Definition: EVs_LineLeader.cpp:37
EVs_LineLeader::getKd
uint8_t getKd(uint8_t kd)
Definition: EVs_LineLeader.cpp:122
EVs_LineLeader::wakeUp
bool wakeUp()
Definition: EVs_LineLeader.cpp:57
EVs_LineLeader::getAverage
unsigned char getAverage()
Definition: EVs_LineLeader.cpp:167
EVs_LineLeader::getSteering
int getSteering()
Definition: EVs_LineLeader.cpp:162
EVs_LineLeader::getWhiteCalibration
uint8_t * getWhiteCalibration()
Definition: EVs_LineLeader.cpp:197
EVShieldI2C
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
EVs_LineLeader::invertLineColorToWhite
bool invertLineColorToWhite()
Definition: EVs_LineLeader.cpp:62
EVs_LineLeader::getRawCalibrated
uint8_t * getRawCalibrated()
Definition: EVs_LineLeader.cpp:177
EVs_LineLeader::setKpFactor
bool setKpFactor(uint8_t kpfact)
Definition: EVs_LineLeader.cpp:137
EVs_LineLeader::getKpFactor
uint8_t getKpFactor(uint8_t kpfact)
Definition: EVs_LineLeader.cpp:132
EVs_LineLeader::resetColorInversion
bool resetColorInversion()
Definition: EVs_LineLeader.cpp:67
EVs_LineLeader::setKiFactor
bool setKiFactor(uint8_t kifact)
Definition: EVs_LineLeader.cpp:147
EVs_LineLeader::EVs_LineLeader
EVs_LineLeader(uint8_t i2c_address=0x02)
Definition: EVs_LineLeader.cpp:32
EVs_LineLeader::setKi
bool setKi(uint8_t ki)
Definition: EVs_LineLeader.cpp:117
EVs_LineLeader::getWhiteLimit
uint8_t * getWhiteLimit()
Definition: EVs_LineLeader.cpp:187
EVs_LineLeader::getBlackLimit
uint8_t * getBlackLimit()
Definition: EVs_LineLeader.cpp:192
EVs_LineLeader::getKiFactor
uint8_t getKiFactor(uint8_t kifact)
Definition: EVs_LineLeader.cpp:142
EVs_LineLeader::getSetPoint
uint8_t getSetPoint()
Definition: EVs_LineLeader.cpp:92
EVs_LineLeader::calibrateBlack
bool calibrateBlack()
Definition: EVs_LineLeader.cpp:47
EVs_LineLeader
This class interfaces with NXTLineLeader sensor attached to EVShield.
Definition: EVs_LineLeader.h:57
EVs_LineLeader::configureUS
bool configureUS()
Definition: EVs_LineLeader.cpp:77
EVs_LineLeader::setSetPoint
bool setSetPoint(uint8_t spoint)
Definition: EVs_LineLeader.cpp:97
EVs_LineLeader::setKdFactor
bool setKdFactor(uint8_t kdfact)
Definition: EVs_LineLeader.cpp:157