Arduino Forum

Topics => Robotics => Topic started by: yangkai on Mar 18, 2016, 11:48 am

Title: How to calibrate the wheel encoder's error by accumulation?
Post by: yangkai on Mar 18, 2016, 11:48 am
Hi, I want my arduino two-wheel car to run a certain distance & turn 90 degrees accurately.

But it is inaccurate after few rotations ,it would rotates overhead.

I have two attachInterrupt:
attachInterrupt(0,rotation_count,CHANGE);
attachInterrupt(1,rotation_count2,CHANGE);

function rotation_count&2  is just a count++(count is a global variable which sets 0)


void moveForward(void)
{
  while(count<=48)
  advance();//no delay
 
  count=0;
  stopRL();
  delay(5);
 
}

I have a stupid solution : After few moveForward()'s , while(count<=x) for x<48 , maybe 45 to reduce
the error value.

 https://www.youtube.com/watch?v=hGNxXqQgHYY  their car are so fast and turn 90 so smooth without
any error.
https://www.youtube.com/watch?v=xqyLlLhU6lo  also turns great 90.

How did they do it so well?
Title: Re: How to calibrate the wheel encoder's error by accumulation?
Post by: Chagrin on Mar 19, 2016, 06:00 pm
If you watch the first video the announcer states that gyros are being used (https://www.youtube.com/watch?feature=player_detailpage&v=hGNxXqQgHYY#t=205) to help with making perfect 90 degree turns. In addition to that they all have proximity sensors so they can gauge their distance from the walls.
Title: Re: How to calibrate the wheel encoder's error by accumulation?
Post by: yangkai on Mar 21, 2016, 02:13 am
But I thought a gyro sensor also has drifted or offset ,it makes the data become unstable,right?
Title: Re: How to calibrate the wheel encoder's error by accumulation?
Post by: Chagrin on Mar 21, 2016, 08:18 am
The gyro is only used to make the 90 degree turn - less than a second's worth of time so drift is not important. Once the car starts travelling down the path they can make adjustments to get the alignment right based on the proximity sensors' readings for distance to the walls.
Title: Re: How to calibrate the wheel encoder's error by accumulation?
Post by: yangkai on Mar 21, 2016, 08:36 am
Ok, that makes sense. And what do you think my solution,is it a common way or not?