This code was created with the help of another forum member who helped out tremendously in explaining how things work in block coding.
We tried a few things before reaching back out to the forum.
When using this autonomous code our bot spins in circles. The way we have our devices and driver code setup, we are unable to add a drive forward or drive reverse block.
What we are trying to accomplish here is for our bot to push a triball 30 inches into the net during the 15 sec autonomous period. Once we can figure that out, than we will expand from there.
We don’t want to change anything in the driver mode or device setup because it’s all working perfectly.
In devices, are your motor groups shown to be spinning in the same direction? If so, reverse one. If you look at the back of the motors you can see the direction that they spin “forward.”
Hope this helps!
- Henry 344E
I reversed the left wheels. It didn’t spin 4 times like it did before. It turned half a turn and erratically went back and forth. The wheels spin forward when I drive forward and reverse when I drive in reverse.
That sounds like the physical motor orientation is off and the directions are conflicting then. In this case you might be better off looking at the arrows on the motors themselves, and using that to determine which way is “forward,” then switch the direction of the motors in devices accordingly.
You should see this at the bottom of the motor groups tab.
tl;dr: make sure that the directions you are telling the motors to go in devices correspond with the direction of the motor itself.
Could you send a picture of your drivetrain? It seems like some of your motors are mounted backwards. You could also just mess with reversing one motor at a time in the motor groups page to try.
If you put your motors on the drivetrain with the axle part towards the front of the robot then you would have the left motors going forward and the right ones going backwards by default, so you’d have to switch the direction. That’s what I was getting at. By what you’re saying is happening it seems that your motors might be mounted with some different orientations ways.
Heres a quick drawing to show what I mean. The yellow arrows on the motors are the default directions.
So going by this you’d have to reverse the right in the motor group’s tab with the toggle switch thing.
(Though in my opinion you should just use the drivetrain device as it does this automatically.)
Your current code will work just how you want it to if you get the motor directions themselves correct.