Statistics
| Branch: | Tag: | Revision:

amiro-os / devices / DiWheelDrive / linefollow2.hpp @ 22b85da1

History | View | Annotate | Download (802 Bytes)

1 c76baf23 Georg Alberding
#ifndef AMIRO_LINEFOLLOWING_H
2
#define AMIRO_LINEFOLLOWING_H
3
4
#include <ch.hpp>
5
6
#include <amiroosconf.h>
7
8
namespace amiro {
9
10
class LineFollow
11
{
12
public:
13
  void printSensorData();
14 25388c2f Georg Alberding
  void stableFollow(int vcnl4020Proximity[4], int (&rpmFuzzyCtrl)[2], Global *global);
15 2330e415 Georg Alberding
  float SetPoint = 0x4000; // (0x1800+0x2800) >> 8
16
  float Kp = 0.001;
17
  float Ki = 0.00001;
18 22b85da1 galberding
  float Kd = 0.5;
19 25388c2f Georg Alberding
  int accSum = 0;
20
  float oldError = 0;
21 b8085493 Georg Alberding
  int biggestDiff = 0;
22 12463563 galberding
  Global *global;
23
  LineFollow(Global *global);
24 22b85da1 galberding
  // void calibrateZiegler(float KCrit, int rpmSpeed[2]);
25
  int followLeftEdge(int rpmSpeed[2]);
26
  int followRightEdge(int rpmSpeed[2]);
27 af93a91c galberding
28
  private:
29
    int delta();
30 22b85da1 galberding
    int getError();
31
    int getPidCorrectionSpeed();
32
33
    char whiteFlag = 0;
34
    
35 2330e415 Georg Alberding
36 c76baf23 Georg Alberding
};
37
38
} // end of namespace amiro
39
40
#endif // AMIRO_LINEFOLLOWING_H