Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Sun Apr 29 00:09:35 2012 +0000
Revision:
17:bafcef1c3579
uptodate kalman lib; edit this one only!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
narshu 17:bafcef1c3579 1
narshu 17:bafcef1c3579 2 #include "ai.h"
narshu 17:bafcef1c3579 3 #include "rtos.h"
narshu 17:bafcef1c3579 4 #include "globals.h"
narshu 17:bafcef1c3579 5
narshu 17:bafcef1c3579 6 AI::AI() :
narshu 17:bafcef1c3579 7 thr_AI(aithreadwrapper,this,osPriorityNormal,1024) {
narshu 17:bafcef1c3579 8 flag_terminate = false;
narshu 17:bafcef1c3579 9 //printf("aistart\r\n");
narshu 17:bafcef1c3579 10 }
narshu 17:bafcef1c3579 11
narshu 17:bafcef1c3579 12 void AI::settarget(float targetX, float targetY, float targetTheta, bool targetfacing) {
narshu 17:bafcef1c3579 13 targetlock.lock();
narshu 17:bafcef1c3579 14 target.x = targetX;
narshu 17:bafcef1c3579 15 target.y = targetY;
narshu 17:bafcef1c3579 16 target.theta = targetTheta;
narshu 17:bafcef1c3579 17 target.facing = targetfacing;
narshu 17:bafcef1c3579 18 target.reached = false;
narshu 17:bafcef1c3579 19 targetlock.unlock();
narshu 17:bafcef1c3579 20 }
narshu 17:bafcef1c3579 21
narshu 17:bafcef1c3579 22 void AI::settarget(Target targetin) {
narshu 17:bafcef1c3579 23 targetlock.lock();
narshu 17:bafcef1c3579 24 target = targetin;
narshu 17:bafcef1c3579 25 targetlock.unlock();
narshu 17:bafcef1c3579 26 }
narshu 17:bafcef1c3579 27
narshu 17:bafcef1c3579 28 AI::Target AI::gettarget() {
narshu 17:bafcef1c3579 29 targetlock.lock();
narshu 17:bafcef1c3579 30 Target temptarget = target;
narshu 17:bafcef1c3579 31 targetlock.unlock();
narshu 17:bafcef1c3579 32 return temptarget;
narshu 17:bafcef1c3579 33 }