|
[DPRG] DPRG Spring 2008 Outdoor Robot Challenge: 10 May 08
Subject: [DPRG] DPRG Spring 2008 Outdoor Robot Challenge: 10 May 08
From: DeltaGraph at aol.com
DeltaGraph at aol.com
Date: Sun Mar 9 15:16:23 CDT 2008
Dean and Jon,
this is a little delayed
Re: Odometry Heading Calculation
thanks for replies regarding use of atan2.
Yes, I have implemented same code (ages ago 1980) and now recently using
atan2 when using C. Problem I have with trig is probably due to the way my brain
is /is not organized.
Even with atan2 I found myself making mistakes...
Anyway, the code that David A. illustrated eliminates some of the potential
traps.
I see now looking at the arctangent function -- it is super linear for
small angular values.
My original code as you can see is much more complex. Looking at it now not
sure what my thinking was.
I would think using the difference in motor encoder counts would be the way
to go in calculating delta
heading.
// Pascal Code
// dL = change in LEFT motor encoder count between previous and current
motor controller update
// dR = change in RIGHT ....
Lt := 1.0 * dL / Robot.CountsPerInch; // travel in inches for this
increment
Rt := 1.0 * dR / Robot.CountsPerInch;
// choose largest delta
// for heading change calc what was I thinking???
if abs(Lt)>abs(Rt) then Dy := Lt
else Dy := - Rt;
// Left wheel travel + causes robot to turn right Heading+
// Right wheel travel + causes robot to turn left Heading-
dh := ArcTan(Lt/(Robot.WheelSepInches)) -
ArcTan(Rt/(Robot.WheelSepInches));
Ron
**************It's Tax Time! Get tips, forms, and advice on AOL Money &
Finance. (http://money.aol.com/tax?NCID=aolprf00030000000001)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.dprg.org/pipermail/dprglist/attachments/20080309/893eeb93/attachment.html
More information about the DPRG mailing list
|