with class
Dependencies: ISR_Mini-explorer mbed
Fork of VirtualForces by
Sonar.hpp@35:68f9edbb3cff, 2017-06-11 (annotated)
- Committer:
- Ludwigfr
- Date:
- Sun Jun 11 22:40:37 2017 +0000
- Revision:
- 35:68f9edbb3cff
- Parent:
- 34:c208497dd079
- Child:
- 36:b59d56d0b3b4
change so every command to the robot is in world coordinate
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 | 33:814bcd7d3cfe | 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 | 33:814bcd7d3cfe | 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 | 34:c208497dd079 | 18 | Sonar(float anlgeFromCenter, float distanceXFromRobotCenter, float distanceYFromRobotCenter ); |
Ludwigfr | 33:814bcd7d3cfe | 19 | |
Ludwigfr | 33:814bcd7d3cfe | 20 | //ODOMETRIA MUST HAVE BEEN CALLED |
Ludwigfr | 33:814bcd7d3cfe | 21 | //function that check if a cell A(x,y) is in the range of the front sonar S(xs,ys) (with an angle depending on the sonar used, front 0, left pi/3, right -pi/3) returns the probability it's occupied/empty [0;1] |
Ludwigfr | 34:c208497dd079 | 22 | float compute_probability_t(float distanceObstacleDetected, float xCell, float yCell, float xRobotWorld, float yRobotWorld, float theta); |
Ludwigfr | 33:814bcd7d3cfe | 23 | |
Ludwigfr | 33:814bcd7d3cfe | 24 | //returns the angle between the vectors (x,y) and (xs,ys) |
Ludwigfr | 33:814bcd7d3cfe | 25 | float compute_angle_between_vectors(float x, float y,float xs,float ys); |
Ludwigfr | 33:814bcd7d3cfe | 26 | |
Ludwigfr | 33:814bcd7d3cfe | 27 | //makes the angle inAngle between 0 and 2pi |
Ludwigfr | 33:814bcd7d3cfe | 28 | float rad_angle_check(float inAngle); |
Ludwigfr | 33:814bcd7d3cfe | 29 | |
Ludwigfr | 33:814bcd7d3cfe | 30 | }; |
Ludwigfr | 33:814bcd7d3cfe | 31 | |
Ludwigfr | 33:814bcd7d3cfe | 32 | #endif |
Ludwigfr | 33:814bcd7d3cfe | 33 |