Wheels

From IridiaWiki
Revision as of 11:23, 19 October 2011 by Manubrambi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Note that when you set the wheel speed the robot stops for a second.

Try this:

while(1){
   e_set_speed_left(500);
   e_set_speed_left(500);
}

The robot won't move, because it's too busy setting the wheels speed.

What I do is to put this function at the top of my code and use this instead. This ensures that the wheels are set only when necessary.

void SetSpeed(int left_speed, int right_speed){
  if (left_speed != current_left_speed){
     e_set_speed_left(left_speed);
     current_left_speed = left_speed;
  }
  if (right_speed != current_right_speed){
     e_set_speed_right(right_speed);
     current_right_speed = right_speed;
  }
}

There might be a better way to do this, but this worked out for me.

Lots of data and details are available here: [1]