|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Encoders getting different rates
Quote:
I have another question: The side with the higher reading on the encoder right now spins faster than the other side. Once I tune the encoders to be consistent like you said, is there a way I can get the faster side to spin the same speed as the slower? I assume like a pid system where the encoder on the slower side is the setpoint and the encoder on the faster side is the process variable. How would I make this work with a tank drive though? Any help? |
|
#2
|
||||
|
||||
|
Re: Encoders getting different rates
you would have to tune them when both motors are running at the same speed. do you have a rpm meter in your shop?
|
|
#3
|
|||
|
|||
|
Re: Encoders getting different rates
I don't believe we have one. Yesterday, I was trying to multiply the faster side by a constant before it is fed into the tank drive block to attempt and get it close to the other side. I didn't get very far as my mentor was telling me that it would be easier to do it when the encoders are in sync.
|
|
#4
|
||||
|
||||
|
Re: Encoders getting different rates
that is right, but how would you get them in sync if the motors aren't turning at the same speed?
|
|
#5
|
|||
|
|||
|
Re: Encoders getting different rates
That's exactly what I was thinking. Today when I go to work on the robot, I'll probably work again with that constant to multiply by. Seems like the only way I can really get both sides close to each other.
|
|
#6
|
|||||
|
|||||
|
Re: Encoders getting different rates
This seems like a very bad idea. You currently have two encoders that aren't functioning at all the same, and you're thinking of fixing the problem by scaling the outputs? You don't even know if you're getting good reliable values from the encoders. I would very much recommend that you first verify that the values from your encoders at least somewhat correspond with reality.
If you get the wheels off the ground and give your drive train a full forward command, the motors will be turning pretty darn close to their no-load speed. That'd be 5200 RPM. You should be able to calculate what the rate reading of your encoder should be based on that and the gear ratio of your transmission. Hopefully one of your readings gets close to this number. Then you know which encoder is wrong and you can start looking at that one to figure out what's wrong. It might be bad wiring, a bad code wheel, a different code wheel, an incorrectly installed code wheel, bad programming.... What ever it is, you're better off figuring out why these encoders are so different and fixing that problem instead of making a workaround based off assumptions you haven't verified. For all you know, the encoder that's reading 50 counts isn't actually plugged in and you're reading noise on the digital IO lines. |
|
#7
|
|||
|
|||
|
Re: Encoders getting different rates
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: Encoders getting different rates
Quote:
|
|
#9
|
|||
|
|||
|
Re: Encoders getting different rates
Quote:
|
|
#10
|
||||
|
||||
|
Re: Encoders getting different rates
ok so since they both work, but at different rates, the method i gave above will work.
|
|
#11
|
|||
|
|||
|
Re: Encoders getting different rates
Exactly. In my code right now I just have the distance per count set at 1 for both and they are both at 1X. I'm just going to lay out 10ft, push the robot, get the readouts for both, divide 10ft * 12 inches by the count for each side. Then I will have the distance per count for both. If that goes the way I think, both encoders will be in sync with each other afterwards. What do you think?
|
|
#12
|
||||
|
||||
|
Re: Encoders getting different rates
it sounds perfect. and this test will kill 2 birds with one stone; you will be able to find the counts per foot at the same time
|
|
#13
|
|||
|
|||
|
Re: Encoders getting different rates
We had the same problem with ours. One side was giving reliable readings everytime, the other would give us some random garbage. We figured it out by manually rotating the axis the encoder was on by 1 revolution, and looking at the output, several times. They were very consistent, compared to the other side that would give us garbage. We looked at our wiring and found that the plastic clip the wires plug into was cracked and one of the signal wires was pretty much not connected. Pull it out and just check on it. After we replaced it, its been working fine.
If you rotate them one revolution and both sides are giving similar readings every time, then you can go ahead and scale them. For example if side A was giving you 140 and B was 360, you know that 140X=360. 360/140=~2.6. So you multiply the one side by ~2.6 to get them equal. Last edited by Brandon_L : 20-02-2012 at 17:48. |
|
#14
|
||||
|
||||
|
Re: Encoders getting different rates
i said to do that if they are consistant, meaning that there isn't a problem, other than different scaling
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|