This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
Processes/AI/ai.cpp
- Committer:
- rsavitski
- Date:
- 2013-04-10
- Revision:
- 37:6ecf0d21e492
- Parent:
- 35:f8e7f0a72a3d
- Child:
- 38:c9058a401410
File content as of revision 37:6ecf0d21e492:
#include "ai.h" namespace AI { Mutex waypoint_flag_mutex; Waypoint* current_waypoint = NULL; //global scope bool waypoint_reached = false; // is current waypoint reached void ailayer(void const *dummy) { //TODO: temp current waypoint hack current_waypoint = new Waypoint; current_waypoint->x = 0.5; current_waypoint->y = 0.7; current_waypoint->theta = 0.0; current_waypoint->pos_threshold = 0.05; current_waypoint->angle_threshold = 0.1*PI; Waypoint* secondwp = new Waypoint; secondwp->x = 2; secondwp->y = 1.2; secondwp->theta = PI; secondwp->pos_threshold = 0.05; secondwp->angle_threshold = 0.1*PI; while(1) { Thread::wait(50); waypoint_flag_mutex.lock(); if (checkWaypointStatus()) { clearWaypointReached(); //delete current_waypoint; current_waypoint = secondwp; } waypoint_flag_mutex.unlock(); } } void setWaypointReached() { waypoint_reached = true; } void clearWaypointReached() { waypoint_reached = false; } bool checkWaypointStatus() { return waypoint_reached; } } //namespace