Go to Post Someday I will have to learn how tagging and reps work. I already know how search and brain farts work. - kstl99 [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
  #14   Spotlight this post!  
Unread 31-01-2006, 09:53
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by Mike Shaul
Here is some basic P control code, let me know if anyone catches an error!

Code:
#define GAIN       10    //This will need to be tuned

u8 p_control(u16 desired, u16 actual)
{
    s16 error, control;

    error = desired - actual;
    control = error * GAIN;
    if( control > 504 )
		control = 504;
    else if( control < -504 )
   		control = -504;
    
    control /= 4;   /* Convert to 8-bits */

    return (u8)(control +127);   /* PWM Output */
}
You can replace the line:

control /= 4;

with:

control >> 2;

But that's about it - otherwise it works.
 


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
What Makes a FIRST Team Successful? Dr.Bot General Forum 17 23-12-2005 08:45
PID cmd_drive can't drive straight? gnormhurst Programming 4 18-02-2005 01:54
2005 Autonomous Scripting Manual Anthony Kesich Programming 31 17-02-2005 17:30
**FIRST EMAIL**/Important 2005 Competition Manual Information Sscamatt FIRST E-Mail Blast Archive 1 06-01-2005 18:50


All times are GMT -5. The time now is 22:10.

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