Pathfinding nach rechts funktioniert noch nicht...der rest schon

Dependencies:   mbed

Fork of MicroMouse_MASTER_THREE by PES2_R2D2.0

Controller.h

Committer:
ruesipat
Date:
2018-04-25
Revision:
5:b8b1a979b0d5
Parent:
1:d9e840c48b1e

File content as of revision 5:b8b1a979b0d5:

#ifndef CONTROLLER_H_
#define CONTROLLER_H_
#include <cstdlib>
#include <mbed.h>
#include "EncoderCounter.h"
#include "LowpassFilter.h"

class Controller
{

public:

    Controller(PwmOut& pwmLeft, PwmOut& pwmRight,
               EncoderCounter& counterLeft, EncoderCounter& counterRight);

    virtual ~Controller();
    void setDesiredSpeedLeft(float desiredSpeedLeft);
    void setDesiredSpeedRight(float desiredSpeedRight);
    float getSpeedLeft();
    float getSpeedRight();
    float getIntegralLeft();
    float getIntegralRight();
    float getProportionalLeft();
    float getProportionalRight();
    void reset();

private:

    static const float PERIOD;
    static const float COUNTS_PER_TURN;
    static const float LOWPASS_FILTER_FREQUENCY;
    static const float KN;
    static const float KP;
    static const float KI;
    static const float I_MAX;
    static const float MAX_VOLTAGE;
    static const float MIN_DUTY_CYCLE;
    static const float MAX_DUTY_CYCLE;

    PwmOut&            pwmLeft;
    PwmOut&            pwmRight;
    EncoderCounter&    counterLeft;
    EncoderCounter&    counterRight;
    short              previousValueCounterLeft;
    short              previousValueCounterRight;
    LowpassFilter      speedLeftFilter;
    LowpassFilter      speedRightFilter;
    float              desiredSpeedLeft;
    float              desiredSpeedRight;
    float              actualSpeedLeft;
    float              actualSpeedRight;
    float              iSumLeft;
    float              iSumRight;
    Ticker             ticker;

    void               run();

};

#endif /* CONTROLLER_H_ */