Encoder Accuracy

Hello All!
Is there any way to be able to make encoders more accurate by finding the amount of error ,in factors such as wheel slippage, in RobotC. I don’t know how one would implement this into code, or what other factors could cause the encoders to be inaccurate, but that’s why I am asking here. Thanks! :smiley:

I think self-made dust might be one source of error. See this link: https://vexforum.com/t/optical-encoder-failure-mode-self-made-dust/26404/1

As for other types of error, a lot depends on the application. For example, if you’re using omni wheels, then it will depend on whether you are driving straight or making a turn, whether you are using a gear train and how much backlash the gears might have. So you’re not just asking about the encoders by themselves, but what they are connected to.

One way I have my kids test their robots is to have them drive in large circles or squares and see how far from the ideal they stray. How far they miss returning to their starting point illustrates how error-prone their designs are and whether their errors are random or systematic. The old fashioned measuring tape works wonders, too.

reducing backlash helps improve sensor accuracy

backlash is slack or slop, seen in gears the most because of the space between the teeth, also some low strength gears, sprockets, and wheels under high torque have some wiggle room between the square hole and axle.

for example direct drive, or attaching the motors directly to axle the omni wheels are on
to reduce backlash on omni wheels and the axle, you screw lock bars to the wheel, look here for an example https://www.youtube.com/watch?v=tC8LV1LtIcU&list=UUQUZr-i-qUIhgvRNCcbOuTw

additionally to reduce wheel slippage, accelerate your robot slowly, for example 0-127 motor value over a range of time say 3 seconds as to of instant 127 motor value

I don’t know if it’s possible to calulate an error using sensor readings, most likely not because your sensor readings would be inaccurate to begin with, i just don’t see it happening. Best way to increase sensor accuracy is reducing backlash.

Do you think it’d be possible to use the acceleration equation that assumes constant velocity (x=1/2at^2 +vit +xi) to find the error?

I’ve noticed that, on their own, the encoders can be unreliable for precise movement on the field, mostly due to overshoot in the motors. Once I finished programming the PID for our drivetrain (and spent some time tuning the constant terms Kp, Ki, and Kd) I was able to minimize the error to within one or two ticks away from target value. (The error I speak of could be different from what’s being discussed in this thread, but for PID, error = target value - sensor reading.)

Without some way of controlling the motor speed, it’s impossible to be 100% accurate based on sensor value alone, even if slop in a drivetrain is reduced. Once the cortex stops giving power to the motor (once the target value is achieved) the motor still moves forward for a bit, overshooting the target. This is true not just for encoders, but for the gyro and potentiometer (say, on a lift) as well. In autonomous routines where a robot is repeating a certain motion over and over (say, moving back and forth to score skyrises) this can increase the margin of error quite a bit.

While not untrue this doesn’t seem to relate to the question at hand.

He isn’t asking about getting to the target value but rather ensuring the target value is in the same physical location always by mechanically or electronically fixing/ accounting for the wheel slippage.

Direct driving everything to ensure less slop along all the gearing is probably your best bet. As well as acceleration code to ensure your robot accelerates with the wheels rather than the wheels accelerating very quickly and wheels spinning while the robot tries to catch up.

All in all I would suggest trying to fix the wheel slop rather than trying to account for it. The equation of the slop isn’t going to be something simple to account for.

Minimize slop, minimize wheel spin, keeping track of rotation, and minimize electrical interference on signal lines are three things that come to mind.

Slop is described above. If you use the IME encoders are on the motor, so if you have chain or gears to get to the wheel, then you could have error introduced there. Having the encoder at the wheel via the red ones is good to know the wheel state, but you get a delayed reaction from the motor making it more difficult to control the accuracy.

Wheel spin is generally minimal. So we’ll skip that one. Assume competition foam tiles.

Rotation is a tricky one. If you are off in a heading, then you drive off course a bit and can be very additive over time. Do the trig and figure out how far you are off in the desired direction and compensate there. It also tells you exactly how far you have gone in the X direction.

Electrical interference is keeping those IME and signal wires away from heavy currents. This goes for the gyro too. Not sure how much effect this has or not empirically.

Thank you everybody for the great answers! I’ll try to implement the PID first, but will try all the suggestions. Thanks again.

Start with just P of the PID to get the feel of it. Sometimes Proportional control is all you need.