This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
Diff: Processes/Motion/motion.cpp
- Revision:
- 69:4b7bb92916da
- Parent:
- 67:be3ea5450cc7
- Child:
- 70:0da6ca845762
--- a/Processes/Motion/motion.cpp Sun Apr 14 18:47:17 2013 +0000 +++ b/Processes/Motion/motion.cpp Sun Apr 14 20:23:07 2013 +0000 @@ -1,8 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// // Motion control unit //////////////////////////////////////////////////////////////////////////////// -// Takes current state of the robot and target waypoint, -// calculates desired forward and angular velocities and requests those from the motor control layer. +// Takes current state and motion command (set via accessors) and actuates it via motor layer calls //////////////////////////////////////////////////////////////////////////////// #include "motion.h" @@ -154,12 +153,16 @@ //printf("fwd: %f, omega: %f\r\n", forward_v, angular_v); - if(collavoiden){ + //TODO: remove oskar's avoidance hack + if(collavoiden) + { float d = ADS.Distanceincm(); - if(d > 10){ + if(d > 10) + { forward_v *= max(min((d-15)*(1.0f/20.0f),1.0f),-0.1f); } } + // end of Oskar hack // pass values to the motor control MotorControl::set_fwdcmd(forward_v);