-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
535c432
commit 3548b59
Showing
6 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
comp/src/main/java/org/team100/frc2024/Climber/Climber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
|
||
package org.team100.frc2024.Climber; | ||
|
||
import com.ctre.phoenix6.configs.CurrentLimitsConfigs; | ||
import com.ctre.phoenix6.configs.TalonFXConfigurator; | ||
import com.ctre.phoenix6.hardware.TalonFX; | ||
import com.ctre.phoenix6.signals.NeutralModeValue; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class Climber extends SubsystemBase { | ||
/** Creates a new Climber. */ | ||
|
||
TalonFX climberMotor = new TalonFX(2); | ||
|
||
|
||
CurrentLimitsConfigs currentConfigs = new CurrentLimitsConfigs(); | ||
TalonFXConfigurator talonFXConfigurator = climberMotor.getConfigurator(); | ||
|
||
|
||
|
||
public Climber() { | ||
climberMotor.setNeutralMode(NeutralModeValue.Brake); | ||
// currentConfigs.SupplyCurrentLimit = 10.0; | ||
// currentConfigs.SupplyCurrentLimitEnable = true; | ||
currentConfigs.StatorCurrentLimit = 50.0; | ||
currentConfigs.StatorCurrentLimitEnable = true; | ||
talonFXConfigurator.apply(currentConfigs); | ||
|
||
} | ||
|
||
public void setDutyCycle(double dutyCycle) { | ||
climberMotor.set(dutyCycle); | ||
} | ||
|
||
@Override | ||
public void periodic() { | ||
// This method will be called once per scheduler run | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
comp/src/main/java/org/team100/frc2024/Climber/ClimberRotate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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 org.team100.frc2024.Climber; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import edu.wpi.first.math.geometry.Translation2d; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
|
||
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | ||
public class ClimberRotate extends Command { | ||
/** Creates a new ClimberRotate. */ | ||
Climber climber; | ||
double duty; | ||
Supplier<Double> m_joystick; | ||
|
||
public ClimberRotate(Climber c, double d, Supplier<Double> joystick) { | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
climber = c; | ||
duty = d; | ||
m_joystick = joystick; | ||
addRequirements(climber); | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() {} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
climber.setDutyCycle(m_joystick.get()); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
climber.setDutyCycle(0); | ||
|
||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters