View Single Post
  #10   Spotlight this post!  
Unread 01-02-2008, 21:53
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
Re: PID for velocity control

Quote:
Originally Posted by psy_wombats View Post
So, looking at Kevin Watson's velocity PID code...

Looks like it comes down to this line...
Code:
motor_info[motor].vel = ((vel_last * 9) + (motor_info[motor].pos - pos_last) * HZ) / 10;
1 - Where exactly is the 9/10 bit coming from? Is some form of scaling the old value? If not, how was it derived?
2 -What is the purpose of the hertz? I know what it is, just not what it does.
Looks to me like 90% of the last pass speed + 10% of the current speed (current position - last pass position for 1 pass in the loop)

...where you take that change in position (for 1 pass) times the passes/second (HZ or hertz) to change it to units to match vel_last

That's a low pass filter on speed, whose purpose is to reduce noise in the signal.
__________________

Don't PANIC!
S. P. A. M.

Last edited by EricS-Team180 : 01-02-2008 at 21:56.