ARES / Mbed 2 deprecated Robot 2016

Dependencies:   mbed

Committer:
Jagang
Date:
Sun May 24 12:30:47 2015 +0000
Revision:
0:b127c787a51b
Nettoyage du code d'asserv.; L'asserv ne fonctionne plus, juste test, moteurs ? 20% sur 1m

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jagang 0:b127c787a51b 1 #include "Obs_rect.h"
Jagang 0:b127c787a51b 2
Jagang 0:b127c787a51b 3 Obs_rect::Obs_rect(float robotRadius, int id, float x1, float y1, float x2, float y2):Obstacle(robotRadius,id)
Jagang 0:b127c787a51b 4 {
Jagang 0:b127c787a51b 5 this->x1 = (x1<x2) ? x1:x2;
Jagang 0:b127c787a51b 6 this->x2 = (x1<x2) ? x2:x1;
Jagang 0:b127c787a51b 7 this->y1 = (y1<y2) ? y1:y2;
Jagang 0:b127c787a51b 8 this->y2 = (y1<y2) ? y2:y1;
Jagang 0:b127c787a51b 9 }
Jagang 0:b127c787a51b 10
Jagang 0:b127c787a51b 11 int Obs_rect::height(float x, float y)
Jagang 0:b127c787a51b 12 {
Jagang 0:b127c787a51b 13 if(!active)
Jagang 0:b127c787a51b 14 return 0;
Jagang 0:b127c787a51b 15 if(bigShape)
Jagang 0:b127c787a51b 16 {
Jagang 0:b127c787a51b 17 if(x1 - robotRadius < x && x < x2 + robotRadius && y1 - robotRadius < y && y < y2 + robotRadius)
Jagang 0:b127c787a51b 18 return 32000; // Dans le grand rctangle
Jagang 0:b127c787a51b 19 }
Jagang 0:b127c787a51b 20 else
Jagang 0:b127c787a51b 21 {
Jagang 0:b127c787a51b 22 if(x1 < x && x < x2 && y1 < y && y < y2)
Jagang 0:b127c787a51b 23 return 32000; // Dans le petit rectangle
Jagang 0:b127c787a51b 24 }
Jagang 0:b127c787a51b 25 return 0;
Jagang 0:b127c787a51b 26 }