Sam
ActionEncoder.hpp@2:611a5eb132a1, 2020-09-13 (annotated)
- Committer:
- s0313045
- Date:
- Sun Sep 13 04:30:54 2020 +0000
- Revision:
- 2:611a5eb132a1
- Parent:
- 0:502b364c9f1d
by Sam
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
s0313045 | 0:502b364c9f1d | 1 | /* |
s0313045 | 0:502b364c9f1d | 2 | * ActionEncoder.hpp |
s0313045 | 0:502b364c9f1d | 3 | * |
s0313045 | 0:502b364c9f1d | 4 | * Created on: 7 Mar 2018 |
s0313045 | 0:502b364c9f1d | 5 | * Author: tung |
s0313045 | 0:502b364c9f1d | 6 | */ |
s0313045 | 0:502b364c9f1d | 7 | |
s0313045 | 0:502b364c9f1d | 8 | #ifndef INCLUDE_ACTIONENCODER_HPP_ |
s0313045 | 0:502b364c9f1d | 9 | #define INCLUDE_ACTIONENCODER_HPP_ |
s0313045 | 0:502b364c9f1d | 10 | |
s0313045 | 0:502b364c9f1d | 11 | #include <stdint.h> |
s0313045 | 0:502b364c9f1d | 12 | //#include <Serial.hpp> |
s0313045 | 0:502b364c9f1d | 13 | |
s0313045 | 0:502b364c9f1d | 14 | class ActionEncoder |
s0313045 | 0:502b364c9f1d | 15 | { |
s0313045 | 0:502b364c9f1d | 16 | private: |
s0313045 | 0:502b364c9f1d | 17 | uint8_t count,i,done; |
s0313045 | 0:502b364c9f1d | 18 | union{ |
s0313045 | 0:502b364c9f1d | 19 | uint8_t data[24]; |
s0313045 | 0:502b364c9f1d | 20 | float val[6]; |
s0313045 | 0:502b364c9f1d | 21 | }posture; |
s0313045 | 0:502b364c9f1d | 22 | float xangle,yangle,zangle,pos_x,pos_y,angleSpeed,d_angle; |
s0313045 | 0:502b364c9f1d | 23 | float temp_zangle; |
s0313045 | 0:502b364c9f1d | 24 | bool newDataArrived; |
s0313045 | 0:502b364c9f1d | 25 | public: |
s0313045 | 0:502b364c9f1d | 26 | ActionEncoder(); |
s0313045 | 0:502b364c9f1d | 27 | void readEncoder(char); |
s0313045 | 0:502b364c9f1d | 28 | bool updated(); |
s0313045 | 0:502b364c9f1d | 29 | float getXangle(); |
s0313045 | 0:502b364c9f1d | 30 | float getYangle(); |
s0313045 | 0:502b364c9f1d | 31 | float getZangle(); |
s0313045 | 0:502b364c9f1d | 32 | float getXpos(); |
s0313045 | 0:502b364c9f1d | 33 | float getYpos(); |
s0313045 | 0:502b364c9f1d | 34 | float getAngleSpeed(); |
s0313045 | 0:502b364c9f1d | 35 | char * reset(); |
s0313045 | 0:502b364c9f1d | 36 | char * calibrate(); |
s0313045 | 0:502b364c9f1d | 37 | bool isAlive(); |
s0313045 | 0:502b364c9f1d | 38 | bool newDataAvailable(); |
s0313045 | 0:502b364c9f1d | 39 | uint32_t LastRead; |
s0313045 | 0:502b364c9f1d | 40 | |
s0313045 | 0:502b364c9f1d | 41 | }; |
s0313045 | 0:502b364c9f1d | 42 | |
s0313045 | 0:502b364c9f1d | 43 | |
s0313045 | 0:502b364c9f1d | 44 | |
s0313045 | 0:502b364c9f1d | 45 | |
s0313045 | 0:502b364c9f1d | 46 | |
s0313045 | 0:502b364c9f1d | 47 | |
s0313045 | 0:502b364c9f1d | 48 | |
s0313045 | 0:502b364c9f1d | 49 | #endif /* INCLUDE_ACTIONENCODER_HPP_ */ |