odometry
Odometry.h@0:402f8c75d394, 2015-08-11 (annotated)
- Committer:
- zatakon
- Date:
- Tue Aug 11 13:05:46 2015 +0000
- Revision:
- 0:402f8c75d394
- Child:
- 1:1765665581cc
??????????; ??????????; ??????????; ?????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zatakon | 0:402f8c75d394 | 1 | #ifndef Odometry_H |
zatakon | 0:402f8c75d394 | 2 | #define Odometry_H |
zatakon | 0:402f8c75d394 | 3 | |
zatakon | 0:402f8c75d394 | 4 | #include <vector> |
zatakon | 0:402f8c75d394 | 5 | #include "mbed.h" |
zatakon | 0:402f8c75d394 | 6 | #include "math.h" |
zatakon | 0:402f8c75d394 | 7 | #define M_PI 3.14159265358979323846 /* pi */ |
zatakon | 0:402f8c75d394 | 8 | |
zatakon | 0:402f8c75d394 | 9 | |
zatakon | 0:402f8c75d394 | 10 | class Robot |
zatakon | 0:402f8c75d394 | 11 | { |
zatakon | 0:402f8c75d394 | 12 | public: |
zatakon | 0:402f8c75d394 | 13 | Robot(float wheelbase, float width, float countPerMeter); |
zatakon | 0:402f8c75d394 | 14 | |
zatakon | 0:402f8c75d394 | 15 | /* returns radius in [m]. When turning right, radius is negativ |
zatakon | 0:402f8c75d394 | 16 | * left is positive |
zatakon | 0:402f8c75d394 | 17 | * |
zatakon | 0:402f8c75d394 | 18 | * param servoAngle is how is the servo angle in radians. Center |
zatakon | 0:402f8c75d394 | 19 | * is pi/2 (1.571) |
zatakon | 0:402f8c75d394 | 20 | */ |
zatakon | 0:402f8c75d394 | 21 | float getRadius(float servoAngle); |
zatakon | 0:402f8c75d394 | 22 | |
zatakon | 0:402f8c75d394 | 23 | void countRadius(float servoAngle); |
zatakon | 0:402f8c75d394 | 24 | |
zatakon | 0:402f8c75d394 | 25 | float getServoAngle(float R); |
zatakon | 0:402f8c75d394 | 26 | |
zatakon | 0:402f8c75d394 | 27 | /* returns speed in format |
zatakon | 0:402f8c75d394 | 28 | * [0] = linear x |
zatakon | 0:402f8c75d394 | 29 | * [1] = linear y |
zatakon | 0:402f8c75d394 | 30 | * [2] = angular z |
zatakon | 0:402f8c75d394 | 31 | * |
zatakon | 0:402f8c75d394 | 32 | * function needs actual R |
zatakon | 0:402f8c75d394 | 33 | */ |
zatakon | 0:402f8c75d394 | 34 | std::vector<float> getSpeed(std::vector<int> encoders); |
zatakon | 0:402f8c75d394 | 35 | |
zatakon | 0:402f8c75d394 | 36 | std::vector<float> getMotorRatio(); |
zatakon | 0:402f8c75d394 | 37 | |
zatakon | 0:402f8c75d394 | 38 | std::vector<float> getMotorRatio(float R); |
zatakon | 0:402f8c75d394 | 39 | |
zatakon | 0:402f8c75d394 | 40 | private: |
zatakon | 0:402f8c75d394 | 41 | float _whbs; // wheelbase |
zatakon | 0:402f8c75d394 | 42 | float _w; // width |
zatakon | 0:402f8c75d394 | 43 | float _R; |
zatakon | 0:402f8c75d394 | 44 | uint32_t _countPerMeter; |
zatakon | 0:402f8c75d394 | 45 | |
zatakon | 0:402f8c75d394 | 46 | std::vector<float> _odom; |
zatakon | 0:402f8c75d394 | 47 | std::vector<float> _ratio; |
zatakon | 0:402f8c75d394 | 48 | }; |
zatakon | 0:402f8c75d394 | 49 | |
zatakon | 0:402f8c75d394 | 50 | #endif |