0

I am Using encoder to get the distance traveled and heading angle of vehicle. At turn it does not give precise angle, vehicle is turning with. In my algorithm i am using accumulation of all angle to find the total angle with respect to world(X-O-Y).

Does it have anything to do with Ratio of wheel diameter and wheel to wheel distance?

This question was raised in my mind because same algorithm worked with another hardware which has different dimension(diameter of wheel and wheel to wheel distance)and it did return precise turning angle too.

Will appreciate if some valuable suggestion is offered.

Amit.D
  • 113
  • 1
  • 13
  • 1
    I'm not saying this is offtopic, but I think you might find a better StackExchange site for this question. Such as [Robotics SE](http://robotics.stackexchange.com/help/on-topic). – Petr Oct 29 '15 at 11:25

1 Answers1

1

The angle of a robot is dependent on the specific hardware, such as wheel size, encoder size, and vehicle width. Maybe you were lucky with the the other robot that the change in wheel diameter and wheel to wheel distance canceled each other out so the equations were the same, but normally you will not be so lucky

![enter image description here

Assuming you have a two wheeled robot the same readings on two different setups can yield different results. In my simple illustration I have the axle of a two wheeled robot both bots have the same wheel_diameter and use the same rotary encoders. One bot has distance R1 between the wheels the other has distance R2 suppose both robots keep a wheel stationary and the other wheel moves 5 clicks forward on the wheel encoder (and both bots use the same encoder and same size wheel). Using the simple equation for circumference of a semi-circle we can find the distance the wheels moved.

dist_trav = (pi * wheel_diameter) * (#ticks / total ticks on encoder)

Of course since one wheel is stationary, the bot is actually pivoting on another semicircle. We can calculate the new angle using

circumference = 2*pi*dist_between_wheels dist_between_wheels is the radius of our circle

angle = % of circumference traveled * units = (dist_trav / circumference) * 360 we use 360 so the angle is in degrees, but you could use radians if desired

you will see that even in this example where the robots are identical except for the distance between the wheels the same number of ticks will mean very different angles. If r2=2*r1 we can see that dist_trav is the same for both bots (since the wheels are the same diameter) but when we figure out the angles we get

black bot

angle_black = (dist_traveled / 2*pi*R1) * 360

red bot

angle_black = (dist_traveled / 2*pi*2*R1 ) * 360
            = (dist_traveled / 4*pi  *R1 ) * 360

so for the same movement of the wheels the red bot will only have 1/2 the angle change as the black bot did. This is just a toy example, but you can easily see how different diameters of wheels and distance between them can make a huge difference.

andrew
  • 2,451
  • 1
  • 15
  • 22
  • Thanks for reply! Will you please tell me how these ratio is selected to get precise result for particular hardware. Btw in above answer you have written circumference = 4*pi*dist_between_wheels which i believe should be "2*pi*dist_between_wheels ". Correct me if i am wrong !! – Amit.D Oct 30 '15 at 08:27
  • @Amit.D you are right. Sorry about the confusion, I fixed the post. The equations I wrote work if you put in in proper measurements. But If you have both wheels turn at once this model won't work. To fix your current code look for any constants and make sure they match the ratios on your bot exactly, you can probably use whatever logic you already have and just change the ratios. I couldn't tell you what exactly to change without seeing the code – andrew Nov 02 '15 at 19:21