Create Presets

This commit is contained in:
HFocus
2019-03-18 17:45:55 -06:00
parent 1b80e34cdc
commit e48da51e70
10 changed files with 271 additions and 10 deletions
@@ -7,6 +7,7 @@ import buttons.XBoxTriggerButton;
import org.usfirst.frc4388.controller.IHandController;
import org.usfirst.frc4388.controller.XboxController;
import org.usfirst.frc4388.robot.commands.*;
import org.usfirst.frc4388.robot.commands.presets.SetPositionArmWrist;
import org.usfirst.frc4388.robot.constants.LEDPatterns;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@@ -0,0 +1,41 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class CargoHigh extends CommandGroup {
/**
* Add your docs here.
*/
public CargoHigh() {
addParallel(new WristSetPositionPID(3243));
addSequential(new ArmSetPositionMM(4298));
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
@@ -0,0 +1,41 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class CargoLow extends CommandGroup {
/**
* Add your docs here.
*/
public CargoLow() {
addParallel(new WristSetPositionPID(2500));
addSequential(new ArmSetPositionMM(1388));
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
@@ -0,0 +1,41 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class CargoMid extends CommandGroup {
/**
* Add your docs here.
*/
public CargoMid() {
addParallel(new WristSetPositionPID(2830));
addSequential(new ArmSetPositionMM(2830));
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
@@ -0,0 +1,41 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class HatchHigh extends CommandGroup {
/**
* Add your docs here.
*/
public HatchHigh() {
addParallel(new WristSetPositionPID(1144));
addSequential(new ArmSetPositionMM(3605));
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
@@ -0,0 +1,41 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class HatchLow extends CommandGroup {
/**
* Add your docs here.
*/
public HatchLow() {
addParallel(new WristSetPositionPID(450));
addSequential(new ArmSetPositionMM(590));
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
@@ -0,0 +1,41 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class HatchMid extends CommandGroup {
/**
* Add your docs here.
*/
public HatchMid() {
addParallel(new WristSetPositionPID(750));
addSequential(new ArmSetPositionMM(2000));
// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.
// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.
// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
@@ -5,7 +5,10 @@
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands;
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
@@ -5,7 +5,12 @@
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4388.robot.commands;
package org.usfirst.frc4388.robot.commands.presets;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.HatchFlip;
import org.usfirst.frc4388.robot.commands.WristPlacement;
import org.usfirst.frc4388.robot.commands.WristSetPositionPID;
import edu.wpi.first.wpilibj.command.CommandGroup;
@@ -5,8 +5,14 @@ import org.usfirst.frc4388.robot.Constants;
import org.usfirst.frc4388.robot.Robot;
import org.usfirst.frc4388.robot.RobotMap;
import org.usfirst.frc4388.robot.commands.ArmSetPositionMM;
import org.usfirst.frc4388.robot.commands.SetPositionArmWrist;
import org.usfirst.frc4388.robot.commands.StowArm;
import org.usfirst.frc4388.robot.commands.presets.CargoHigh;
import org.usfirst.frc4388.robot.commands.presets.CargoLow;
import org.usfirst.frc4388.robot.commands.presets.CargoMid;
import org.usfirst.frc4388.robot.commands.presets.HatchHigh;
import org.usfirst.frc4388.robot.commands.presets.HatchLow;
import org.usfirst.frc4388.robot.commands.presets.HatchMid;
import org.usfirst.frc4388.robot.commands.presets.SetPositionArmWrist;
import org.usfirst.frc4388.robot.commands.presets.StowArm;
import org.usfirst.frc4388.utility.ControlLoopable;
import org.usfirst.frc4388.utility.Loop;
import org.usfirst.frc4388.utility.MPTalonPIDController;
@@ -283,24 +289,24 @@ public class Arm extends Subsystem implements ControlLoopable
int dPadAngle = Robot.oi.getOperatorController().getDpadAngle();
if (placeMode == PlaceMode.HATCH){
if (dPadAngle == 0 && lastDPadAngle == -1){
new SetPositionArmWrist(3605, 1144).start();
new HatchHigh().start();
}
if (dPadAngle == 90 && lastDPadAngle == -1){
new SetPositionArmWrist(2000, 750).start();
new HatchMid().start();
}
if (dPadAngle == 180 && lastDPadAngle == -1){
new SetPositionArmWrist(590, 450).start();
new HatchLow().start();
}
}
if (placeMode == PlaceMode.CARGO) {
if (dPadAngle == 0 && lastDPadAngle == -1){
new SetPositionArmWrist(4298, 3243).start();
new CargoHigh().start();
}
if (dPadAngle == 90 && lastDPadAngle == -1){
new SetPositionArmWrist(2830, 2830).start();
new CargoMid().start();
}
if (dPadAngle == 180 && lastDPadAngle == -1){
new SetPositionArmWrist(1388, 2500).start();
new CargoLow().start();
}
}