-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 122-Add-Linked-waypoints
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
src/main/java/frc/robot/command/tests/ClimbSystemTest.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,27 @@ | ||
// 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.command.tests; | ||
|
||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.WaitCommand; | ||
import frc.robot.command.tests.testCommands.ClimbTest; | ||
import frc.robot.subsystems.Climber; | ||
import frc.thunder.command.TimedCommand; | ||
import frc.thunder.testing.SystemTestCommandGroup; | ||
|
||
public class ClimbSystemTest extends SystemTestCommandGroup { | ||
|
||
public ClimbSystemTest(Climber climber) { | ||
super( | ||
new SequentialCommandGroup( | ||
new WaitCommand(0.5), | ||
new TimedCommand(new ClimbTest(climber, 1), 1), // UP | ||
new WaitCommand(1), | ||
new TimedCommand(new ClimbTest(climber, -1), 1) // DOWN | ||
) | ||
); | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/frc/robot/command/tests/testCommands/ClimbTest.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 frc.robot.command.tests.testCommands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Climber; | ||
import frc.robot.Constants.ClimbConstants; | ||
|
||
public class ClimbTest extends Command { | ||
|
||
private Climber climber; | ||
private double power; | ||
|
||
/** | ||
* System test command for testing climb motors | ||
* @param climber climber subsystem | ||
* @param power power to control up or down | ||
*/ | ||
public ClimbTest(Climber climber, double power) { | ||
this.climber = climber; | ||
this.power = power; | ||
|
||
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.setPower(ClimbConstants.CLIMB_TEST_POWER * power); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
climber.setPower(0); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |