Quote:
|
Originally Posted by Kevin Watson
I'll bet you're spinning the encoders too fast as 1245 counts per wheel revolution is overkill. If you spin the encoders too fast the software will think the shaft is spinning in the opposite direction that it actually is. This is mentioned in the readme.txt:
** IMPORTANT **
On a 40MHz PIC18F8520, this software can track peak encoder
count rates as high as a few thousand counts per second, which
should be more than adequate for most applications. To meet
your performance expectations, selecting the proper Counts Per
Revolution (CPR) parameter of your encoder is very important.
If the CPR is too high, the robot controller will spend too
much time counting encoder "ticks" and not enough time on
other tasks. At the extreme, you will see very wacky behavior
in your robot controller including corrupted data, the red-
light-of-death or the controller may even think the robot is
traveling in a direction that it isn't. Selecting a CPR that
is too low will not give you the resolution you desire. The
CPR should be optimized to minimize the number of interrupts
your robot controller will have to service yet meet your
resolution expectations (yes, millimeter position resolution
to too much to ask for).
To test this theory out, find these #defines in pid.h:
/* These define the motor control settings.
The max and min values are the greatest and smallest pwm
values that you want to use on your motors. */
#define MAX_PWM 182
#define MIN_PWM 82
And set the values to something like 152/112 and test again. This will lower the maximum shaft velocity to a value that the encoders can (hopefully) track. If the control loop suddenly starts to work, you found your problem. You'll probably need to go to a much lower CPR encoder or move the encoders to the output shaft.
You were also spinning the wheel at a much lower angular rate than the software was doing. Testing the 'bot unloaded (up on blocks) just made it worse because the wheels could spin-up faster than the 38Hz control loop could control. Just out of curiosity, how fast were the wheels spinning?
-Kevin
|
That makes sense Mr. Watson, i will try that out lowering the speed first thing tomorrow morning, and let you know of the results. As far as the speed, i was unable to measure it in a numerical value but I am going to say it was VERY fast so this makes more sense altogether.
I am sorry i don't understand what you meant by going to an encoder with a lower CPR. Do you recommend we get any other encoder in place of the Grayhill 63R128 ? I will talk to the mechanical guys to consider moving the encoders to the final shaft as well.
Thanks,
Vick.