FRC_equipe1 / Mbed 2 deprecated FRC_2019

Dependencies:   mbed

Committer:
theolp
Date:
Tue Jun 04 17:25:49 2019 +0000
Revision:
17:aae5361ddddf
Parent:
16:05665faaa489
Child:
27:e103da412e2b
Odometrie position, dbug position, angles compris entre -180 et 180, fonction updateCAN. Bonne version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wael_H 10:efa507ba2b35 1 #include "Deplacement.h"
Wael_H 10:efa507ba2b35 2 #include "CAN_asser.h"
Wael_H 10:efa507ba2b35 3
Wael_H 10:efa507ba2b35 4 Deplacement::Deplacement()
Wael_H 10:efa507ba2b35 5 {
Wael_H 10:efa507ba2b35 6 this->peutBouger = true;
Wael_H 10:efa507ba2b35 7 }
Wael_H 10:efa507ba2b35 8
Wael_H 16:05665faaa489 9 bool Deplacement::getFlag()
Wael_H 16:05665faaa489 10 {
Wael_H 16:05665faaa489 11 return this->peutBouger;
Wael_H 16:05665faaa489 12 }
Wael_H 16:05665faaa489 13
theolp 17:aae5361ddddf 14 short Deplacement::getPos(int i)
theolp 17:aae5361ddddf 15 {
theolp 17:aae5361ddddf 16 return this->pos[i];
theolp 17:aae5361ddddf 17 }
theolp 17:aae5361ddddf 18
Wael_H 15:3d4543a6c100 19 bool Deplacement::avance(signed short dist)
Wael_H 10:efa507ba2b35 20 {
Wael_H 10:efa507ba2b35 21 if(this->peutBouger)
Wael_H 10:efa507ba2b35 22 {
Wael_H 10:efa507ba2b35 23 GoStraight(dist,0,0,0);
Wael_H 10:efa507ba2b35 24 this->peutBouger = false;
Wael_H 10:efa507ba2b35 25 }
Wael_H 10:efa507ba2b35 26 else
theolp 17:aae5361ddddf 27 updateCAN(this->peutBouger, this->pos);
Wael_H 10:efa507ba2b35 28
Wael_H 10:efa507ba2b35 29 return this->peutBouger;
Wael_H 10:efa507ba2b35 30 }
Wael_H 10:efa507ba2b35 31
Wael_H 15:3d4543a6c100 32 bool Deplacement::tourne(signed short angle)
Wael_H 10:efa507ba2b35 33 {
Wael_H 10:efa507ba2b35 34 if(this->peutBouger)
Wael_H 10:efa507ba2b35 35 {
Wael_H 10:efa507ba2b35 36 Rotate(angle);
Wael_H 10:efa507ba2b35 37 this->peutBouger = false;
Wael_H 10:efa507ba2b35 38 }
Wael_H 10:efa507ba2b35 39 else
theolp 17:aae5361ddddf 40 updateCAN(this->peutBouger, this->pos);
Wael_H 10:efa507ba2b35 41
Wael_H 10:efa507ba2b35 42 return this->peutBouger;
Wael_H 10:efa507ba2b35 43 }
Wael_H 10:efa507ba2b35 44
Wael_H 15:3d4543a6c100 45 bool Deplacement::GoToXYT(unsigned short x, unsigned short y, unsigned short t, signed char sens) //sens = 0 par défaut
Wael_H 10:efa507ba2b35 46 {
Wael_H 10:efa507ba2b35 47 if(this->peutBouger)
Wael_H 10:efa507ba2b35 48 {
Wael_H 10:efa507ba2b35 49 GoToPosition(x,y,t,sens);
Wael_H 10:efa507ba2b35 50 this->peutBouger = false;
Wael_H 10:efa507ba2b35 51 }
Wael_H 10:efa507ba2b35 52 else
theolp 17:aae5361ddddf 53 updateCAN(this->peutBouger, this->pos);
Wael_H 10:efa507ba2b35 54
Wael_H 10:efa507ba2b35 55 return this->peutBouger;
Wael_H 13:9c62e263f245 56 }
Wael_H 13:9c62e263f245 57
Wael_H 13:9c62e263f245 58 void Deplacement::stop()
Wael_H 13:9c62e263f245 59 {
Wael_H 13:9c62e263f245 60 SendRawId(ASSERVISSEMENT_STOP);
Wael_H 15:3d4543a6c100 61
theolp 17:aae5361ddddf 62 do updateCAN(this->peutBouger, this->pos);
Wael_H 15:3d4543a6c100 63 while(!this->peutBouger);
Wael_H 10:efa507ba2b35 64 }