![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
lab robotic coimbra
Dependencies: ISR_Mini-explorer mbed
Sonar.hpp@0:9f7ee7ed13e4, 2017-06-26 (annotated)
- Committer:
- Ludwigfr
- Date:
- Mon Jun 26 12:05:20 2017 +0000
- Revision:
- 0:9f7ee7ed13e4
this version should work, though it would be nice to test all the lab demo; there's also some code on the 4th lab at the end of MiniExplorerCoimbra.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ludwigfr | 0:9f7ee7ed13e4 | 1 | #ifndef SONAR_HPP |
Ludwigfr | 0:9f7ee7ed13e4 | 2 | #define SONAR_HPP |
Ludwigfr | 0:9f7ee7ed13e4 | 3 | |
Ludwigfr | 0:9f7ee7ed13e4 | 4 | #include<math.h> |
Ludwigfr | 0:9f7ee7ed13e4 | 5 | |
Ludwigfr | 0:9f7ee7ed13e4 | 6 | class Sonar { |
Ludwigfr | 0:9f7ee7ed13e4 | 7 | |
Ludwigfr | 0:9f7ee7ed13e4 | 8 | public: |
Ludwigfr | 0:9f7ee7ed13e4 | 9 | float maxRange;//cm |
Ludwigfr | 0:9f7ee7ed13e4 | 10 | float minRange;//Rmin cm |
Ludwigfr | 0:9f7ee7ed13e4 | 11 | float incertitudeRange;//cm |
Ludwigfr | 0:9f7ee7ed13e4 | 12 | float angleRange;//Omega rad |
Ludwigfr | 0:9f7ee7ed13e4 | 13 | float angleFromCenter; |
Ludwigfr | 0:9f7ee7ed13e4 | 14 | float distanceX; |
Ludwigfr | 0:9f7ee7ed13e4 | 15 | float distanceY; |
Ludwigfr | 0:9f7ee7ed13e4 | 16 | |
Ludwigfr | 0:9f7ee7ed13e4 | 17 | //the distance are in the world coordinates |
Ludwigfr | 0:9f7ee7ed13e4 | 18 | Sonar(float angleFromCenter, float distanceXFromRobotCenter, float distanceYFromRobotCenter ); |
Ludwigfr | 0:9f7ee7ed13e4 | 19 | |
Ludwigfr | 0:9f7ee7ed13e4 | 20 | float compute_probability_t(float distanceObstacleDetected, float xCell, float yCell, float xRobotWorld, float yRobotWorld, float theta); |
Ludwigfr | 0:9f7ee7ed13e4 | 21 | |
Ludwigfr | 0:9f7ee7ed13e4 | 22 | //return distance sonar to cell if in range, -1 if not |
Ludwigfr | 0:9f7ee7ed13e4 | 23 | float isInRange(float xCell, float yCell, float xRobotWorld, float yRobotWorld, float thetaWorld); |
Ludwigfr | 0:9f7ee7ed13e4 | 24 | |
Ludwigfr | 0:9f7ee7ed13e4 | 25 | private: |
Ludwigfr | 0:9f7ee7ed13e4 | 26 | |
Ludwigfr | 0:9f7ee7ed13e4 | 27 | //returns the angle between the vectors (x,y) and (xs,ys) |
Ludwigfr | 0:9f7ee7ed13e4 | 28 | float compute_angle_between_vectors(float x, float y,float xs,float ys); |
Ludwigfr | 0:9f7ee7ed13e4 | 29 | |
Ludwigfr | 0:9f7ee7ed13e4 | 30 | //makes the angle inAngle between 0 and 2pi |
Ludwigfr | 0:9f7ee7ed13e4 | 31 | float rad_angle_check(float inAngle); |
Ludwigfr | 0:9f7ee7ed13e4 | 32 | |
Ludwigfr | 0:9f7ee7ed13e4 | 33 | }; |
Ludwigfr | 0:9f7ee7ed13e4 | 34 | |
Ludwigfr | 0:9f7ee7ed13e4 | 35 | #endif |
Ludwigfr | 0:9f7ee7ed13e4 | 36 |