#ifndef COSY_MTracking
#define COSY_MTracking

#include "coord.h"

#ifndef COSY_MPointing
#include "MPointing.h"
#endif

#ifndef COSY_MThread
#include "MThread.h"
#endif

class SlaStars;

class MTracking : public MPointing, public MThread
{
private:
    Float_t fTrackAcc;
    Float_t fTrackDec;

    //Int_t fSePosZd1;
    //Int_t fSePosZd2;
    //Int_t fSePosAz;

    //Int_t fRePosZd1;
    //Int_t fRePosZd2;
    //Int_t fRePosAz;

    //ZdAz    fRePos;  // Offset between se and re coordinate system [re]
    //ZdAz    fSePos;  // Shaftencoder Position

    MLog   *fOut;

    bool RequestRePos();
    bool SetVelocity(const ZdAz &v);
    bool LimitSpeed(ZdAz *vt, const SlaStars &sla) const;
    bool InitTracking();
    ZdAz GetPointingPosRE(Bool_t pdo=kFALSE) const;

    void *Thread();

public:
    MTracking(MCosy *cosy, const Log &log) : MPointing(cosy, log), MThread(kFALSE), fTrackAcc(0.1), fTrackDec(0.1), fOut(0) { }

    void TrackPosition(const RaDec &dst); // ra, dec [rad]
    void SetTrackAccDec(Float_t acc, Float_t dec) { fTrackAcc=0.1; fTrackDec=0.1; }

    void SetOut(MLog *fout) { fOut = fout; }

    ClassDef(MTracking, 0)
};

#endif
