E4P Encoder Scaling

This is the comment for the Encoder::SetDistancePerPulse() method:

  • Set the distance per pulse for this encoder.
  • This sets the multiplier used to determine the distance driven based on the count value
  • from the encoder.
  • Do not include the decoding type in this scale. The library already compensates for the decoding type.
  • Set this value based on the encoder’s rated Pulses per Revolution and
  • factor in gearing reductions following the encoder shaft.
  • This distance can be in any units you like, linear or angular.

From this link:

The encoders provided are 360 CPR. With 4X quadrature decoding, you get 1440 positions per revolution.

I have 8" direct driven wheels on my robot. Because the comment says the library already compenstates for the decoding type I used the 360 number. I wanted my speeds in feet/sec so I set my distance per pulse accordingly:


pLeftEncoder->SetDistancePerPulse((3.14*(8.0/12.0))/360.0);
pRightEncoder->SetDistancePerPulse((3.14*(8.0/12.0))/360.0);

The problem is I don’t believe the values I am getting from Encoder::GetRate(). I used a tach to measure the max speed of the wheels and it read 517 rpm which is 18fps which is what we design the drive to be capable of. However my encoders are reading 12fps. The only thing I can think to change would be to use 1440 instead of 360 but that would just lower the speed I am reading. Help?

The 4x decoding mode can have trouble when the phases of the encoder are not perfectly 90 degrees apart (most encoders aren’t) and the encoder is spinning fairly fast. I recommend 1x decoding for the drivetrain. It should still give you more than enough accuracy. See if that clears things up at all.

Also, the stupid question, your encoders are attached directly to your wheels/wheel shafts right? Or a shaft attached to the wheels/wheel shafts by a 1:1 ratio?

Are you sure your encoders aren’t actually 250 counts instead of 360? That would account for your discrepancy.

P/N E4P-250-250-D-D-D-B from 2009 KoP (see attachment)
*
*





Thanks!! That must be it. If I plug in the 250 value it gets me the speeds I expected. I will confirm the P/N’s on the encoders but I am confident that will be the solution. Thanks again.