generated from wpilibsuite/vendor-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8711ec2
commit a5aae87
Showing
29 changed files
with
216 additions
and
74 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
70 changes: 70 additions & 0 deletions
70
src/main/java/swervelib/encoders/PWMDutyCycleEncoderSwerve.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,70 @@ | ||
package swervelib.encoders; | ||
|
||
import edu.wpi.first.wpilibj.DutyCycleEncoder; | ||
|
||
/** | ||
* DutyCycle encoders such as "US Digital MA3 with PWM Output, the CTRE Mag Encoder, the Rev Hex | ||
* Encoder, and the AM Mag Encoder." attached via a PWM lane. | ||
* | ||
* <p>Credits to <a | ||
* href="https://github.com/p2reneker25/2035-YAGSL/blob/main/swervelib/encoders/PWMDutyCycleEncoderSwerve.java"> | ||
* p2reneker25</a> for building this. | ||
*/ | ||
public class PWMDutyCycleEncoderSwerve extends SwerveAbsoluteEncoder { | ||
|
||
/** Duty Cycle Encoder. */ | ||
private final DutyCycleEncoder encoder; | ||
/** Inversion state. */ | ||
private boolean isInverted; | ||
|
||
/** | ||
* Constructor for the PWM duty cycle encoder. | ||
* | ||
* @param pin PWM lane for the encoder. | ||
*/ | ||
public PWMDutyCycleEncoderSwerve(int pin) { | ||
encoder = new DutyCycleEncoder(pin); | ||
} | ||
|
||
/** | ||
* Configure the inversion state of the encoder. | ||
* | ||
* @param inverted Whether the encoder is inverted. | ||
*/ | ||
@Override | ||
public void configure(boolean inverted) { | ||
isInverted = inverted; | ||
} | ||
|
||
/** | ||
* Get the absolute position of the encoder. | ||
* | ||
* @return Absolute position in degrees from [0, 360). | ||
*/ | ||
@Override | ||
public double getAbsolutePosition() { | ||
return (isInverted ? -1.0 : 1.0) * encoder.getAbsolutePosition() * 360; | ||
} | ||
|
||
/** | ||
* Get the encoder object. | ||
* | ||
* @return {@link DutyCycleEncoder} from the class. | ||
*/ | ||
@Override | ||
public Object getAbsoluteEncoder() { | ||
return encoder; | ||
} | ||
|
||
/** Reset the encoder to factory defaults. */ | ||
@Override | ||
public void factoryDefault() { | ||
// Do nothing | ||
} | ||
|
||
/** Clear sticky faults on the encoder. */ | ||
@Override | ||
public void clearStickyFaults() { | ||
// Do nothing | ||
} | ||
} |
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
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
af45abc8a3fd6fdf8b1d4a6ad5cd3953 | ||
f208f00d818c034b803165d4761bfe02 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
081b5a5bfc3916c09035bc05d4dbd15821e32131 | ||
425936e72c607e24dbc7121b95cbfa8c8260f5a8 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
5178d7973cd079217fbc37677ac1101f93ca5fcd9d9333e28076d8e9f9555668 | ||
b454c20c98fb930296b84770d5839092a664facb2e898ecb58d3ce75f356e569 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
1b28591f76f1042a8885b24e251227c55ea0a63fa135af00c48d006d7d1316ca53d4018c8bf72644749d2c5b86ec787d25aaed1f76ecc87da08b1a5fb120369e | ||
6b83b7c325dd3d2a6a72312d04980b053f81d1b33eab016c9e3d1710b52f7140e24fb2ab55a49815fc088f84db8a87d49d7ef9cb5d134af634b40c186ad0256d |
Binary file modified
BIN
+3.77 KB
(100%)
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-javadoc.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-javadoc.jar.md5
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 |
---|---|---|
@@ -1 +1 @@ | ||
c42d0787b015598645c01e7e67fdd2ed | ||
e19d633578d755be63610ef64147e6ff |
2 changes: 1 addition & 1 deletion
2
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-javadoc.jar.sha1
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 |
---|---|---|
@@ -1 +1 @@ | ||
ae08ed1d5fe08c94b0416108a3c984eb122edc32 | ||
f0ec5727e2e4d355b8cea889048762b7be07bc84 |
2 changes: 1 addition & 1 deletion
2
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-javadoc.jar.sha256
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 |
---|---|---|
@@ -1 +1 @@ | ||
99121689ad1b076d6cc126a6dfc92de66a692c03cbfad72af7034bf0ffb4a704 | ||
26f7846f6c67eb9d358fd86a04dc353da252c3624783e3281f426d1c940a256e |
2 changes: 1 addition & 1 deletion
2
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-javadoc.jar.sha512
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 |
---|---|---|
@@ -1 +1 @@ | ||
fd95e96124867d038ceaadfc8d4be1c1efac0e8fc3430babcd8898750786a734c4250b9467648d3f002390a3f959c61dd4c75ca04433848354596e81cb41afa3 | ||
9dea91131c9d63ca895785c3e6f5e74542e990bc2d25fc0ddbfc0c9537f3822117bf14a49b87f87f95ce216866dd7be6e2a85a1d0fa6eaa4606ab23a96b442cc |
Binary file modified
BIN
+1.24 KB
(100%)
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-sources.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-sources.jar.md5
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 |
---|---|---|
@@ -1 +1 @@ | ||
d8d8b7f928c4df193ff1f2d418a16472 | ||
e1142aa8a50409e62326d6b7ab8da93c |
2 changes: 1 addition & 1 deletion
2
yagsl/repos/swervelib/YAGSL-java/2023.0.6/YAGSL-java-2023.0.6-sources.jar.sha1
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 |
---|---|---|
@@ -1 +1 @@ | ||
b9255d677764b8c7da30b2ae334b1caf804a341c | ||
df195a1939eeeedc576d777da85a4da1b05a418d |
Oops, something went wrong.