Skip to content

Commit

Permalink
Merge branch 'main' into 122-Add-Linked-waypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeistHo committed Jan 30, 2024
2 parents f6d761a + a8e3d80 commit 4fe618d
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ public class ClimbConstants { //TODO: find real values
public static final double CLIMB_PID_SETPOINT_EXTENDED = 10; //TODO: find real values
public static final double CLIMB_PID_SETPOINT_RETRACTED = 0;
public static final double CLIMB_EXTENSION_TOLERANCE = 0;

public static final double CLIMB_TEST_POWER = .1;
}

public class LEDsConstants {
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/frc/robot/command/tests/ClimbSystemTest.java
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 src/main/java/frc/robot/command/tests/testCommands/ClimbTest.java
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;
}
}

0 comments on commit 4fe618d

Please sign in to comment.