Pages: [1]   Go Down
Author Topic: Self balancing unicycle code. need help with data from PID  (Read 798 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* aramgp.ino (10.36 KB - downloaded 8 times.)
« Last Edit: May 11, 2012, 03:18:06 pm by Glennphillips » Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

   On line 209.
Code:
prevErr = curErr;
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


  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.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

thanks for the help.

glenn
Logged

Pages: [1]   Go Up
Jump to: