Skip to content

Commit

Permalink
added javadoc to subsystems and ShooterCalc
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-Cushman committed Jan 24, 2024
1 parent 30f2c23 commit 1990c43
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/main/java/frc/robot/subsystems/shooter/Pivot.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,23 @@ public void setRestAngle() {
this.setAngle(ShooterConstants.PIVOT_REST_ANGLE);
}

/**
* The function is a command that sets the rotation of the pivot to
* a default resting position
*
* @return The method is returning a Command object.
*/
public Command setRestAngleCommand() {
return setAngleCommand(ShooterConstants.PIVOT_REST_ANGLE);
}

/**
* Determines if the pivot rotation is at its target with a small
* tolerance
*
* @return The method is returning a BooleanSupplier that returns true
* if the pivot is at its target rotation and false otherwise
*/
public BooleanSupplier atDesiredAngle() {
return () ->
(MathUtil.applyDeadband(
Expand All @@ -80,6 +93,11 @@ public BooleanSupplier atDesiredAngle() {
ShooterConstants.PIVOT_DEADBAND) == 0);
}

/**
* The function is a command that stops the motor
*
* @return The method is returning a Command object.
*/
public Command stop() {
return runOnce(() -> pivot.stopMotor());
}
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/frc/robot/subsystems/shooter/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,47 @@ public void periodic() {
// This method will be called once per scheduler run
}

/**
* The function sets both of the motors to a targetVelocity that is
* the speed provided
*
* @param speed A double representing the speed the motors should be set to
*/
public void setSpeed(double speed) {
motorLeft.setTargetVelocity(speed);
}

/**
* The function is a command that sets the motor speed for both motors
* to the speed provided
*
* @param speed A double representing the speed the motors should be set to
*
* @return The method is returning a Command object.
*/
public Command setSpeedCommand(double speed) {
return Commands.runOnce(() -> setSpeed(speed));
}

/**
* The function is a command that stops both motors
*
* @return The method is returning a Command object.
*/
public Command stop() {
return setSpeedCommand(0);
return Commands.runOnce(() -> motorLeft.stopMotor());
}

//TODO: Implement a way to get the RPM of the shooter
/**
* The function is a BooleanSupplier that represents the the condition of
* the velocity of the motor being equal to its targetVelocity
*
*
* @return The method is returning a BooleanSupplier that returns true if
* the current velocity of the motors is at the target velocity with a
* small tolerance
*/
public BooleanSupplier atDesiredRPM() {
return () ->
(MathUtil.applyDeadband(
Expand Down

0 comments on commit 1990c43

Please sign in to comment.