Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
Diff: Eurobot_shared/ai/ai.cpp
- Revision:
- 9:377560539b74
- Child:
- 13:57ea4e520dbd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Eurobot_shared/ai/ai.cpp Sat Apr 28 17:21:24 2012 +0000 @@ -0,0 +1,32 @@ + +#include "ai.h" +#include "rtos.h" +#include "globals.h" + +AI::AI() : + thr_AI(aithreadwrapper,this,osPriorityNormal,1024) { + flag_terminate = false; + //printf("aistart\r\n"); +} + +void AI::settarget(float targetX, float targetY, float targetTheta, bool targetfacing) { + targetlock.lock(); + target.x = targetX; + target.y = targetY; + target.theta = targetTheta; + target.facing = targetfacing; + targetlock.unlock(); +} + +void AI::settarget(Target targetin) { + targetlock.lock(); + target = targetin; + targetlock.unlock(); +} + +AI::Target AI::gettarget() { + targetlock.lock(); + Target temptarget = target; + targetlock.unlock(); + return temptarget; +} \ No newline at end of file