with class

Dependencies:   ISR_Mini-explorer mbed

Fork of VirtualForces by Georgios Tsamis

Fri Jun 16 10:40:53 2017 +0000
last version with the 4th lab;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ludwigfr33:814bcd7d3cfe 1#ifndef SONAR_HPP
Ludwigfr33:814bcd7d3cfe 2#define SONAR_HPP
Ludwigfr33:814bcd7d3cfe 3
Ludwigfr34:c208497dd079 4#include<math.h>
Ludwigfr33:814bcd7d3cfe 5
Ludwigfr33:814bcd7d3cfe 6class Sonar {
Ludwigfr33:814bcd7d3cfe 7
Ludwigfr36:b59d56d0b3b4 8 public:
Ludwigfr33:814bcd7d3cfe 9 float maxRange;//cm
Ludwigfr33:814bcd7d3cfe 10 float minRange;//Rmin cm
Ludwigfr33:814bcd7d3cfe 11 float incertitudeRange;//cm
Ludwigfr33:814bcd7d3cfe 12 float angleRange;//Omega rad
Ludwigfr38:5ed7c79fb724 13 float angleFromCenter;
Ludwigfr33:814bcd7d3cfe 14 float distanceX;
Ludwigfr33:814bcd7d3cfe 15 float distanceY;
Ludwigfr33:814bcd7d3cfe 16
Ludwigfr35:68f9edbb3cff 17 //the distance are in the world coordinates
Ludwigfr38:5ed7c79fb724 18 Sonar(float angleFromCenter, float distanceXFromRobotCenter, float distanceYFromRobotCenter );
Ludwigfr33:814bcd7d3cfe 19
Ludwigfr34:c208497dd079 20 float compute_probability_t(float distanceObstacleDetected, float xCell, float yCell, float xRobotWorld, float yRobotWorld, float theta);
Ludwigfr36:b59d56d0b3b4 21
Ludwigfr38:5ed7c79fb724 22 //return distance sonar to cell if in range, -1 if not
Ludwigfr38:5ed7c79fb724 23 float isInRange(float xCell, float yCell, float xRobotWorld, float yRobotWorld, float thetaWorld);
Ludwigfr38:5ed7c79fb724 24
Ludwigfr36:b59d56d0b3b4 25 private:
Ludwigfr36:b59d56d0b3b4 26
Ludwigfr33:814bcd7d3cfe 27 //returns the angle between the vectors (x,y) and (xs,ys)
Ludwigfr33:814bcd7d3cfe 28 float compute_angle_between_vectors(float x, float y,float xs,float ys);
Ludwigfr33:814bcd7d3cfe 29
Ludwigfr33:814bcd7d3cfe 30 //makes the angle inAngle between 0 and 2pi
Ludwigfr33:814bcd7d3cfe 31 float rad_angle_check(float inAngle);
Ludwigfr33:814bcd7d3cfe 32
Ludwigfr33:814bcd7d3cfe 33};
Ludwigfr33:814bcd7d3cfe 34
Ludwigfr33:814bcd7d3cfe 35#endif
Ludwigfr33:814bcd7d3cfe 36