diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index dd4b24d..3aab2e4 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -1,8 +1,17 @@ package org.usfirst.frc4904.robot; +import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj2.command.Subsystem; + +import org.usfirst.frc4904.standard.custom.PCMPort; import org.usfirst.frc4904.standard.custom.controllers.CustomJoystick; import org.usfirst.frc4904.standard.custom.controllers.CustomXbox; +import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonFX; +import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonSRX; +import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem.SolenoidState; +import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem; +import org.usfirst.frc4904.standard.subsystems.motor.Motor; + public class RobotMap { public static class Port { @@ -12,6 +21,9 @@ public static class HumanInput { } public static class CANMotor { + public static final int AXLE_INTAKE_MOTOR = -1; //TODO: set port for axel intake motor + public static final int SECONDARY_INTAKE_MOTOR = -1; //TODO: set port for axel intake motor + } public static class PWM { @@ -21,6 +33,7 @@ public static class CAN { } public static class Pneumatics { + public static final PCMPort DRAWBRIDGE_INTAKE_SOLENOID = new PCMPort(-1, PneumaticsModuleType.CTREPCM, -1, -1); //TODO: set port for drawbridge intake solenoid } public static class Digital { @@ -51,6 +64,9 @@ public static class Turn { } public static class Component { + public static Motor intakeAxleMotor; + public static Motor intakeSecondaryMotor; + public static SolenoidSubsystem intakeDrawbridgeSolenoid; } public static class Input { @@ -70,5 +86,9 @@ public RobotMap() { HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController); HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick); + Component.intakeDrawbridgeSolenoid = new SolenoidSubsystem("Intake Drawbridge Solenoid", false, SolenoidState.RETRACT, Port.Pneumatics.DRAWBRIDGE_INTAKE_SOLENOID.buildDoubleSolenoid()); + Component.intakeAxleMotor = new Motor("Intake Motor", false, new CANTalonFX(Port.CANMotor.AXLE_INTAKE_MOTOR)); //TODO: check if CANTalonFX or SRX + Component.intakeSecondaryMotor = new Motor("Intake Secondary Motor", false, new CANTalonFX(Port.CANMotor.SECONDARY_INTAKE_MOTOR)); //TODO: check if CANTalonFX or SRX + } } \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/intake/AxleIntakeOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/intake/AxleIntakeOff.java new file mode 100644 index 0000000..3e71499 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/intake/AxleIntakeOff.java @@ -0,0 +1,13 @@ +package org.usfirst.frc4904.robot.commands.intake; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorIdle; + +/** + * Stops rotating axle + */ +public class AxleIntakeOff extends MotorIdle { + public AxleIntakeOff() { + super("axleIntakeOff", RobotMap.Component.intakeAxleMotor); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/intake/AxleIntakeOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/intake/AxleIntakeOn.java new file mode 100644 index 0000000..393d03d --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/intake/AxleIntakeOn.java @@ -0,0 +1,14 @@ +package org.usfirst.frc4904.robot.commands.intake; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; + +/** + * Rotates the axle to intake the ball + */ +public class AxleIntakeOn extends MotorConstant { + public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.5; //TODO: needs value + public AxleIntakeOn() { + super("axleIntakeOn", RobotMap.Component.intakeAxleMotor, DEFAULT_INTAKE_MOTOR_SPEED); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/intake/ExtendIntake.java b/src/main/java/org/usfirst/frc4904/robot/commands/intake/ExtendIntake.java new file mode 100644 index 0000000..e792791 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/intake/ExtendIntake.java @@ -0,0 +1,13 @@ +package org.usfirst.frc4904.robot.commands.intake; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.solenoid.SolenoidExtend; + +/** + * Extends the drawbridge which has the intake mechanism attached to it. + */ +public class ExtendIntake extends SolenoidExtend { + public ExtendIntake() { + super("extendIntakeDrawbridge", RobotMap.Component.intakeDrawbridgeSolenoid); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/intake/RetractIntake.java b/src/main/java/org/usfirst/frc4904/robot/commands/intake/RetractIntake.java new file mode 100644 index 0000000..bec8e36 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/intake/RetractIntake.java @@ -0,0 +1,13 @@ +package org.usfirst.frc4904.robot.commands.intake; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.solenoid.SolenoidRetract; + +/** + * Retracts the drawbridge which has the intake mechanism attached to it. + */ +public class RetractIntake extends SolenoidRetract { + public RetractIntake() { + super("retractIntakeDrawbridge", RobotMap.Component.intakeDrawbridgeSolenoid); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/intake/SecondaryIntakeOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/intake/SecondaryIntakeOff.java new file mode 100644 index 0000000..923ec80 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/intake/SecondaryIntakeOff.java @@ -0,0 +1,13 @@ +package org.usfirst.frc4904.robot.commands.intake; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorIdle; + +/** + * Stops rotating motor + */ +public class SecondaryIntakeOff extends MotorIdle { + public SecondaryIntakeOff() { + super("secondaryIntakeOff", RobotMap.Component.intakeSecondaryMotor); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/intake/SecondaryIntakeOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/intake/SecondaryIntakeOn.java new file mode 100644 index 0000000..1d53ac3 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/intake/SecondaryIntakeOn.java @@ -0,0 +1,14 @@ +package org.usfirst.frc4904.robot.commands.intake; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; + +/** + * Rotates the motor to intake the ball + */ +public class SecondaryIntakeOn extends MotorConstant { + public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.5; //TODO: needs value + public SecondaryIntakeOn() { + super("SecondaryIntakeOn", RobotMap.Component.intakeSecondaryMotor, DEFAULT_INTAKE_MOTOR_SPEED); + } +} \ No newline at end of file