We are working on the autonomous part of our curriculum. I am looking into finding a way to print the distance traveled by the VEXEXP bots to the brain as it travels as a cross reference to see if the measurements are correct. I am having trouble coding that on codeexp, and was wondering if that was first even possible to do and any tips on putting the code together to get this to happen.
Thank you everyone for your past discussions, they have helped our class out a lot thorough the units!
What are you expecting to use as a measurement mechanism, a sensor (such as a shaft encoder or distance sensor) or motor encoder counts?
I’m not super familiar with EXP, but given that it shares a lot of components with V5, there should be overlap and knowing what the measurement basis is will help shape the answer.
In any aspect, whether it be someway by RPM, distance sensor or anything that works. Beginner status intellect with the VEX robots at the moment, just looking for guidance.
The most straightforward starting point would be to do the math to figure out how far one full rotation of the wheel travels in your preferred measurement system, and then you can break that down as inches per degree or inches per rotation count. Then, roughly, as you drive, you can read rotations or degrees and convert to inches.
It won’t be exact, but it will be close. Turning may require you to reset counts, or explore other ways to do the math. Great time to revisit trigonometry lessons and show how pi, sin/cos/tan have real world applications.
I guess there is no real point in using the motor encoders to attempt to determine this since the drive for function is already using these for this exact purpose and so unless you wanted to measure overshoot, this wouldn’t tell you anything you don’t already know.
As far as I can see, you can’t monitor the encoders of motors that are part of the drivetrain class anyway.
However, using the brain timer and the distance from the drive for block, you could estimate speed.
Instead of using the drivetrain class, you could configure individual motors for the left and right wheels and do you own maths based on wheel size to determine how many rotations are needed to travel a given distance. This would let you monitor each encoder separately. You’d need to write your own code to manage turning too.
Alternatively, you could use a separate encoder (not in the EXP kit) and a tracker wheel which would then give you a different data point independently of the drivertrain which you could use to verify the drivetrain distance.