Quote:
Originally Posted by Arhowk
0.25 is INCREDIBLY slow, it probably could be ~0.6-0.7.
Only? As in, it measures distance instead of displacement? That would be bad. I'm assuming you just have your encoder mounted backwards, in which case you can just say
Code:
double encoder = -encoder.get();
or smth.
Can't say with any idea since I have no access to your robot
|
Well I bumped up the speeds to .6 but I don't know about the encoder.
I had a question with this whole function and I was wondering if it's necessary to have distanceToGo negative when I can just say it's negative when I am calling up the function. Also should I have it double -distanceToGo in the parameters?
And when I call the function forwardDrive(should it be 3000 or -3000)
Also when is it appropriate to use return; and when should I use break; when I look at my code it seems as I use break and return randomly.
https://github.com/curtis0gj/5033-20...ster/Auto.java
Code:
double kP = 0.035;
private void forwardDrive(double distanceToGo) {
reset();
while (true) {
double distance = encoder.get();
double angle = gyro.getAngle();
if (!robot.isAutonomous() || !robot.isEnabled()) return;
chassis.arcadeDrive(-0.60, angle * kP);
if (distance < -distanceToGo) {
reset();
return;
}
Timer.delay(0.02);
}
}