I have a 2 wheel device that both has motor encoders, counting the units moved on both motors is simple if the both motors speed is the same. My problem arises when the device is turning to the left or to the right. Turning causes one motor to speed up and the other to slow down. The count now on each motor is different.

Is there some logic or arithmetic i can apply that takes into accounts turnings? and can calculate the true distance moved of the device. The point of refence now of measuring the distance is now not on the wheel since it is not very reliable but now on the center of both wheels.

What I came up with is just to AVERAGE the left and right motor counts, but i do not know if this is the best solution to approach this problem

Any thoughts?

enter image description here

  • \$\begingroup\$ Seems reasonable. Why are your counts not whole integers, anyways? \$\endgroup\$
    – DKNguyen
    Commented Dec 24, 2019 at 5:49
  • \$\begingroup\$ Average is the only solution with this. Orientation 7.86/90 deg except for slippage \$\endgroup\$ Commented Dec 24, 2019 at 5:59
  • 2
    \$\begingroup\$ Average is a very poor solution to your problem. You have to do the math to do dead reckoning. Suggest you start with a simple approach using quadrature encoders ...this is a good starting point: seattlerobotics.org/encoder/200010/dead_reckoning_article.html \$\endgroup\$ Commented Dec 24, 2019 at 6:09
  • 1
    \$\begingroup\$ i do suggest reading the first reference in that article rossum.sourceforge.net/papers/DiffSteer/DiffSteer.html \$\endgroup\$ Commented Dec 24, 2019 at 6:32
  • 1
    \$\begingroup\$ Just use diffeq to grab up a state space representation for the model/simulation (which you need) and then use a Kalman filter/error covariances observer of the motion. Done. It will just work. Period. There's nothing much good coming from simple averages. But feel free, of course. \$\endgroup\$
    – jonk
    Commented Dec 24, 2019 at 7:17

1 Answer 1


im not sure of my answer:

arc length = $$2\pi r\theta$$

enter image description here

distance between wheels = h

arc1 units = $$2\pi r\theta$$ arc2 units = $$2\pi (r+h)\theta$$

arc_center = $$2\pi (r+(h/2))\theta$$


$$(arc1 + arc2) / 2 = (\pi\theta)(r+(r+h))$$ $$(arc1 + arc2) / 2 = (\pi\theta)(2r+h))$$ $$(arc1 + arc2) / 2 = (\pi\theta)(2(r+h/2)))$$ $$(arc1 + arc2) / 2 = 2(\pi\theta)((r+h/2)))$$

you can see your method is actually = center arc length

  • \$\begingroup\$ centre is average of both wheels since they are always parallel \$\endgroup\$ Commented Dec 24, 2019 at 7:22
  • \$\begingroup\$ @TonyStewartSunnyskyguyEE75 yes, this post is deriving that the center arc = average(arc1,arc2) \$\endgroup\$ Commented Dec 24, 2019 at 10:55
  • \$\begingroup\$ There is no other sensor input to determine slippage from lack of parallel wheels or center or difference in centre of radius. Thus no other way to count. Of course one can average for velocity, acceleration etc. or do any complex math you want over any time interval but for position, there is no need. In fact for all servo systems you want 1st order feedback when possible. \$\endgroup\$ Commented Dec 24, 2019 at 13:54
  • \$\begingroup\$ Robotic simulator software sourceforge.net/projects/rossum i.sstatic.net/bkanM.png \$\endgroup\$ Commented Dec 24, 2019 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.