Hello! I’m new to Java (we’re planning to switch to it next year after passing the last three years using Labview) and I have one important question. In the “Getting Started with Java for FRC” pdf, it shows the following code for an autonomous that drives in a square pattern by driving half speed for 2 seconds, then turns 90 degrees. This is repeated 4 times :
It also depends how far you’re driving. The smallest amount of rotate will cause the robot to go into a circle. If you want to truly move in a 90 degree line, you have to rotate 90 degrees than move forward.
E/ nvm misread it.
0.75 has nothing to do with the degree of the turn. When the move value is 0, the robot will stay in place.
However, a rotate will cause the motors to run in opposite of each other, essentially turning the robot. 0.75 for 0 seconds (thats what the code says… rotate for 0 seconds) might be + or - depending on the weight of the robot and the condition of the battery.
Yes that is correct, you will need to play with the paramerts to achieve the turn you want based on your particular robot. The % will be based on the weight or the robot, # of motors on each side of your drive train, type of motors, and a couple of other paramters which describe the dynamics of your particular bot.
The example is open-loop, which means it turns without sensors, once you get the example working, dont worry too much if it the turn is not accurate or repeatable.
The main thing here is to make sure you understand the logic of what the code is doing.
After which, try adding sensors to make the turn more repeatable like encoders on the drivetrain, or gryo or digial compass if you would like to stick with this example and enhance upon it.