From b891440df9fb1addad10069bad9cef7b0c707568 Mon Sep 17 00:00:00 2001 From: Fritz Geib Date: Sun, 28 Jan 2024 19:01:04 -0500 Subject: [PATCH] fix indenting and remove template code --- .../java/frc/robot/subsystems/Climber.java | 105 ++++++++---------- 1 file changed, 47 insertions(+), 58 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/Climber.java b/src/main/java/frc/robot/subsystems/Climber.java index 89639d22..d1741ef0 100644 --- a/src/main/java/frc/robot/subsystems/Climber.java +++ b/src/main/java/frc/robot/subsystems/Climber.java @@ -1,7 +1,3 @@ -// 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 frc.robot.subsystems; import com.ctre.phoenix6.hardware.TalonFX; @@ -13,58 +9,51 @@ import frc.thunder.shuffleboard.LightningShuffleboard; public class Climber extends SubsystemBase { - /** Creates a new Climb. */ - - // create variables - public TalonFX climbMotorR; - public TalonFX climbMotorL; - public double setPoint; - - public Climber() { - // configure climb motors - climbMotorR = FalconConfig.createMotor(CAN.CLIMB_RIGHT, CAN.CANBUS_FD, - ClimbConstants.CLIMB_RIGHT_MOTOR_INVERT, - ClimbConstants.CLIMB_MOTOR_SUPPLY_CURRENT_LIMIT, - ClimbConstants.CLIMB_MOTOR_STATOR_CURRENT_LIMIT, - ClimbConstants.FLYWHEEL_MOTOR_NEUTRAL_MODE, ClimbConstants.CLIMB_MOTOR_KP, - ClimbConstants.CLIMB_MOTOR_KI, ClimbConstants.CLIMB_MOTOR_KD, - ClimbConstants.CLIMB_MOTOR_KS, ClimbConstants.CLIMB_MOTOR_KV); - climbMotorL = FalconConfig.createMotor(CAN.CLIMB_LEFT, CAN.CANBUS_FD, - ClimbConstants.CLIMB_LEFT_MOTOR_INVERT, - ClimbConstants.CLIMB_MOTOR_SUPPLY_CURRENT_LIMIT, - ClimbConstants.CLIMB_MOTOR_STATOR_CURRENT_LIMIT, - ClimbConstants.FLYWHEEL_MOTOR_NEUTRAL_MODE, ClimbConstants.CLIMB_MOTOR_KP, - ClimbConstants.CLIMB_MOTOR_KI, ClimbConstants.CLIMB_MOTOR_KD, - ClimbConstants.CLIMB_MOTOR_KS, ClimbConstants.CLIMB_MOTOR_KV); - - LightningShuffleboard.setDoubleSupplier("Climb", "Height", () -> getHeight()); - } - - /** - * sets power to both climb motors - * @param power - */ - public void setPower(double power) { - climbMotorR.set(power); - climbMotorL.set(power); - } - - /** - * stops all climb motors - */ - public void stopClimb(){ - setPower(0); - } - - /** - * @return height of climb - */ - public double getHeight(){ - return climbMotorR.getRotorPosition().getValueAsDouble(); // TODO: check if returns correct height value - } - - @Override - public void periodic() { - // This method will be called once per scheduler run - } + // create variables + public TalonFX climbMotorR; + public TalonFX climbMotorL; + public double setPoint; + + public Climber() { + // configure climb motors + climbMotorR = FalconConfig.createMotor(CAN.CLIMB_RIGHT, CAN.CANBUS_FD, + ClimbConstants.CLIMB_RIGHT_MOTOR_INVERT, + ClimbConstants.CLIMB_MOTOR_SUPPLY_CURRENT_LIMIT, + ClimbConstants.CLIMB_MOTOR_STATOR_CURRENT_LIMIT, + ClimbConstants.FLYWHEEL_MOTOR_NEUTRAL_MODE, ClimbConstants.CLIMB_MOTOR_KP, + ClimbConstants.CLIMB_MOTOR_KI, ClimbConstants.CLIMB_MOTOR_KD, + ClimbConstants.CLIMB_MOTOR_KS, ClimbConstants.CLIMB_MOTOR_KV); + climbMotorL = FalconConfig.createMotor(CAN.CLIMB_LEFT, CAN.CANBUS_FD, + ClimbConstants.CLIMB_LEFT_MOTOR_INVERT, + ClimbConstants.CLIMB_MOTOR_SUPPLY_CURRENT_LIMIT, + ClimbConstants.CLIMB_MOTOR_STATOR_CURRENT_LIMIT, + ClimbConstants.FLYWHEEL_MOTOR_NEUTRAL_MODE, ClimbConstants.CLIMB_MOTOR_KP, + ClimbConstants.CLIMB_MOTOR_KI, ClimbConstants.CLIMB_MOTOR_KD, + ClimbConstants.CLIMB_MOTOR_KS, ClimbConstants.CLIMB_MOTOR_KV); + + LightningShuffleboard.setDoubleSupplier("Climb", "Height", () -> getHeight()); + } + + /** + * sets power to both climb motors + * @param power + */ + public void setPower(double power) { + climbMotorR.set(power); + climbMotorL.set(power); + } + + /** + * stops all climb motors + */ + public void stopClimb(){ + setPower(0); + } + + /** + * @return height of climb + */ + public double getHeight(){ + return climbMotorR.getRotorPosition().getValueAsDouble(); // TODO: check if returns correct height value + } }