|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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???
|
|
#2
|
||||
|
||||
|
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) |
|
#3
|
||||
|
||||
|
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! |
|
#4
|
||||
|
||||
|
Re: Motor Speed
Thanks for the help. Just wondering what kind of encoders you use/what kind do you recommend? Thanks again!
|
|
#5
|
||||
|
||||
|
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
![]() |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||||
|
|||||
|
Re: Motor Speed
Quote:
Also, I use US Digital encoders. Other people have mentioned Banebots and Grayhill. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Controlling motor speed | WGRAY | Programming | 9 | 16-02-2009 22:50 |
| Motor speed | HellBoy | Programming | 2 | 05-02-2007 10:41 |
| Multi-Speed motor Questions | Burg | Robotics Education and Curriculum | 2 | 23-12-2004 15:54 |
| Drill Motor Speed Difference | Mark Jones | Motors | 2 | 14-02-2003 15:23 |
| Drill motor true speed? | archiver | 2001 | 0 | 23-06-2002 23:58 |