TankDrive + auto example
This commit is contained in:
parent
34388d6364
commit
c862234c3e
@ -29,6 +29,11 @@ public class RobotContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
return Commands.print("No autonomous command configured");
|
return drivetrain.tankDrive(() -> .5, () -> .5)
|
||||||
|
.withTimeout(2.5)
|
||||||
|
.andThen(
|
||||||
|
drivetrain.tankDrive(() -> -.4, () -> .4).withTimeout(1),
|
||||||
|
drivetrain.tankDrive(() -> .5, () -> .5).withTimeout(1.5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,4 +37,10 @@ public class Drivetrain extends SubsystemBase {
|
|||||||
dt.arcadeDrive(forwardBackward.getAsDouble(), leftRight.getAsDouble());
|
dt.arcadeDrive(forwardBackward.getAsDouble(), leftRight.getAsDouble());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Command tankDrive(DoubleSupplier leftSpeed, DoubleSupplier rightSpeed) {
|
||||||
|
return run(() -> {
|
||||||
|
dt.tankDrive(leftSpeed.getAsDouble(), rightSpeed.getAsDouble());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user