DifferentialPilot math formulas


Moderators: 99jonathan, roger, imaqine

DifferentialPilot math formulas

Postby Orfeus » Sun Apr 29, 2012 9:36 pm

I just bought a book "Inteligence unleashed" and there is a note about "some serious math" in "Just for fun!" section on page 97. I'm actualy curious about used math formulas used in DifferentialPilot class, but it's quite complicated to get it from source code, because, there is refering to variables which are refered to another variables or constants etc. in every method. Does anyone have these math formulas used in this class in "math form"?

I'm writting a work about LeJOS and I need to mention these formulas in there.

Thx for answer.
New User
Posts: 4
Joined: Sat Feb 25, 2012 4:58 pm

Re: DifferentialPilot math formulas

Postby roger » Mon Apr 30, 2012 2:35 am

Hi Orfeus,
I don't think the math is all that serious - it is based on the geometry of the arc of a circle. First, think of a rolling wheel. d = wheel diameter, a = angle of rotation of the wheel ( in radians) so the distance it moves over the ground X = a * d/2.
When the robot moves along the arc of a circle of constant radius and angle A, so does each wheel but the circles have different radii. The difference between the two is the track width W. Let Ro be the radius of the arc traveled by the outer wheel, and Ri , the inner wheel, So
Ri = Ro - W.
Therefore the two wheels travel a different distance over the ground: Xo = A*Ro and Xi = A * Ri .
From these relationships, you can calculate ratio of inside to outside motor speed and the angle of rotation of each motor as the robot traverses the arc.
There are two special cases: Straight line movement -> arc radius is infinite and speed ratio = 1; and rotation in place -> the speed ration is -1, so the robot arc radius = 0 and Ri = -Ro.
The same basic equations can be used to calculate the change in robot position at the end of a move from the tacho counts of the two motors.
The code has many public methods, but only a few private helper methods that contain the commonly used basic calculations.
I hope clears up some of the confusion.
Posts: 358
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: DifferentialPilot math formulas

Postby Orfeus » Mon Apr 30, 2012 8:26 am

Thx a lot, it's very helpful.
New User
Posts: 4
Joined: Sat Feb 25, 2012 4:58 pm

Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff