2014 Eurobot fork
Dependencies: mbed-rtos mbed QEI
Diff: Processes/Motion/motion.cpp
- Revision:
- 81:ef1ce4f5322b
- Parent:
- 77:8d83a0c00e66
- Child:
- 85:b0858346d838
diff -r 3178a1e46146 -r ef1ce4f5322b Processes/Motion/motion.cpp --- a/Processes/Motion/motion.cpp Mon Apr 15 17:07:40 2013 +0000 +++ b/Processes/Motion/motion.cpp Mon Apr 15 19:35:29 2013 +0000 @@ -4,6 +4,8 @@ // Takes current state and motion command (set via accessors) and actuates it via motor layer calls //////////////////////////////////////////////////////////////////////////////// +//todo: check everything is properly initialised and not a race condition + #include "motion.h" #include "math.h" #include "Kalman.h" @@ -97,7 +99,7 @@ float angle_err_saved = angle_err; // actuated angle error can be overriden by the final turning code, but forward speed envelope should be controlled with the atan angle // is the waypoint reached - waypoint_flag_mutex.lock(); //TODO: consider refactoring + waypoint_flag_mutex.lock(); //TODO: consider refactoring, mutexes suck, switch to semaphore style or more contained mutexes (think of several producers as well); race conditions not checked atm either if (abs(distance_err) < ((wp_d_reached) ? target_waypoint.pos_threshold+0.02 : target_waypoint.pos_threshold)) { wp_d_reached = true;