Go to Post Never, Never tell a prospective mentor what the actual job description is. You need to get them hooked first. :D - BJT [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
  #16   Spotlight this post!  
Unread 31-01-2006, 10:51
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

For anyone who has utilized a differential term in their control loop, did you use the timing of the default routine or set up an timed interrupt driven differential calculation?

I know the default code loops at ~26ms, but is its rate of repitition constant enough to house the differential term calculation?
  #17   Spotlight this post!  
Unread 31-01-2006, 11:12
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,078
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?

I find that the default 39Hz main loop is fast enough for any feedback applications in FIRST, and it is fairly well timed as long as you don't go overboard on the interrupts.

Besides, the closer together your differential term calculations are, the less resolution you have in them (i.e. you couldget 5-10 "ticks" difference on a 100Hz loop but the same rate would produce 12-25 on 39Hz).
  #18   Spotlight this post!  
Unread 31-01-2006, 12:50
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by Abwehr
You can replace the line:

control /= 4;

with:

control >> 2;

But that's about it - otherwise it works.
if control can be negative, then a right shift can have a disastrous effect! mcc18 v2.4 does NOT shift in 1's for a negative number. Instead, it treats all numbers as unsigned.

For example,

int control = -16;
control = control >> 2;

After that snippet, you'd expect control to be -4, but in actuality its 16380. Quite different.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003
  #19   Spotlight this post!  
Unread 31-01-2006, 13:27
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by Joel J.
if control can be negative, then a right shift can have a disastrous effect! mcc18 v2.4 does NOT shift in 1's for a negative number. Instead, it treats all numbers as unsigned.

For example,

int control = -16;
control = control >> 2;

After that snippet, you'd expect control to be -4, but in actuality its 16380. Quite different.
Indeed, our team learned that lesson the hard way....
  #20   Spotlight this post!  
Unread 31-01-2006, 15:34
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,078
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 Joel J.
if control can be negative, then a right shift can have a disastrous effect! mcc18 v2.4 does NOT shift in 1's for a negative number. Instead, it treats all numbers as unsigned.

For example,

int control = -16;
control = control >> 2;

After that snippet, you'd expect control to be -4, but in actuality its 16380. Quite different.
Wow - I definately would have thought that a shift would extend the sign.

I guess I should have RTFM.
  #21   Spotlight this post!  
Unread 31-01-2006, 20:51
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by Rick TYler
Yeah, but, writing PID from scratch is hard. Does anyone have some sample code I could show to our student programmers?
The Navigation code Kevin made for last year's robot has PID in it.

And it's pretty easy.
Code:
error = current - target
integral += error
derivative = error - prevError
output = Kp * error + Ki * integral + Kd * derivative
prevError = error
(The implementation details are left to the reader )
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

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 15:32.

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