package org.usfirst.frc7117.BaseV3.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc7117.BaseV3.Robot;
import org.usfirst.frc7117.BaseV3.RobotMap;
public class AutonomousCommand extends Command {
double TT;
int mode;
public AutonomousCommand() {
}
@Override
protected void initialize() {
TT=RobotMap.T.get()+7;
mode=1;
}
@Override
protected void execute() {
if (mode==1) {
RobotMap.DT.tankDrive(-0.55,-0.55);
if (RobotMap.T.get()>=TT) {
mode=2;
TT=RobotMap.T.get()+0.95;
}
}
if (mode==2) {
RobotMap.DT.tankDrive(-0.55,0.55);
if (RobotMap.T.get()>=TT)
mode=3;
}
}
@Override
protected boolean isFinished() {
if (mode==3) {
return true;
}
return false;
}
@Override
protected void end() {
}
@Override
protected void interrupted() {
}
}
package org.usfirst.frc7117.BaseV3.subsystems;
import org.usfirst.frc7117.BaseV3.Robot;
import org.usfirst.frc7117.BaseV3.RobotMap;
import org.usfirst.frc7117.BaseV3.commands.*;
import edu.wpi.first.wpilibj.command.Subsystem;
import org.usfirst.frc7117.BaseV3.subsystems.*;
public class Output extends Subsystem {
double s=1;
double fa=0;
@Override
public void initDefaultCommand() {
}
@Override
public void periodic() {
if (RobotMap.JS1.getRawButton(3)) {
s=0.6;
}
if (RobotMap.JS1.getRawButton(4)) {
s=0.75;
}
if (RobotMap.JS1.getRawButton(2)) {
s=0.875;
}
if (RobotMap.JS1.getRawButton(1)) {
s=1;
}
RobotMap.DT.tankDrive(RobotMap.JS1.getRawAxis(5)*s,RobotMap.JS1.getRawAxis(1)*s);
if (RobotMap.JS1.getRawAxis(2)>=0.2) {
fa=-0.871;
}
else if (RobotMap.JS1.getRawButton(5)) {
fa=0.6;
}
else {
fa=0;
}
RobotMap.FD.tankDrive(fa,0);
if (RobotMap.JS1.getRawAxis(3)>=0.2) {
RobotMap.Tounge.set(RobotMap.Forward);
}
if (RobotMap.JS1.getRawButton(6)) {
RobotMap.Tounge.set(RobotMap.Backward);
}
}
}
package org.usfirst.frc7117.BaseV3.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc7117.BaseV3.Robot;
import org.usfirst.frc7117.BaseV3.RobotMap;
public class AutonomousCommand extends Command {
double TT;
int mode;
public AutonomousCommand() {
}
@Override
protected void initialize() {
TT=RobotMap.T.get()+7;
mode=1;
}
@Override
protected void execute() {
if (mode==1) {
RobotMap.DT.tankDrive(-0.55,-0.55);
if (RobotMap.T.get()>=TT) {
mode=2;
TT=RobotMap.T.get()+0.95;
}
}
if (mode==2) {
RobotMap.DT.tankDrive(-0.55,0.55);
if (RobotMap.T.get()>=TT)
mode=3;
}
}
@Override
protected boolean isFinished() {
if (mode==3) {
return true;
}
return false;
}
@Override
protected void end() {
}
@Override
protected void interrupted() {
}
}