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.
Dependencies: mbed
Diff: ai.cpp
- Revision:
- 5:794d7d690dc9
- Parent:
- 4:ae47210fa346
- Child:
- 6:f4250d71f974
diff -r ae47210fa346 -r 794d7d690dc9 ai.cpp
--- a/ai.cpp Tue May 24 07:32:18 2016 +0000
+++ b/ai.cpp Tue May 24 07:58:29 2016 +0000
@@ -19,6 +19,8 @@
float wideB // wide of the court
+int mobile_state;
+
***** Code Begin **********
int yB1 yB2 xB3 xB4; // broder conditions
@@ -45,11 +47,48 @@
-********************************************************************************
+****************** main structure ***********************************
+
+
+switch(mobile_state)
+{
+ case 0:
+ // IDLE check if stop color appear
+ //check purple color appear or not
+
+ setSpecs();
+ break;
+ case 1:
+ // set everything icludes the car's and ball's position
+ // go to case 2 after get all the information
+ break;
+ case 2:
+ // check if car fit border conditions
+ funcBorder();
+ to case3
+ break;
+ case 3://move to get ball
+ getBall();
+ break;
+ case 4: /// move to the gate and release ball
+ // move to the point in front of the gate first
+ // then head to the gate
+ break;
+ case 5:
+ break;
+
+}
+
+
+
+
+
**************** funcBorder() *****************************************
funcBorder() // check if car is too close to the border
+
+ // miss the ball restriction part
if(yC > yB1 || yC < yB2 || xC < xB3 || xC > xB4){