when we run our autonomous it does the first block which is go forward 4 inches but when it goes to turn right, it turns left indefinitely. Anyone know how to fix this?
could you send the code?
Like JThomas said, sending your code will make helping a lot easier, but you can try some of these general solutions:
Try reversing which motor is spinning negatively. Considering it is spinning indefinitely, I would also assume you are using an inertial sensor, so make sure that the angle you are giving it has the correct sign. In the case that you are using a PID, make sure you are calculating the error properly so you don’t get the wrong sign when applying the PID signal.
That “turn right for 0 degrees” seem unnecessary, try removing it or increasing the value other than 1 and see what happens.
The code is probably tripping because turning for 0 degrees can’t be obtained, so it just loops forever. This is my best explanation for that.
we have on on it but aren’t sure how to use it yet, we have a new programmer and non of us have ever messed with it alot.
its supposed to be at 90
we changed it back 90 and it still just loops for ever.
Considering when you tell the robot to “drive reverse” it actually drives forward, trying reversing your drive motors. This should make the “turn right” actually turn right instead of turning left.
Also, are you using an inertial sensor? Does the turn block automatically use the inertial sensor? Personally, I’m not too sure about that second question so if someone who has a better understanding of block coding can answer that would be great.
Thanks everyone for the help, the issue was we had it connected to our drivetrain instead of having it by itself in the senors. It all works now!
You’ve got to watch for weird behavior when using angles. Sensors can read -359 degrees instead of 0… then bad stuff starts happening.