Go to Post We can either sit around and complain about what could have been, or we can focus on the upside of what we have and move on. - Vikesrock [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Spotlight this post!  
Unread 17-01-2002, 21:19
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Use feedback!

I don't think you will not be successful at what you are trying to do by just timing the outputs.

You really need to use feedback.

Have a potentiometer (pot) give your program the true position of the steering.

Compare the pot value to the desired value. Calculate the sign and magnitude of the error. Multiply the magnitude of the error by a gain (you may want to multiply it by a constant and divide it by a power of 2, i.e. shift the result right N bits, this will give you the abiltiy to have a gain between 1 and 2 for example). Then if the error is greater than zero add this scaled error to 127 to get the appropriate PWM output. If the error is less than zero subtract the scaled error from 127 to get your appropriate PWM output. You have to be careful about going under 0 or over 254 with your PWM output.

Anyway, this is a very simple feedback loop (called proportional feedback). It works pretty well, especially for steering (trust me I know this to be true).

Have your finger on the e-stop button (you all have built a yellow dongle with an e-stop button haven't you?) as you test your code because it is easy to have the steering go insane while you debug your code. You have to get the gain to have the right sign AND you have to have the gain set large enough but not too large. There are a lot of places to stub your toe, but the destination is worth the trip.

Good luck.

Joe J.
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
Diagrams for wiring of 15 and 25 pin connectors archiver 2000 2 23-06-2002 23:03
Subtotaling in PBASIC? Ian W. Programming 17 02-02-2002 20:22


All times are GMT -5. The time now is 12:02.

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