Implemented CommandBase, hopefully more correct than before

This commit is contained in:
Austen Adler 2016-07-22 16:18:14 -04:00
parent 135f031ae5
commit 089bab94d1
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,9 @@
package org.usfirst.frc.team2059.robot.commands;
import org.usfirst.frc.team2059.robot.subsystems.Drivebase;
import org.usfirst.frc.team2059.robot.subsystems.Encoderbase;
import edu.wpi.first.wpilibj.command.Command;
public abstract class CommandBase extends Command{
protected static Encoderbase encoderbase = new Encoderbase();
protected static Drivebase drivebase = new Drivebase();
}
// vim: sw=2:ts=2:sts=2

View File

@ -1,7 +1,8 @@
package org.usfirst.frc.team2059.robot.commands; package org.usfirst.frc.team2059.robot.commands;
import edu.wpi.first.wpilibj.command.Command; import org.usfirst.frc.team2059.robot.commands.CommandBase;
public class LogEncoder extends Command { public class LogEncoder extends CommandBase {
public LogEncoder() { public LogEncoder() {
requires(encoderbase);
} }
protected void initialize() { protected void initialize() {
} }

View File

@ -0,0 +1,20 @@
package org.usfirst.frc.team2059.robot.commands;
import org.usfirst.frc.team2059.robot.commands.CommandBase;
public class ResetEncoder extends CommandBase {
public ResetEncoder() {
requires(encoderbase);
}
protected void initialize() {
}
protected boolean isFinished() {
return true;
}
protected void execute() {
encoderbase.resetEncoder();
}
protected void end() {
}
protected void interrupted() {
}
}
// vim: sw=2:ts=2:sts=2