View Single Post
  #1   Spotlight this post!  
Unread 19-03-2005, 20:01
Validius's Avatar
Validius Validius is offline
There is a shadow following me.....
AKA: Mark Ratering
FRC #1549 (Washtenuts)
Team Role: College Student
 
Join Date: Feb 2005
Rookie Year: 2005
Location: South Lyon
Posts: 159
Validius will become famous soon enoughValidius will become famous soon enough
Send a message via AIM to Validius
A VERY nice perl script for generating lookup tables.

well everybody, i have spent the last two days working painstakingly on this Perl script that generates a lookup table for C. Right now it generates the joystick position then a tab then the corresponding PWM value. It is easy to switch the output format to generate a series of array definitions for a C .h file. I am not completely familiar with the max and min values that can be sent to the PWM (255 or 254? and 0 or 1?) so the program protect against anything lower then 126 away from the center of the graph on either side.

The program defaults to having 127 be zero but all that needs to be done to change that is to set the x offset variable. The left side and right side curves can be independently controlled as well as up and down (in their position, not the function used to generate them).

The script can graph 2 functions. There is a variable ($yOuterOffset) that controls how far from the center the first function ends and the second begins. The center of the graph is determined by ($xOffset,$yOffset).

I included a .xls file of some sample data generated by the script. The other lines represent 10 and -10 (the minimum for the victors) and a line with the slope 1 to give perspective.

This is my first contribution to Open Source and i would appreciate all comments/suggestions.

I move that .pl be legit attachment extentions

I apologies for my bad spelling and such. QBasic was my first language and i am just now learning English.
Attached Files
File Type: txt tablescript.txt (4.5 KB, 155 views)
File Type: xls tabletest.xls (30.0 KB, 80 views)
__________________
When a sociaty comes to believe that human life is not inherently worth living, it is a slippery slope to the gas chamber. You wind up on a low road that twists past Columbine and leads toward Auschwitz.

-Peggy Noonan

Last edited by Validius : 19-03-2005 at 22:30.