Skip to content

Commit 297d3eb

Browse files
author
colen
committed
fixed drive distance command
1 parent 0c367b7 commit 297d3eb

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

TorontoRobot/src/robot/RobotConst.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public class RobotConst {
6060
MAX_LOW_GEAR_SPEED = 365.0; // Encoder counts/sec
6161
MAX_HIGH_GEAR_SPEED = 830.0;
6262

63-
DRIVE_GYRO_PID_KP = .05;
64-
DRIVE_GYRO_PID_KI = 0.01;
63+
DRIVE_GYRO_PID_KP = 0.05;
64+
DRIVE_GYRO_PID_KI = 0.001;
6565

6666
DRIVE_SPEED_PID_KP = 0.75;
6767
ENCODER_COUNTS_PER_INCH = 51.5;

TorontoRobot/src/robot/commands/AutonomousCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ public AutonomousCommand() {
3535

3636
addSequential(new ArcCommand(100, 0, 310, 1.0));
3737
addSequential(new ArcCommand(140, 310, 350, 1.0));
38+
//addSequential(new DriveDistanceCommand(140, 310, 350, 1.0));
3839
}
3940
}

TorontoRobot/src/robot/commands/drive/DefaultChassisCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected void execute() {
4646

4747

4848
if (Robot.oi.getForwardThrust()) {
49-
Scheduler.getInstance().add(new DriveTimeCommand(0));
49+
Scheduler.getInstance().add(new DriveDistanceCommand(50, Robot.chassisSubsystem.getGryoAngle(), 0.5, 5.0, true));
5050
}
5151

5252
if (Robot.oi.getStartDriveDirection()) {

TorontoRobot/src/robot/commands/drive/DriveDistanceCommand.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public DriveDistanceCommand(double distance, double direction, double speed, dou
1111
this.distance = distance;
1212
}
1313
protected void initialize() {
14-
14+
//System.out.println("starting drive");
1515
Robot.chassisSubsystem.resetEncoders();
1616

1717
}
@@ -20,7 +20,8 @@ protected boolean isFinished() {
2020
if (super.isFinished()) {
2121
return true;
2222
}
23-
if (distance * RobotConst.ENCODER_COUNTS_PER_INCH >= Robot.chassisSubsystem.getEncoderDistance() + 20){
23+
if (distance * RobotConst.ENCODER_COUNTS_PER_INCH < Robot.chassisSubsystem.getEncoderDistance() + 20){
24+
//System.out.println("ending drive");
2425
return true;
2526
}
2627
return false;

0 commit comments

Comments
 (0)