Helvijs Kiselis
/
Micromouse
Algorithmus
IRSensor.cpp@36:99f60052c746, 2018-06-30 (annotated)
- Committer:
- luethale
- Date:
- Sat Jun 30 14:13:27 2018 +0000
- Revision:
- 36:99f60052c746
- Parent:
- 21:41997651337a
- Child:
- 29:0419f4873807
Nacht_der_Technik; Angepasste Werte:; Move & HalfeMove; Ev. Bechleunigung verbessern (aprupte Stops); Ev. Move & HalfeMove weiter anpassen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Helvis | 1:2b5f79285a3e | 1 | #include <cmath> |
Helvis | 1:2b5f79285a3e | 2 | #include "IRSensor.h" |
Helvis | 1:2b5f79285a3e | 3 | |
Helvis | 1:2b5f79285a3e | 4 | using namespace std; |
Helvis | 1:2b5f79285a3e | 5 | |
Helvis | 1:2b5f79285a3e | 6 | IRSensor::IRSensor(AnalogIn& distance) : |
Helvis | 1:2b5f79285a3e | 7 | distance(distance){} |
Helvis | 1:2b5f79285a3e | 8 | |
Helvis | 1:2b5f79285a3e | 9 | IRSensor::~IRSensor() {} |
Helvis | 1:2b5f79285a3e | 10 | |
Helvis | 1:2b5f79285a3e | 11 | float IRSensor::readL() { |
Helvis | 1:2b5f79285a3e | 12 | //Links B2 |
Helvis | 3:076dd7ec7eb4 | 13 | float d2 = 10.2817f*(1/(pow(distance,1.212121f))); |
Helvis | 1:2b5f79285a3e | 14 | |
Helvis | 1:2b5f79285a3e | 15 | return d2; |
Helvis | 1:2b5f79285a3e | 16 | |
Helvis | 1:2b5f79285a3e | 17 | } |
Helvis | 1:2b5f79285a3e | 18 | |
Helvis | 1:2b5f79285a3e | 19 | float IRSensor::readR(){ |
Helvis | 1:2b5f79285a3e | 20 | //Rechts B1 |
Helvis | 3:076dd7ec7eb4 | 21 | float d1 = 11.6037f*(1/(pow(distance,1.111111f))); |
Helvis | 1:2b5f79285a3e | 22 | |
Helvis | 1:2b5f79285a3e | 23 | return d1; |
Helvis | 1:2b5f79285a3e | 24 | } |
Helvis | 1:2b5f79285a3e | 25 | |
Helvis | 1:2b5f79285a3e | 26 | float IRSensor::readC(){ |
Helvis | 1:2b5f79285a3e | 27 | //Vorne B4 |
Helvis | 3:076dd7ec7eb4 | 28 | float d4 = 28.053f*(1.0f/distance); |
Helvis | 1:2b5f79285a3e | 29 | |
Helvis | 1:2b5f79285a3e | 30 | return d4; |
Helvis | 1:2b5f79285a3e | 31 | } |
Helvis | 1:2b5f79285a3e | 32 | |
Helvis | 1:2b5f79285a3e | 33 | //float IRSensor::readB(){} |