with class
Dependencies: ISR_Mini-explorer mbed
Fork of VirtualForces by
Sonar.hpp@39:890439b495e3, 2017-06-16 (annotated)
- Committer:
- Ludwigfr
- Date:
- Fri Jun 16 10:40:53 2017 +0000
- Revision:
- 39:890439b495e3
- Parent:
- 38:5ed7c79fb724
last version with the 4th lab;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ludwigfr | 33:814bcd7d3cfe | 1 | #ifndef SONAR_HPP |
Ludwigfr | 33:814bcd7d3cfe | 2 | #define SONAR_HPP |
Ludwigfr | 33:814bcd7d3cfe | 3 | |
Ludwigfr | 34:c208497dd079 | 4 | #include<math.h> |
Ludwigfr | 33:814bcd7d3cfe | 5 | |
Ludwigfr | 33:814bcd7d3cfe | 6 | class Sonar { |
Ludwigfr | 33:814bcd7d3cfe | 7 | |
Ludwigfr | 36:b59d56d0b3b4 | 8 | public: |
Ludwigfr | 33:814bcd7d3cfe | 9 | float maxRange;//cm |
Ludwigfr | 33:814bcd7d3cfe | 10 | float minRange;//Rmin cm |
Ludwigfr | 33:814bcd7d3cfe | 11 | float incertitudeRange;//cm |
Ludwigfr | 33:814bcd7d3cfe | 12 | float angleRange;//Omega rad |
Ludwigfr | 38:5ed7c79fb724 | 13 | float angleFromCenter; |
Ludwigfr | 33:814bcd7d3cfe | 14 | float distanceX; |
Ludwigfr | 33:814bcd7d3cfe | 15 | float distanceY; |
Ludwigfr | 33:814bcd7d3cfe | 16 | |
Ludwigfr | 35:68f9edbb3cff | 17 | //the distance are in the world coordinates |
Ludwigfr | 38:5ed7c79fb724 | 18 | Sonar(float angleFromCenter, float distanceXFromRobotCenter, float distanceYFromRobotCenter ); |
Ludwigfr | 33:814bcd7d3cfe | 19 | |
Ludwigfr | 34:c208497dd079 | 20 | float compute_probability_t(float distanceObstacleDetected, float xCell, float yCell, float xRobotWorld, float yRobotWorld, float theta); |
Ludwigfr | 36:b59d56d0b3b4 | 21 | |
Ludwigfr | 38:5ed7c79fb724 | 22 | //return distance sonar to cell if in range, -1 if not |
Ludwigfr | 38:5ed7c79fb724 | 23 | float isInRange(float xCell, float yCell, float xRobotWorld, float yRobotWorld, float thetaWorld); |
Ludwigfr | 38:5ed7c79fb724 | 24 | |
Ludwigfr | 36:b59d56d0b3b4 | 25 | private: |
Ludwigfr | 36:b59d56d0b3b4 | 26 | |
Ludwigfr | 33:814bcd7d3cfe | 27 | //returns the angle between the vectors (x,y) and (xs,ys) |
Ludwigfr | 33:814bcd7d3cfe | 28 | float compute_angle_between_vectors(float x, float y,float xs,float ys); |
Ludwigfr | 33:814bcd7d3cfe | 29 | |
Ludwigfr | 33:814bcd7d3cfe | 30 | //makes the angle inAngle between 0 and 2pi |
Ludwigfr | 33:814bcd7d3cfe | 31 | float rad_angle_check(float inAngle); |
Ludwigfr | 33:814bcd7d3cfe | 32 | |
Ludwigfr | 33:814bcd7d3cfe | 33 | }; |
Ludwigfr | 33:814bcd7d3cfe | 34 | |
Ludwigfr | 33:814bcd7d3cfe | 35 | #endif |
Ludwigfr | 33:814bcd7d3cfe | 36 |