official library and example code for tracking X and Y positions on the dump truck

Dependencies:   QEI mbed

Dependents:   DUMP_TRUCK_TEST_V1 DUMP_TRUCK_SPR2017

Tracker.h

Committer:
simplyellow
Date:
2017-01-26
Revision:
0:8038ea3ee241
Child:
5:757a984ac553

File content as of revision 0:8038ea3ee241:

#ifndef TRACKER_H
#define TRACKER_H

#include "mbed.h"
#include "QEI.h"

#define STRAIGHT    0
#define CCW         1
#define CW          2
#define PI          3.14159265

class Tracker {
    public:
        Tracker(PinName _chA, PinName _chB, PinName _pot);
        void clear();
        void potSetup();
        void setDirection();
        void checkToStart();
        void calcDisplacement();
    private:
        QEI *wheel;
        PinName chA;
        PinName chB;
        AnalogIn pot;
        float pulseCount;
        float encoding;
        float circumference;
        float constant;

        float distance;

        float x;
        float y;

        float value;
        float turnAngle;
        float zeroAngle;

        int dir;

        float df;
        float db;
        float W;
        float R;
        float dispAngle;

};
#endif