Go to Post I think these new rules are making the message coming from FIRST perfectly clear - engineering is about what happens between your ears, not what comes out of your deep pockets. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #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.
  #2   Spotlight this post!  
Unread 19-03-2005, 20:47
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
Re: A VERY nice perl script for generating lookup tables.

We have simple Python hacked-up scripts that generate our drivecurves. The curves we usually have:

1. Quadratic, scaled to 0 - 255
2. Sine (actually, cosine) wave, scaled to 0-255


With the joysticks we got this year, #1 worked the best for us.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
  #3   Spotlight this post!  
Unread 19-03-2005, 22:30
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
Re: A VERY nice perl script for generating lookup tables.

Quote:
Originally Posted by jdong
We have simple Python hacked-up scripts that generate our drivecurves. The curves we usually have:

1. Quadratic, scaled to 0 - 255
2. Sine (actually, cosine) wave, scaled to 0-255


With the joysticks we got this year, #1 worked the best for us.
not sure what u mean..... can u give examples?
__________________
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
  #4   Spotlight this post!  
Unread 20-03-2005, 07:33
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
Re: A VERY nice perl script for generating lookup tables.

To make a drive curve, you don't need any more code than:

echo '{'

for loop:
print CurveFunction(x),','

echo '};'


As far as the curves, a quadratic curve is simply scaling a quadratic function f(x)=x^2 such that f(127)=255.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
  #5   Spotlight this post!  
Unread 20-03-2005, 07:46
Gal Longin's Avatar
Gal Longin Gal Longin is offline
Gal L.
#1578 (IsraBot)
Team Role: Leadership
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Israel
Posts: 32
Gal Longin is an unknown quantity at this point
Send a message via ICQ to Gal Longin Send a message via AIM to Gal Longin Send a message via MSN to Gal Longin Send a message via Yahoo to Gal Longin
Re: A VERY nice perl script for generating lookup tables.

what's a drive curve and how is it helpful? why would i want to generate a drive curve?
__________________
"Only two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." -Albert Einstein.

2005 Israel regional Finalist
2005 Israel regional Johnson & Johnson Sportmanship Award
2005 Israel regional Website Award
  #6   Spotlight this post!  
Unread 20-03-2005, 08:04
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: A VERY nice perl script for generating lookup tables.

A "drive curve" is just a way of saying that you want your robot to start out moving slowly, but gradually (typically in a curved way) get faster. It's just designed to make control a little easier and to prevent wear and tear from fast reverses in direction. In many cases, your driver may do this manually (a good one does it without even realizing it), but it's typically very important for an accurate autonomous mode.
__________________

  #7   Spotlight this post!  
Unread 20-03-2005, 09:38
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
Re: A VERY nice perl script for generating lookup tables.

Quote:
Originally Posted by Gal Longin
what's a drive curve and how is it helpful? why would i want to generate a drive curve?
A drive curve makes it easier to control the bot in the lower ranges. Look at the excel graph i did.

Most people do not maneuver at high speeds. With a drive curve you can devote large amounts of your joystick swing to the lower speeds while still being able to hit the high speeds.
__________________
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
  #8   Spotlight this post!  
Unread 20-03-2005, 12:02
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
Re: A VERY nice perl script for generating lookup tables.

Quote:
Originally Posted by jdong
To make a drive curve, you don't need any more code than:

echo '{'

for loop:
print CurveFunction(x),','

echo '};'


As far as the curves, a quadratic curve is simply scaling a quadratic function f(x)=x^2 such that f(127)=255.
In its simplest form, yes. My script, however, incorperates compensation for Victor deadbands and it allows the use of a two curve composite.
__________________
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
  #9   Spotlight this post!  
Unread 23-03-2005, 19:02
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
Re: A VERY nice perl script for generating lookup tables.

Here is an updated version. I fixed a few bugs, made it easier to edit and documented it a little better.
Attached Files
File Type: txt tablescript.txt (5.5 KB, 49 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
  #10   Spotlight this post!  
Unread 31-03-2005, 00:03
cloudago cloudago is offline
Registered User
#0662
 
Join Date: Jan 2005
Location: Colorado Springs
Posts: 3
cloudago is an unknown quantity at this point
Send a message via AIM to cloudago
Re: A VERY nice perl script for generating lookup tables.

Quote:
Originally Posted by Validius
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.
It would be nice to see some user input instead of it all being hard-coded. Reasons being, I know Perl is an interpreted language and that its quick to execute, but on-the-fly curve changes would be very efficient. You could even go further and use another language to build a GUI that graphs the curve while you input the equation for the curve. If you need an example, I can show you a GUI written in Java that graphs equations (written by a friend) and change it so that it can fit your needs. Otherwise, the script is nice. Good job on it.
  #11   Spotlight this post!  
Unread 31-03-2005, 10:14
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
Re: A VERY nice perl script for generating lookup tables.

Yea, i'm going to post a bugfix in the code in a sec. I think imay work on a way to edit paramaters from command line. the hard coded ones would still be here but they would be overridable.
__________________
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
  #12   Spotlight this post!  
Unread 31-03-2005, 10:15
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
Re: A VERY nice perl script for generating lookup tables.

BUGFIX!!!!
Attached Files
File Type: txt tablescript.txt (5.6 KB, 50 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
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi