with class

Dependencies:   ISR_Mini-explorer mbed

Fork of VirtualForces by Georgios Tsamis

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Sonar.hpp Source File

Sonar.hpp

00001 #ifndef SONAR_HPP
00002 #define SONAR_HPP
00003 
00004 #include<math.h>
00005 
00006 class Sonar {
00007 
00008     public:
00009     float maxRange;//cm
00010     float minRange;//Rmin cm
00011     float incertitudeRange;//cm
00012     float angleRange;//Omega rad
00013     float angleFromCenter;
00014     float distanceX;
00015     float distanceY;
00016     
00017     //the distance are in the world coordinates
00018     Sonar(float angleFromCenter, float distanceXFromRobotCenter, float distanceYFromRobotCenter );
00019 
00020     float compute_probability_t(float distanceObstacleDetected, float xCell, float yCell, float xRobotWorld, float yRobotWorld, float theta);
00021     
00022     //return distance sonar to cell if in range, -1 if not
00023     float isInRange(float xCell, float yCell, float xRobotWorld, float yRobotWorld, float thetaWorld);
00024     
00025     private:
00026     
00027     //returns the angle between the vectors (x,y) and (xs,ys)
00028     float compute_angle_between_vectors(float x, float y,float xs,float ys);
00029 
00030     //makes the angle inAngle between 0 and 2pi
00031     float rad_angle_check(float inAngle);
00032 
00033 };
00034 
00035 #endif
00036