source: trunk/MagicSoft/Cosy/devdrv/shaftencoder.h@ 9432

Last change on this file since 9432 was 9431, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.5 KB
Line 
1#ifndef COSY_ShafTEncoder
2#define COSY_ShafTEncoder
3
4#ifndef COSY_NodeDrv
5#include "nodedrv.h"
6#endif
7
8#ifndef MARS_MTime
9#include "MTime.h"
10#endif
11
12class Macs;
13class TGLabel;
14
15enum Direction_t { kUndefined, kForward, kBackward };
16
17class ShaftEncoder : public NodeDrv
18{
19private:
20 LWORDS_t fPos; // ticks
21 WORDS_t fVel; // ticks per 5ms
22 WORDS_t fAcc; // ticks per 25ms^2
23 LWORD_t fPosRes; // Number of ticks per revolution (resolution)
24 WORD_t fTurns; // Number of possible turns
25
26 TGLabel *fLabel; //
27 LWORDS_t fUpdPos; // ticks
28
29 bool fPosHasChanged; //!
30 bool fDirHasChanged; //!
31
32 MTime fTime;
33 MLog *fReport;
34
35 void HandlePDOType0(const BYTE_t *data, const timeval_t &tv);
36 void HandlePDOType1(const BYTE_t *data, const timeval_t &tv);
37 void HandlePDOType2(const BYTE_t *data, const timeval_t &tv);
38
39 void ReqPos();
40
41 void Init();
42 void CheckConnection();
43 // void CheckTwin(Int_t diff) const;
44
45public:
46 ShaftEncoder(const BYTE_t nodeid, const char *name=NULL);
47
48 void StopDevice();
49
50 void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, const timeval_t &tv);
51 void HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, const timeval_t &tv);
52
53 void HandlePDO1(const BYTE_t *data, const timeval_t &tv) { HandlePDOType2(data, tv); }
54 void HandlePDO2(const BYTE_t *data, const timeval_t &tv) { HandlePDOType2(data, tv); }
55
56 double GetMjd();
57
58 ClassDef(ShaftEncoder, 0)
59};
60
61#endif
Note: See TracBrowser for help on using the repository browser.