-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic bindings to wear in offseason elevator geras
- Loading branch information
Showing
3 changed files
with
65 additions
and
153 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.CommandBase; | ||
import frc.robot.subsystems.ElevatorTestSubsystem; | ||
|
||
public class TestElevatorCommand extends CommandBase { | ||
|
||
private ElevatorTestSubsystem subsystem; | ||
private double power = 0; | ||
public TestElevatorCommand(ElevatorTestSubsystem subsys, double motorPower) { | ||
subsystem = subsys; | ||
|
||
power = motorPower; | ||
|
||
addRequirements(subsystem); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
subsystem.setMotorPower(power); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
subsystem.setMotorPower(0); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/frc/robot/subsystems/ElevatorTestSubsystem.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,30 @@ | ||
package frc.robot.subsystems; | ||
|
||
import com.ctre.phoenix.motorcontrol.ControlMode; | ||
import com.ctre.phoenix.motorcontrol.can.TalonFX; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class ElevatorTestSubsystem extends SubsystemBase { | ||
|
||
private TalonFX testMotor, testMotor2; | ||
|
||
private double motorPower = 0; | ||
|
||
public ElevatorTestSubsystem() { | ||
testMotor = new TalonFX(1000); | ||
testMotor2 = new TalonFX(1001); //FIXME Placeholder | ||
|
||
} | ||
|
||
|
||
public void setMotorPower(double power) { | ||
motorPower = power; | ||
} | ||
|
||
@Override | ||
public void periodic() { | ||
testMotor.set(ControlMode.PercentOutput, motorPower); | ||
testMotor2.set(ControlMode.PercentOutput, motorPower); | ||
} | ||
} |