FYI you can build them to search for syntax errors... like this
Code:
private static void wait(Robot r, double waittime) {
while (true) {
if (!.risAutonomous() || !r.isEnabled()) return;
r.Timer.delay(waittime); //r or just timer?
return;
}
private static void reset(Robot r) {
missing a } and i assume you mean ""!r.is..." not "!.ris..." (also, its just Timer.delay)
passing in Robot for everything is ugh-ly. just make Robot a singleton... or use a static initializer
Code:
while (true) {
double distance = r.encoder.get();
double angle = r.gyro.getAngle();
if (!r.isAutonomous() || !r.isEnabled()) return;
r.robot.drive(-0.25, angle * r.Kp);
//r.robot.drive(-0.40, 0);
if (distance < -d) {
reset(r);
return;
}
}
the closed loop structure of this will hurt the robot, periodic ms timers are necessary
Code:
r.robot.drive(-.40, -1)
not Java-standard formatting
Code:
Boolean maxarmlimit = r.limit4.get();
capital boolean (also that name scheme is bad, both on the variable and the limit)
Code:
r.armmotor.set(Defines.ARM_SPEED);
r.leftarmwheel.set(Relay.Value.kForward);
r.rightarmwheel.set(Relay.Value.kReverse);
non-standard formatting (camelcase, descriptive names)
comparing a double and an int
Code:
r.robot.drive(-.40, -1);
constant loop? atleast a P loop, preferably PID
your "turn" and "turn2" functions are quite ineffective, basic angle averaging schemes should be used
other than that I'm losing my focus, but there are alot more issues