Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
chore: Format.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Apr 25, 2024
1 parent f19e0b6 commit ae6219e
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 168 deletions.
120 changes: 60 additions & 60 deletions src/main/java/frc/lib/config/AbsoluteEncoderConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,72 @@
/** Absolute encoder config. */
public class AbsoluteEncoderConfig {

/** Interpret counterclockwise rotation on the encoder as having positive velocity. */
private boolean ccwPositive = true;
/** Interpret counterclockwise rotation on the encoder as having positive velocity. */
private boolean ccwPositive = true;

/** Ratio between the absolute encoder and the mechanism. */
private double sensorToMechanismRatio = 1.0;
/** Ratio between the absolute encoder and the mechanism. */
private double sensorToMechanismRatio = 1.0;

/** Offset between absolute encoder reading and mechanism position. */
private Rotation2d offset = new Rotation2d();
/** Offset between absolute encoder reading and mechanism position. */
private Rotation2d offset = new Rotation2d();

/**
* Modifies this absolute encoder config's counterclockwise positive.
*
* @param ccwPositive the counterclockwise positive.
* @return this absolute encoder config.
*/
public AbsoluteEncoderConfig withCCWPositive(boolean ccwPositive) {
this.ccwPositive = ccwPositive;
return this;
}
/**
* Modifies this absolute encoder config's counterclockwise positive.
*
* @param ccwPositive the counterclockwise positive.
* @return this absolute encoder config.
*/
public AbsoluteEncoderConfig withCCWPositive(boolean ccwPositive) {
this.ccwPositive = ccwPositive;
return this;
}

/**
* Modifies this absolute encoder config's sensor to mechanism ratio.
*
* @param sensorToMechanismRatio the sensor to mechanism ratio.
* @return this absolute encoder config.
*/
public AbsoluteEncoderConfig withSensorToMechanismRatio(double sensorToMechanismRatio) {
this.sensorToMechanismRatio = sensorToMechanismRatio;
return this;
}
/**
* Modifies this absolute encoder config's sensor to mechanism ratio.
*
* @param sensorToMechanismRatio the sensor to mechanism ratio.
* @return this absolute encoder config.
*/
public AbsoluteEncoderConfig withSensorToMechanismRatio(double sensorToMechanismRatio) {
this.sensorToMechanismRatio = sensorToMechanismRatio;
return this;
}

/**
* Modifies this absolute encoder config's offset.
*
* @param offset the offset.
* @return this absolute encoder config.
*/
public AbsoluteEncoderConfig withOffset(Rotation2d offset) {
this.offset = offset;
return this;
}
/**
* Modifies this absolute encoder config's offset.
*
* @param offset the offset.
* @return this absolute encoder config.
*/
public AbsoluteEncoderConfig withOffset(Rotation2d offset) {
this.offset = offset;
return this;
}

/**
* Returns true if the absolute encoder is counterclockwise positive.
*
* @return true if the absolute encoder is counterclockwise positive.
*/
public boolean ccwPositive() {
return ccwPositive;
}
/**
* Returns true if the absolute encoder is counterclockwise positive.
*
* @return true if the absolute encoder is counterclockwise positive.
*/
public boolean ccwPositive() {
return ccwPositive;
}

/**
* Returns the absolute encoder sensor to mechanism ratio.
*
* @return the absolute encoder sensor to mechanism ratio.
*/
public double sensorToMechanismRatio() {
return sensorToMechanismRatio;
}
/**
* Returns the absolute encoder sensor to mechanism ratio.
*
* @return the absolute encoder sensor to mechanism ratio.
*/
public double sensorToMechanismRatio() {
return sensorToMechanismRatio;
}

/**
* Returns the absolute encoder offset.
*
* @return the absolute encoder offset.
*/
public Rotation2d offset() {
return offset;
}
/**
* Returns the absolute encoder offset.
*
* @return the absolute encoder offset.
*/
public Rotation2d offset() {
return offset;
}
}
20 changes: 10 additions & 10 deletions src/main/java/frc/lib/config/FeedbackControllerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,45 +92,45 @@ public PIDController createPIDController() {

/**
* Returns the feedback controller proportional gain.
*
*
* @return the feedback controller proportional gain.
*/
*/
public double kP() {
return kP;
}

/**
* Returns the feedback controller integral gain.
*
*
* @return the feedback controller integral gain.
*/
*/
public double kI() {
return kI;
}

/**
* Returns the feedback controller derivative gain.
*
*
* @return the feedback controller derivative gain.
*/
*/
public double kD() {
return kD;
}

/**
* Returns the feedback controller position tolerance.
*
*
* @return the feedback controller position tolerance.
*/
*/
public double kPositionTolerance() {
return kPositionTolerance;
}

/**
* Returns the feedback controller velocity tolerance.
*
*
* @return the feedback controller velocity tolerance.
*/
*/
public double kVelocityTolerance() {
return kVelocityTolerance;
}
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/frc/lib/config/FeedforwardControllerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public ArmFeedforward createArmFeedforward() {

/**
* Returns the feedforward controller static gain.
*
*
* @return the feedforward controller static gain.
*/
public double kS() {
Expand All @@ -94,7 +94,7 @@ public double kS() {

/**
* Returns the feedforward controller gravity gain.
*
*
* @return the feedforward controller gravity gain.
*/
public double kG() {
Expand All @@ -103,7 +103,7 @@ public double kG() {

/**
* Returns the feedforward controller velocity gain.
*
*
* @return the feedforward controller velocity gain.
*/
public double kV() {
Expand All @@ -112,11 +112,10 @@ public double kV() {

/**
* Returns the feedforward controller acceleration gain.
*
*
* @return the feedforward controller acceleration gain.
*/
public double kA() {
return kA;
}

}
7 changes: 3 additions & 4 deletions src/main/java/frc/lib/config/MechanismConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MechanismConfig {

/**
* Modifies this mechanism config to use the absolute encoder config.
*
*
* @param absoluteEncoderConfig the absolute encoder config.
* @return this mechanism config.
*/
Expand All @@ -43,15 +43,14 @@ public MechanismConfig withFeedback(FeedbackControllerConfig feedbackControllerC
* @param feedforwardControllerConfig the feedforward controller config.
* @return this mechanism config.
*/
public MechanismConfig withFeedforward(
FeedforwardControllerConfig feedforwardControllerConfig) {
public MechanismConfig withFeedforward(FeedforwardControllerConfig feedforwardControllerConfig) {
this.feedforward = feedforwardControllerConfig;
return this;
}

/**
* Modifies this mechanism config to use the motor config.
*
*
* @param motorConfig the motor config.
* @return this mechanism config.
*/
Expand Down
Loading

0 comments on commit ae6219e

Please sign in to comment.