Go Down

Topic: Self balancing unicycle code. need help with data from PID (Read 822 times) previous topic - next topic

Glennphillips

May 11, 2012, 10:08 pm Last Edit: May 11, 2012, 10:18 pm by Glennphillips Reason: 1
I have combined a program that reads my imu sensors ( sparkfun 5dof ). with a self balancing robot code by kerry wong.  I am aquiring the data and i think im getting good numbers for mixing the gyro and accelerometer but my previous error and current error in the pid calculations are the same number.

I would actually go as far as saying all the PID data looks incorrect, but on the right track...

i attached my .ino file.

Thanks for looking!

gp

cyclegadget


Quote
my previous error and current error in the pid calculations are the same number.


   On line 209.
Code: [Select]
prevErr = curErr;

Glennphillips

thanks for looking that over!

that line is supposed to take the current error from the last calculation and make it the previous error for the next calculation.

i fixed some mistakes in the code i posted here, but i still have the currerr=preverr issue.

cyclegadget


  To see the values of the two variables "prevErr,  curErr", you will need to print them before the "=" part of the code that I mentioned. You can put prints inside of the function before line 209 to debug your code. After you are able to see the output, then you can remove them or continue looking for the problem.

Glennphillips

aaaahhh.  i see.  i fixed a couple other issues and im starting to get some output that makes sense.

thanks for the help.

glenn

Go Up