Permalink
Browse files

Fixed get_motor_done when PID control loop had not yet been called af…

…ter a pid command
  • Loading branch information...
1 parent e7ae04e commit 097bdc45d34107d7ca95b24adfb604c43839a070 @bmcdorman bmcdorman committed Mar 2, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/motors_c.cpp
View
@@ -96,13 +96,14 @@ int freeze(int motor)
int get_motor_done(int motor)
{
if(motor < 0 || motor > 3) return -1;
+ // This sleep is necessary to make sure the PID control loop has run
+ msleep(50);
return Private::Motor::instance()->isPidActive(motor) ? 0 : 1;
}
void block_motor_done(int motor)
{
- msleep(50);
- while(!get_motor_done(motor)) msleep(40);
+ while(!get_motor_done(motor));
}
void bmd(int motor)

0 comments on commit 097bdc4

Please sign in to comment.