Integrated Encoder Programming Problems

hi there everyone,

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?

Team 5225A
2012 Programming Skills Champions

No One has responded to you yet, and I don’t know the Answer, have you Searched the RobotC Forum on sensorQuadEncoderOnI2CPort and sensorNone?

I don’t recall of hearing of this Issue on the Vex Forum…

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.

Is this the behavior that occurs if you access the Motors and Sensors Setup dialog in the early version of 3.54? The corrected version is dated November 5th.

Yes, I remember that, there were very few people that downloaded the Sunday version (according to CMU), a revised 3.54 was posted the next day.

thank you everyone for your help.

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.

thank you again everyone. :slight_smile: