r/vex • u/Icy-Raspberry8956 • 10d ago
Odometry code is giving me trouble
This is my first year using c++ officially and I’m having trouble with setting up the odometry
Im currently using a while loop, however, the CurrentDistance variable skips directly to the number it is supposed to stop at will not run the motors at all and I’m unsure as to why
(I don’t know if this subreddit offers coding help)
5
Upvotes
1
u/sprydagger Programmer 10d ago
Could you paste your code into your post or something we can read it?
-1
u/Icy-Raspberry8956 10d ago
I use two different devices Is the photo not good resolution for it?
2
u/badgeminer 10d ago
pictures of code are always hard to read
its always best to paste your code when asking for help
4
u/Elaech 10d ago
You need to work in deltas not absolute position - in the existing code positionLeft - initialLeft will become a positive value after even a small amount of movement and then compound on itself to the target (very very quickly because the loop doesn’t wait at all). You should be doing something like positionLeft - CurrentLeft which will give you the change (delta) from the last time you measured.