Software > Software

PID algorithm

<< < (3/4) > >>

[email protected]:
and how do i hook up the integral/derivative term with the motors???

--- Quote from: jkerns on January 23, 2013, 09:47:01 AM ---Your integrator doesn't appear to integrate, you don't have a gain for the derivitive.

does that mean that my algorithm is wrng????
--- End quote ---

[email protected]:
hey guys please help me i have to finish this project as soon as possible...
jus tell me if something's worng with my algorithm....

So far, we have determined that you did not scope the variables with the current position properly.

So far, we have determined that your PID doesn't really work as a PID because of errors in your software.

Have you fixed those problems yet?

First you need to make sure the current position term is passed to the main program.

Then you need to calculate the P I and D terms.

P_correction = KP * error

I_correction = I_correction + ( KI * error)

D_correction = KD * (last_error - error) Note: This is a simple implementation, but often has problems due to noise in your sensor input. But in your case, since the error will change only in integer steps and the change will persist for only one program loop, this term won't do much of anything.

Then you can add them up to get the PID output.

Then you need to actually tune your controller to work.

In theory, the I and D terms should have time associated with them as well, but if your software loop runs at a nearly constant rate, you can fake it with the KI and KD terms.

[email protected]:
thanks! for your reply...!!!
i have passed the current position term through the main loop....


[0] Message Index

[#] Next page

[*] Previous page

Go to full version