Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Motor Speed (http://www.chiefdelphi.com/forums/showthread.php?t=62501)

AHepperla 25-01-2008 18:28

Motor Speed
 
Hey guys, I was just wondering why, when we set the same PWM values to two different motors, why the motors are going two different speeds? Anyone know how to fix this through calibration or something???

JohnC 25-01-2008 18:43

Re: Motor Speed
 
It's because you've got one motor mounted backwards, and the motors actually have a preferential direction. If you have encoders on your drive shafts, we have some code we're working on right now that will make it drive straight.

I'm sure someone else will have some code up before I will, but if you send me an email to remind me I'll put it up by monday.

P.S. I'm literally working on it RIGHT now ... final touches ... (which means nothing, of course)

tseres 25-01-2008 19:11

Re: Motor Speed
 
also, manufacturing isn't perfect. we had this problem last year. what happens is 255 to one motor might only act like 230 (exaggeration) on another. one wyay to fix this is to individually slow down each motor to calibrate them:

pwmXX-=127;
pwmXX*=0.9 //for 90% power
pwmXX+=127;


the other (and preferred) way is to use sensors like (ideally) encoders, but you could use a gyro to make it go straight, or, dare i say it, gear tooth sensors as encoders (it only requires a slight modification to kevin's encoder code). the only problem is that GTS's have to be almost touching the gear to get a reading, and thereadings are usually pretty sketchy.

good luck!

AHepperla 25-01-2008 20:02

Re: Motor Speed
 
Thanks for the help. Just wondering what kind of encoders you use/what kind do you recommend? Thanks again!

tseres 25-01-2008 20:11

Re: Motor Speed
 
as far as what kind of encoders, i'm not too sure. just do a search on these forums for encoders, and you'll find more than you need :)

Tom Line 25-01-2008 21:31

Re: Motor Speed
 
Use any type of encoder, but use the same one for both wheels.

It should be this simple, though I haven't done it yet (that's for tomorrow if we have a rolling chassis).

right_encoder = Get_Encoder(1);
left_encoder = Get_Encoder(2);

difference = right_encoder - left_encoder;

if (p1_y < (p2_y + 15)) && (p1_y > (p2_y - 15)) //If they're within 15 of eachtoher
{
right_drive = p1_y - difference * constant; //adjust based on difference of encoders
left_drive = p2_y + difference * constant; //adjust based on difference of encoders
}
else
{
right_drive = p1_y;
left_drive = p2_y;
}
Adjust constant until you go straight. This is essentially a PID loop based on the encoder difference. This assumes a tank drive system, but the same concept is applicable to other drive systems.

The Lucas 25-01-2008 21:39

Re: Motor Speed
 
Quote:

Originally Posted by AHepperla (Post 685882)
Hey guys, I was just wondering why, when we set the same PWM values to two different motors, why the motors are going two different speeds? Anyone know how to fix this through calibration or something???

Calibrating the victors would not hurt. Instructions are here. Either calibrate both Victors or reset them both to Factory default (your choice).

Also, I use US Digital encoders. Other people have mentioned Banebots and Grayhill.


All times are GMT -5. The time now is 23:54.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi