Skip to content

Commit

Permalink
fix indenting and remove template code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr1tzBot committed Jan 29, 2024
1 parent 5a15828 commit b891440
Showing 1 changed file with 47 additions and 58 deletions.
105 changes: 47 additions & 58 deletions src/main/java/frc/robot/subsystems/Climber.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
}
}

0 comments on commit b891440

Please sign in to comment.