
Re: while loop monitoring motor encoders stops short
Here's our #pragmas:
#pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, none)
#pragma config(Sensor, S2, HTSMUX, sensorI2CCustom)
#pragma config(Sensor, S3, HTSMUX2, sensorI2CCustom)
#pragma config(Motor, motorC, motorBatonSpinner, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_1, motorLeft, tmotorNormal, PIDControl, reversed, encoder)
#pragma config(Motor, mtr_S1_C1_2, motorRight, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C2_1, motorArm, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C2_2, motorG, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C3_1, servoBatonHolder, tServoStandard)
#pragma config(Servo, srvo_S1_C3_2, servoSideGate, tServoStandard)
#pragma config(Servo, srvo_S1_C3_3, servoFrontGate, tServoStandard)
#pragma config(Servo, srvo_S1_C3_4, servoAimV, tServoStandard)
on HTSMUX we have:
- a HiTechnic Angle sensor
- a HiTechnic Accelerometer
- a HiTechnic IR Seeker 2
- a LEGO Ultrasonic sensor
On HTSMUX2 we have:
- a HiTechnic Gyro sensor
I looked through the thread you referenced. It sounds similar but I wouldn't have described our motor encoder values as jumping around all over the place. Given the update rate of the sensor, and how many times we are seeing the bad values I'm guessing that we're seeing the bad value, on average, on about 1 out of 2000 or so reads. Could be 1 out of 1000. Could be 1 out of 5000. By now needing two back-to-back bad readings in a row to go south we take our bad reads that can affect us up to somewhere between 1 out of 1,000,000 to 1 out of 25,000,000. Instead of tripping us up every other run now it will trip us up every couple of thousand runs.