Hi all, I’ve been getting some strange results using the Integrated Motor Encoders. They seem to operate normally for 1-5 seconds (determined by checking their values on an LCD), and then get frozen on seemingly arbitrary values. Currently, they are put on every other motor on our eight motor holonomic drive, and are used to find velocity for a speed regulation system. I have resolved, with reasonable certainty, that it is not the software, as one of the encoders plugged directly into the cortex, using a program which simply prints the current velocity of the encoder onto the LCD has the same issue. I am also relatively certain it is not static, as the issue occurs even when the chassis is elevated off of a wooden table. I am using RobotC. Any ideas? Thanks!
Is their a red light on the IME?
Nope, intermittent double blinking green followed by blinking in accordance to the wheel speed.
Please post your code
Yea, thought you might say that. Unfortunately I’m away from my computer at the moment, but i will do so tomorrow morning.
Have you tried unplugging it and plugging it back in? If I remember right the light should be green or off, and if it’s yellow something is wrong. I had the light turn yellow sometimes, but unplugging and plugging it back in fixed it temporarily.
What do I do a bought a red light?
Right, I think I forgot to mention that. No yellow lights, but unplugging and plugging back in did temporarily fix it.
LED Patterns: https://www.vexrobotics.com/wiki/Intergrated_Motor_Encoders
Yellow - Not Initialized (default Address)
Every 3 sec
Green Blink - initialized, valid I2C communications, in neutral
Green Double Blink - initialized, valid I2C communications, in neutral and terminated
Blinking Green - relative to speed
Solid Green - full speed in either direction
Yellow (same as Green patterns) - counter overflow
Solid Red - data is being written to EEprom (1sec)
Blinking Red - address range error (a valid address will clear error)
Green Blip - I2C communications lost, initialized and in neutral
Green Double Blip - I2C communications lost, initialized, neutral and terminated
Well I’m not exactly sure what the difference between a blip and a blink is, but it appears to be the double blink and then, once it starts moving, it blinks relative to the speed.
In case it helps, here’s the simple program I’ve been using to test the encoders. (Runs the drive wheel with an encoder plugged directly into the cortex and prints it to the LCD.) By the way, what’s the best way to upload code? Copy+Paste, attach a notepad file, or upload a .rbg?
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, I2C_1, , sensorQuadEncoderOnI2CPort, , AutoAssign )
#pragma config(Motor, port3, , tmotorVex393TurboSpeed_MC29, openLoop, encoderPort, I2C_1)
#pragma config(DatalogSeries, 1, “”, Motors, MotorPower, port3, 50)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
int encode;
motor[port3] = 127;
motor[port8] = 127;
while(true)
{
encode = getMotorVelocity(port3);
displayLCDNumber(0,0,encode,6);
}
}
You do know you are displaying velocity, the number will increase to near 100 (for a free running motor) and then stabilize, were you expecting to see encoder counts?
Yep, I know I’m displaying velocity. The number should still oscillate around that maximum value though, right? The value is not responding even to more load being placed on the wheel (in other words, me putting my hand on it).
I personally prefer the red Optical Encoders for drive trains, they have much less issues than the IME’s.
Tell me about it, i just wish they were smaller.
And had only one wire.
You wouldn’t be able to tell direction then…
That would not be a good thing…
Ya it’s just part of how encoders work. You can actually plug 1 wire in of an encoder and it will work but you can’t tell which direction the motor ticks are so vibrating in place can look a lot like driving full speed.