View Single Post
  #5   Spotlight this post!  
Unread 17-11-2011, 00:09
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Quote:
Originally Posted by Tom Line View Post
(where's Ether when you need him - this is right up his alley)....
How can I resist? :-)

There are two ways you might want to consider.

Assume you have a set of X,Y points, where Y is the actual Victor output (-12 to 12 volts) for a given X command (-1 to +1). You don't need a whole lot of points, just enough so that a series of line segments connecting the points is a good approximation of the Vic's behavior.

Divide all the Y values by 12* so that Y is normalized to the range -1 to +1, then proceed as follows:


Method I

Enter the Y values into column A of Excel, and the X values into column B, then plot X versus Y (yes, X versus Y, not Y versus X - you want the inverse function).

Then use Excel's "trendline" function to fit a polynomial, X = f(Y). See attachment.

That polynomial will tell you what X value command you should use to get any desired Y output.

For example, say you want 68% output. Just put the value ".68" into the polynomial and it will tell you what your "X" command should be to get 68% output. In other words, instead of commanding .68 you would command f(.68).


Method II

Use a lookup table. Put the Y,X data into a table. If you want 68% output, search the Y column for the two values bracketing .68. In the example above, that would be .62 and .72. Take the X value corresponding to the .62 Y value (that would be .5) and the X value corresponding to the .72 Y value (that would be .6) and find the required X command as follows:

X = .5 + ((.68-.62)/(.72-.62))*(.6-.5)


*or whatever the largest abs Y voltage is


Attached Thumbnails
Click image for larger version

Name:	Method I.png
Views:	99
Size:	14.3 KB
ID:	11084  

Last edited by Ether : 17-11-2011 at 01:09. Reason: added graphic
Reply With Quote