Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified gradlew
100644 → 100755
Empty file.
49 changes: 49 additions & 0 deletions src/main/java/frc/robot/subsystems/Climber/Climber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package frc.robot.subsystems.climber;

import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.spark.SparkClosedLoopController;
import com.revrobotics.spark.config.SparkMaxConfig;
import com.revrobotics.spark.SparkBase.PersistMode;
import com.revrobotics.spark.SparkBase.ResetMode;
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
import com.revrobotics.spark.SparkBase.ControlType;

public class Climber extends SubsystemBase {
private static final double DEPLOY_POSITION = 3.00; // Change this value as needed (Unit is rotations)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are constants, so they should go in Constants.java.

private static final double RETRACT_POSITION = 0.00; // Change this value as needed (Unit is rotations)
private final SparkMax climberMotor;
private final RelativeEncoder climberEncoder;
private final SparkClosedLoopController climberController;

public Climber(int ClimberMotorID) {
//Motor initialization
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are only for when the code can't explain itself; this code can explain itself. Additionally, there should be a space after the //.

this.climberMotor = new SparkMax(ClimberMotorID, MotorType.kBrushless);
//Encoder initialization
climberEncoder = climberMotor.getEncoder();
climberEncoder.setPosition(0.0);

//Closed loop controller initialization
climberController = climberMotor.getClosedLoopController();

SparkMaxConfig config = new SparkMaxConfig();
config.smartCurrentLimit(20); //20 amps
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current limit should go in constants; default should be ~40 amps.

config.idleMode(IdleMode.kBrake);
climberMotor.configure(config, ResetMode.kResetSafeParameters, PersistMode.kNoPersistParameters); // Note to set PID in this line
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to kPersistParameters.

}

public void gotoPOS(double position) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goToPos, if you're going with this naming. However, note that that's not actually what you're doing; you're setting the position reference.

climberController.setReference(position, ControlType.kPosition);
}


public void deploy() {
gotoPOS(DEPLOY_POSITION);
}

public void retract() {
gotoPOS(RETRACT_POSITION);
}
}
12 changes: 6 additions & 6 deletions vendordeps/photonlib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "photonlib.json",
"name": "photonlib",
"version": "v2026.1.1-rc-4",
"version": "v2026.1.1",
"uuid": "515fe07e-bfc6-11fa-b3de-0242ac130004",
"frcYear": "2026",
"mavenUrls": [
Expand All @@ -13,7 +13,7 @@
{
"groupId": "org.photonvision",
"artifactId": "photontargeting-cpp",
"version": "v2026.1.1-rc-4",
"version": "v2026.1.1",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
Expand All @@ -28,7 +28,7 @@
{
"groupId": "org.photonvision",
"artifactId": "photonlib-cpp",
"version": "v2026.1.1-rc-4",
"version": "v2026.1.1",
"libName": "photonlib",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -43,7 +43,7 @@
{
"groupId": "org.photonvision",
"artifactId": "photontargeting-cpp",
"version": "v2026.1.1-rc-4",
"version": "v2026.1.1",
"libName": "photontargeting",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -60,12 +60,12 @@
{
"groupId": "org.photonvision",
"artifactId": "photonlib-java",
"version": "v2026.1.1-rc-4"
"version": "v2026.1.1"
},
{
"groupId": "org.photonvision",
"artifactId": "photontargeting-java",
"version": "v2026.1.1-rc-4"
"version": "v2026.1.1"
}
]
}