Shuto Naruse
/
Eurobot2012_Secondary
Eurobot2012_Secondary
Fork of Eurobot_2012_Secondary by
Eurobot_shared/ai/ai.h@1:cc2a9eb0bd55, 2012-10-17 (annotated)
- Committer:
- narshu
- Date:
- Wed Oct 17 22:25:31 2012 +0000
- Revision:
- 1:cc2a9eb0bd55
Commit before publishing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
narshu | 1:cc2a9eb0bd55 | 1 | #ifndef AI_H |
narshu | 1:cc2a9eb0bd55 | 2 | #define AI_H |
narshu | 1:cc2a9eb0bd55 | 3 | |
narshu | 1:cc2a9eb0bd55 | 4 | #include "rtos.h" |
narshu | 1:cc2a9eb0bd55 | 5 | //#include "Kalman.h" |
narshu | 1:cc2a9eb0bd55 | 6 | |
narshu | 1:cc2a9eb0bd55 | 7 | class AI { |
narshu | 1:cc2a9eb0bd55 | 8 | public: |
narshu | 1:cc2a9eb0bd55 | 9 | AI(); |
narshu | 1:cc2a9eb0bd55 | 10 | |
narshu | 1:cc2a9eb0bd55 | 11 | Mutex targetlock; |
narshu | 1:cc2a9eb0bd55 | 12 | Thread thr_AI; |
narshu | 1:cc2a9eb0bd55 | 13 | |
narshu | 1:cc2a9eb0bd55 | 14 | struct Target { |
narshu | 1:cc2a9eb0bd55 | 15 | float x; |
narshu | 1:cc2a9eb0bd55 | 16 | float y; |
narshu | 1:cc2a9eb0bd55 | 17 | float theta; |
narshu | 1:cc2a9eb0bd55 | 18 | bool facing; |
narshu | 1:cc2a9eb0bd55 | 19 | bool reached; |
narshu | 1:cc2a9eb0bd55 | 20 | } target; |
narshu | 1:cc2a9eb0bd55 | 21 | |
narshu | 1:cc2a9eb0bd55 | 22 | void settarget(float targetX, float targetY, float targetTheta, bool targetfacing = true, bool colour = true, int maxSpeed = 35); |
narshu | 1:cc2a9eb0bd55 | 23 | void settarget(Target); |
narshu | 1:cc2a9eb0bd55 | 24 | Target gettarget(); |
narshu | 1:cc2a9eb0bd55 | 25 | |
narshu | 1:cc2a9eb0bd55 | 26 | bool flag_terminate;// = false; |
narshu | 1:cc2a9eb0bd55 | 27 | bool flag_motorStop; // = true; |
narshu | 1:cc2a9eb0bd55 | 28 | bool flag_manOverride; // = false; |
narshu | 1:cc2a9eb0bd55 | 29 | |
narshu | 1:cc2a9eb0bd55 | 30 | private: |
narshu | 1:cc2a9eb0bd55 | 31 | |
narshu | 1:cc2a9eb0bd55 | 32 | void ai_thread (); |
narshu | 1:cc2a9eb0bd55 | 33 | static void aithreadwrapper(void const *arg){ ((AI*)arg)->ai_thread(); } |
narshu | 1:cc2a9eb0bd55 | 34 | |
narshu | 1:cc2a9eb0bd55 | 35 | }; |
narshu | 1:cc2a9eb0bd55 | 36 | |
narshu | 1:cc2a9eb0bd55 | 37 | #endif //AI_H |