Inertial Sensor Drivetrain doesn't stop turning (auton)

** So before this is the basic VEXcode generated code (which i will not include)

calibrate_drivetrain()
wait(5, SECONDS)
drivetrain.turn_to_rotation(90, DEGREES)

So when I run this code, the drivetrain will just not stop running- I’m 99% the sensor did finish calibrating

I’m a very new programmer, so please note that I might not understand some technical terms in the replies (sorry!)

Thank you so much!!

2 Likes

You dont have a direction, so its probably turning in the wrong direction, try instead of rotation, using heading. This way you dont have to put a direction

1 Like

Even with this change- (I changed “drivetrain.turn_to_rotation(90, DEGREES)” to “drivetrain.turn_to_heading(90, DEGREES)”) it still continues running, however thank you so much for your response!!

Try put a direction in there, before the number? That’s the only other thing I can think of

1 Like

Looks good and you got very close. So for the drive train what you need is Drivetrain.turnFor(right, 90, degrees); If you want it to go left you just replace the right with a left.

That gives me an error- likely because the function doesn’t take direction as a parameter and (I’m pretty sure) defaults to clockwise

The issue seems to persist still… but thank you for the response!

Can try this (Munch is what we called our drivetrain,
Munch.turn_to_heading(90, DEGREES, RIGHT)

it doesnt give me an error in VSC, Im using python.

The problem is likely that your motors are not properly reversed, so the robot is turning the wrong direction relative to the value it’s trying to get to. In theory, turn to heading would fix this, but underneath I expect that the code is doing a comparison that’s not going to be properly met when you’re going the opposite direction that the code is expecting.

Try reversing your motors from what they are right now (normal to reversed, reversed to normal), and then see if that doesn’t fix the issue.

5 Likes

Oh my gosh- thank you so much! Worked!

2 Likes

I should of guessed that would of been it, haha my fault. Congrats you got it!