** So before this is the basic VEXcode generated code (which i will not include)
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!!
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
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
March 19, 2023, 4:08am
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.
Oh my gosh- thank you so much! Worked!
I should of guessed that would of been it, haha my fault. Congrats you got it!