Skip to content

Commit ea18e73

Browse files
authored
Merge branch 'master' into remove-sparkmax-unplugged-handler
2 parents f9235ed + 9547d55 commit ea18e73

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
release:
10+
name: Release Tag
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Create Release
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
tag: ${{ github.ref_name }}
19+
run: |
20+
gh release create "$tag" --repo="$GITHUB_REPOSITORY" --title="$tag" --generate-notes

src/main/java/org/carlmontrobotics/lib199/CachedSparkMax.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.revrobotics.RelativeEncoder;
55
import com.revrobotics.SparkMaxPIDController;
66

7+
@Deprecated
78
public class CachedSparkMax extends CANSparkMax {
89

910
private RelativeEncoder encoder;

src/main/java/org/carlmontrobotics/lib199/MotorControllerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static CANSparkMax createSparkMax(int id, int temperatureLimit) {
120120
public static CANSparkMax createSparkMax(int id, MotorConfig config) {
121121
CANSparkMax spark;
122122
if (RobotBase.isReal()) {
123-
spark = new CachedSparkMax(id, CANSparkMaxLowLevel.MotorType.kBrushless);
123+
spark = new CANSparkMax(id, CANSparkMaxLowLevel.MotorType.kBrushless);
124124
} else {
125125
spark = MockSparkMax.createMockSparkMax(id, CANSparkMaxLowLevel.MotorType.kBrushless);
126126
}

src/main/java/org/carlmontrobotics/lib199/path/RobotPath.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ public Command getPathCommand(boolean faceInPathDirection, boolean stopAtEnd) {
8585
if (trajectory == null) {
8686
generateTrajectory();
8787
}
88-
hs.reset();
8988
// We want the robot to stay facing the same direction (in this case), so save
9089
// the current heading (make sure to update at the start of the command)
9190
AtomicReference<Rotation2d> headingRef = new AtomicReference<>(dt.getPose().getRotation());
9291
Supplier<Rotation2d> desiredHeading = (!faceInPathDirection) ? () -> headingRef.get() : () -> hs.sample();
9392
Command command = dt.createAutoCommand(trajectory, desiredHeading);
93+
command = new InstantCommand(hs::reset).andThen(command, new InstantCommand(hs::stop));
9494
if (stopAtEnd) {
9595
command = command.andThen(new InstantCommand(dt::stop, dt));
9696
}
@@ -310,5 +310,13 @@ public void reset() {
310310
timerStarted = false;
311311
timer.reset();
312312
}
313+
314+
/**
315+
* Stops the timer
316+
*/
317+
public void stop() {
318+
timer.stop();
319+
reset();
320+
}
313321
}
314322
}

0 commit comments

Comments
 (0)