Help: "Drive For Distance" Blocks & Measuring

Can you think of a likely reason that it seems like my V5 brains are not correctly measuring distances?

If I have a student do a quick test for a dragster, that starts via a bump switch, at like 20inches it drives and stops like it should within its forever and if then loops… but if I want them to drive on a 50ft track and they put 600 inches (50ft x12), they never stop. They easily continue to go on for what seems like forever, even when picked up.

  • We have also correctly measured our track widths, wheelbase, and gear ratios when setting up the motors on V5.

Any help is much appreciated!

What programing software are you using and share your code (one of the only ways we can help)
Another issue I see is you aren’t using sensors outside the motor, as motors are not 100% accurate at measuring distance, but this shouldn’t cause a too dramatic change in distance

1 Like

@DodgeDoodle_41442A
I am having my class use VEXcode V5. In this case the the drive-train is a 2-motor with 4in wheels, 11.75in track width, 7in wheel base, 1:7 ratio, with green gear cartridge.

The robot will drive and stop with the code on the left, like its supposed to. But the one on the right seriously goes for well over five minutes before I stop the program. The track I made them is 5ft or 600in.

Screenshot 2021-12-08 7.48.34 AM

Can you try the same thing but with an else part underneath?
The if-then-else hat.
image

with all the other code around it

1 Like

Your making it drive forward for 50ft, not 5ft
Change the varible to 60in and see is you have the same issue

1 Like

@DodgeDoodle_41442A
Yeah that was a typo in my reply. I do want them driving 50ft at 600in. I’m sorry, thanks for trying to help me.
Just so we’re on the same page again because of the typo. I want them to go 600", but they are driving nonstop for like five minutes when I put 600 inches and they are done with their 600" in roughly 10-20 seconds.

@robomaster
Just tried it. Same thing. It basically forever when I want them to put any amount of inches over like 100. It stops when I have them put like 20" while holding up the drive-wheels when they are making sure they are going the correct direction though.

This sounds like a bug
By chance do you have any bumper sensors? You could have it run forever, and when it hits the wall and the bumper is pressed, it could shut off the program.
A picture of the dragster also might help (the motor-gear-gear connection)

It sounds like we have an overflow error somewhere.
I’ll look into it and let you know, can you post a screen shot of the drivetrain configuration so I can exactly reproduce your project.

5 Likes

Assuming 4 inch wheels, 600 inches is ~24 rotations. At 2048 ticks-per-rotation, that would be 49,152 which would overflow a 16-bit signed integer (32,768). However, the V5 motor specs seem to indicate that the green gears are 900-ticks per revolution, which would put this at 21,600 encoder ticks.

On 3.25inch wheels, 600 inches would be ~28.5 rotations; still at 900-ticks per revolution, this would only be 25,650 ticks…

@DC2, what size wheels are being used?

1 Like

yea, I don’t see any errors, I’m just wondering of you (or we I guess) have external gear ratio reversed

1 Like

That is what is seems like to me too. What I have found out the last day and half after more testing, is that students with a smaller gear ratio like 1:2 get accurately measured distances. It is the students running higher ratios like 1:7 that are having issues with distance being measured.

I actually have already thought of the front bump switch idea, but I would prefer them not hit any more walls. They are going very quick and already accidentally hitting walls and breaking stuff. I currently have 4 broken axles, one broken motor, and a steel angle taped to my board showing students to test at 25% velocity until they know they go straight, before jacking them up to 100%.

What I have thought about is maybe having them put limit switching on the bottom that could hit a small raised bump at the finish line. The issue with that though is I wouldn’t have enough limit switches.

Regardless I basically just had class switch over to a drive, wait for, stop drive code, rather than using the Drive For Specific Distance blocks, which is kind of working. They just need to test the times over and over to get it right.

yea, I did test and don’t see any overflow issues (admittedly on an EXP and not a V5, but it should be same behavior). Are you sure gear ration is correct, it’s a bit weird in VEXcode, if motor has bigger gear than wheels you probably need 7:1 not 1:7.

1 Like