Auton code doesn't work for target distance


My team was trying to test their Auton code with some basic math function. But they are getting incorrect values and the chassis moves only half the target distance. can someone help what is wrong with this code?

100rpm vs. 200rpm cartridges (and non-matching setup in the VCS)?


Drive motors have 100 RPM cartridge and RPM setup enables the chassis to move fast or slow depending on the rpm value . The # of motor rotations required to move the chassis to target distance of 40in is howevere depends on wheel dimension and not on the RPM value. So # of motor rotations required = distance to move robot / wheel circumference ( PI*D). The problem the team is seeing is that the robot moves for only 20in when the target distance value given is 40in. Issue in the math…but code has the right logic, Yet the chassis moves only half distance.

Is the motor in the VCS config page set for 36:1 (100 rpm) gear ratio ? The default would be 18:1 as that is how motors are configured when new.

Maybe I can help clarify this. @Devasena , the encoder does not measure the amount the motor rotates the shaft. It measures how much part of the motor has rotated. There is then a calculation to determine how much the shaft has been rotated, and that calculation depends on the gear ratio you tell the program your motor has. So you’re telling the program that the shaft will rotate twice as much as it actually will for any amount the motor rotates. If you correct the gear ratio, then the conversion will work properly.

Oh…my!! Good catch. Yes the team missed to change the motor config. Thanks so much for the help.

Thanks for the explanation. Our team missed to update the config for 36:1 gear ratio.