Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Timer by
Revision 75:195dd2bb13a3, committed 2016-05-05
- Comitter:
- IceTeam
- Date:
- Thu May 05 04:36:59 2016 +0000
- Parent:
- 74:07cdad6e861a
- Child:
- 76:a862cb10559c
- Commit message:
- Test 1;
Changed in this revision
--- a/Functions/defines.h Thu May 05 05:49:41 2016 +0200 +++ b/Functions/defines.h Thu May 05 04:36:59 2016 +0000 @@ -8,7 +8,7 @@ #include "../RoboClaw/RoboClaw.h" #include "../Odometry/Odometry.h" #include "../StepperMotor/Stepper.h" -#include "Map/map.h" +//#include "Map/map.h" #include "AX12.h" #define SEUIL 0.25 @@ -23,6 +23,7 @@ #define BAS 0 #define DELAY 0.007 +extern bool front_Sharp_activated; extern Serial logger; extern RoboClaw roboclaw; extern DigitalOut bleu;
--- a/Map/Objectif/objectif.cpp Thu May 05 05:49:41 2016 +0200
+++ b/Map/Objectif/objectif.cpp Thu May 05 04:36:59 2016 +0000
@@ -15,14 +15,14 @@
bool objectif::Action () {
switch(type) {
- case OBJ_BLOC:
+ case OBJ_BLOC_PRISE:
return obj_bloc_action();
- break;
+ case OBJ_BLOC_LACHE:
+ return obj_para_lache_action();
case OBJ_PARA:
return obj_para_action();
- break;
default:
- break;
+ return true;
}
if (marche_arriere != 0) {
@@ -31,11 +31,16 @@
}
bool objectif::obj_bloc_action () {
- /* Range : 0 -> 100 (mm). pince.home remet à 0 */
- pince->home();
- pince->setPos(30,0,0);
+ front_Sharp_activated = false;
+ return true;
}
bool objectif::obj_para_action() {
return true;
+}
+
+bool objectif::obj_para_lache_action() {
+ Codo->GotoDist(-80);
+ front_Sharp_activated = true;
+ return true;
}
\ No newline at end of file
--- a/Map/Objectif/objectif.h Thu May 05 05:49:41 2016 +0200
+++ b/Map/Objectif/objectif.h Thu May 05 04:36:59 2016 +0000
@@ -8,6 +8,7 @@
#include "../../AX12/AX12.h"
#include "../../Odometry/Odometry.h"
#include "../../ControlleurPince/ControlleurPince.h"
+#include "../../Functions/defines.h"
class objectif {
public:
@@ -20,6 +21,7 @@
private:
bool obj_bloc_action();
bool obj_para_action();
+ bool obj_para_lache_action();
int type;
float x_objectif, y_objectif, thet_objectif;
--- a/Map/Objectif/objectif_type.h Thu May 05 05:49:41 2016 +0200 +++ b/Map/Objectif/objectif_type.h Thu May 05 04:36:59 2016 +0000 @@ -1,7 +1,9 @@ #ifndef OBJECTIF_TYPE_H #define OBJECTIF_TYPE_H -#define OBJ_BLOC 1 +#define OBJ_BLOC_PRISE 1 #define OBJ_PARA 2 +#define OBJ_BLOC_LACHE 3 +#define RIEN 0 #endif \ No newline at end of file
--- a/Map/map.cpp Thu May 05 05:49:41 2016 +0200
+++ b/Map/map.cpp Thu May 05 04:36:59 2016 +0000
@@ -6,12 +6,14 @@
if (objectifs.empty()) {
logger.printf("map::Build_Objectives Creation des Objectifs ...\n\r");
if (couleur == VERT) {
- addObj (objectif (OBJ_BLOC, 120, 1000, 0, Codo, Parasol, pince));
- addObj (objectif (OBJ_BLOC, 120, 1000, 0, Codo, Parasol, pince, 50));
+ addObj (objectif (OBJ_BLOC_PRISE, 120, 1000, 0, Codo, Parasol, pince));
+ addObj (objectif (OBJ_BLOC_LACHE, 120, 1000, 0, Codo, Parasol, pince, 50));
}
else {
- addObj (objectif (OBJ_BLOC, 3000-120, 1000, 0, Codo, Parasol, pince));
- addObj (objectif (OBJ_BLOC, 3000-120, 1000, 0, Codo, Parasol, pince));
+ addObj (objectif (OBJ_BLOC_PRISE, 3000-350, 850, 0, Codo, Parasol, pince));
+ addObj (objectif (RIEN, 3000-550, 850, 0, Codo, Parasol, pince));
+ addObj (objectif (OBJ_BLOC_LACHE, 3000-1050, 1100, 0, Codo, Parasol, pince));
+ addObj (objectif (RIEN, 3000-200, 850, 0, Codo, Parasol, pince));
}
}
}
--- a/Map/map.h Thu May 05 05:49:41 2016 +0200
+++ b/Map/map.h Thu May 05 04:36:59 2016 +0000
@@ -3,7 +3,7 @@
/* Dernier Changement : Romain 0h20
Inclu dans : main.cpp
-Il faut encore gerer les formations de coquillage */
+La marche arriere est un reliquat a supprimer */
#include "obsCarr.h"
#include "pointParcours.h"
@@ -17,7 +17,7 @@
#define X_START_VERT 110
#define X_START_VIOLET 2890
-#define Y_START 1000
+#define Y_START 850
class map {
public:
--- a/main.cpp Thu May 05 05:49:41 2016 +0200
+++ b/main.cpp Thu May 05 04:36:59 2016 +0000
@@ -1,5 +1,5 @@
#include "func.h"
-#include "map.h"
+#include "Map/map.h"
#include "ControlleurPince.h"
@@ -24,8 +24,8 @@
DigitalOut blanc(PC_6);
DigitalOut rouge(PC_8);
-//AX12 left_hand(PA_9, PA_10, 4, 250000);
-//AX12 right_hand(PA_9, PA_10, 1, 250000);
+AX12 left_hand(PA_9, PA_10, 3, 250000);
+AX12 right_hand(PA_9, PA_10, 2, 250000);
/* Sharp */
AnalogIn capt1(PA_4);
@@ -45,7 +45,7 @@
DigitalIn EnZ(PB_14);
DigitalIn EnL(PB_13);
-ControlleurPince controlleurPince(RMot, ZMot, LMot, EnR, EnZ, EnL);
+ControlleurPince controlleurPince(RMot, ZMot, LMot, EnR, EnZ, EnL,left_hand,right_hand);
Ticker ticker;
//Serial logger(USBTX, USBRX);
@@ -55,6 +55,7 @@
int SIMON_i = 0, SIMON_state = 0, SCouleur = VERT, SStart = 0, SSchema = 1;
bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false, SGauche = false, SDevant = false, SDroite = false;
+bool front_Sharp_activated = true;
void init(void);
void update_main(void);
@@ -63,7 +64,7 @@
int main(void)
{
init();
- map m(&odo, NULL, &controlleurPince, VERT, 1);
+ map m(&odo, NULL, &controlleurPince, VIOLET, 1);
m.Execute(0);
m.Execute();
/*drapeau = 0;
@@ -97,6 +98,9 @@
logger.baud(9600);
logger.printf("Hello from main !\n\r");
+ wait(0.5);
+ controlleurPince.init();
+ wait(0.5);
controlleurPince.home();
//depart();
@@ -112,5 +116,6 @@
void update_main(void)
{
odo.update_odo();
- checkAround();
+ if (front_Sharp_activated)
+ checkAround();
}
\ No newline at end of file
