Quote:
Originally Posted by psy_wombats
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.