diff --git a/src/main/java/frc4388/robot/RobotMap.java b/src/main/java/frc4388/robot/RobotMap.java index 08fcc1a..041cc7e 100644 --- a/src/main/java/frc4388/robot/RobotMap.java +++ b/src/main/java/frc4388/robot/RobotMap.java @@ -31,10 +31,10 @@ public class RobotMap { public SwerveModule leftBack; public SwerveModule rightBack; - public RobotMap() { configureLEDMotorControllers(); configureDriveMotors(); + configArmMotors(); } /* LED Subsystem */ @@ -128,4 +128,22 @@ public class RobotMap { this.rightBack = new SwerveModule(rightBackWheel, rightBackSteer, rightBackEncoder, SwerveDriveConstants.Configurations.RIGHT_BACK_ENCODER_OFFSET); } + + // arm stuff + public WPI_TalonFX pivot = new WPI_TalonFX(-1); // TODO: Add real id + public WPI_TalonFX tele = new WPI_TalonFX(-1); // TODO: Add real id + + public void configArmMotors() { + // config factory default + pivot.configFactoryDefault(); + tele.configFactoryDefault(); + + // config open loop ramp + pivot.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS); + tele.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS); + + // config closed loop ramp + pivot.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS); + tele.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS); + } } diff --git a/src/main/java/frc4388/robot/subsystems/Arm.java b/src/main/java/frc4388/robot/subsystems/Arm.java new file mode 100644 index 0000000..85e8860 --- /dev/null +++ b/src/main/java/frc4388/robot/subsystems/Arm.java @@ -0,0 +1,33 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc4388.robot.subsystems; + +import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class Arm extends SubsystemBase { + /** Creates a new Arm. */ + private WPI_TalonFX pivot; + private WPI_TalonFX tele; + + public Arm(WPI_TalonFX pivot, WPI_TalonFX tele) { + this.pivot = pivot; + this.tele = tele; + } + + public void runPivot(double output) { + pivot.set(output); + } + + public void runTelescope(double output) { + tele.set(output); + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +}