This is my team’s second year competing and we started using the new integrated encoders after last year’s worlds. they have worked fine up until recently. sometimes, the #pragma line that initializes them at the start of my code changes from sensorQuadEncoderOnI2CPort to sensorNone. What’s really weird is that it is doing this seemingly randomly and on its own. I don’t know what is causing them to do this and it is messing up our autonomous and causing damage to our robot which depends on input from the encoders. does anyone know what this is or how to fix it?
The only time I’ve sen this happen is when you change the motor type then, even though the encoder will still be shown, the assigned encoder is cleared. Otherwise is sounds like a corrupted registry or something along those lines. You could try cleaning the registry (in ROBOTC the View->Delete all registry values menu) or uninstalling/reinstalling ROBOTC.
Perhaps you could post the #pragma statements from your code so we can see if there is anything unusual about them.
here is the pragma lines for the four encoders: #pragma config(Sensor, I2C_1, topLeftEnc, sensorQuadEncoderOnI2CPort, , AutoAssign) #pragma config(Sensor, I2C_2, topRightEnc, sensorQuadEncoderOnI2CPort, , AutoAssign) #pragma config(Sensor, I2C_3, bottomLeftEnc, sensorQuadEncoderOnI2CPort, , AutoAssign) #pragma config(Sensor, I2C_4, bottomRightEnc, sensorQuadEncoderOnI2CPort, , AutoAssign)
the sensor type is never changed by me in the code for the encoders or the motors. i will try clearing the registry later on in the week and post the results. unfortunately i wont have access to the bot until tuesday. what would cause the registry to become corrupt?
And as far as i have looked i couldn’t find anything on the robotc forum common to my problem.
I believe i found the problem. the encoders were initialized properly but the motors weren’t because someone copied them from an earlier version of code that didn’t use them. because of this, the encoders were not assigned to motors and it would update them to sensorNone. i am still unsure what caused them to update when they did but it shouldn’t be a problem now.