Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Sat Apr 28 17:21:24 2012 +0000
Revision:
9:377560539b74
Child:
13:57ea4e520dbd
Restructured project to have a single shared lib; Also raised the RF baud rate

Who changed what in which revision?

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