generated from Frc5572/Java-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
9acf39f
commit 2f30d3f
Showing
9 changed files
with
238 additions
and
236 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
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,57 @@ | ||
package frc.lib.sim; | ||
|
||
import edu.wpi.first.util.sendable.Sendable; | ||
import edu.wpi.first.util.sendable.SendableBuilder; | ||
import edu.wpi.first.wpilibj.motorcontrol.MotorController; | ||
|
||
public class TalonFX implements MotorController, Sendable, AutoCloseable { | ||
Check warning on line 7 in src/main/java/frc/lib/sim/TalonFX.java GitHub Actions / Linting
|
||
|
||
public TalonFX(int deviceId, String canbus) { | ||
|
||
} | ||
|
||
public TalonFX(int deviceId) { | ||
this(deviceId, "*"); | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
throw new UnsupportedOperationException("Unimplemented method 'close'"); | ||
} | ||
|
||
@Override | ||
public void initSendable(SendableBuilder builder) { | ||
throw new UnsupportedOperationException("Unimplemented method 'initSendable'"); | ||
} | ||
|
||
@Override | ||
public void set(double speed) { | ||
throw new UnsupportedOperationException("Unimplemented method 'set'"); | ||
} | ||
|
||
@Override | ||
public double get() { | ||
throw new UnsupportedOperationException("Unimplemented method 'get'"); | ||
} | ||
|
||
@Override | ||
public void setInverted(boolean isInverted) { | ||
throw new UnsupportedOperationException("Unimplemented method 'setInverted'"); | ||
} | ||
|
||
@Override | ||
public boolean getInverted() { | ||
throw new UnsupportedOperationException("Unimplemented method 'getInverted'"); | ||
} | ||
|
||
@Override | ||
public void disable() { | ||
throw new UnsupportedOperationException("Unimplemented method 'disable'"); | ||
} | ||
|
||
@Override | ||
public void stopMotor() { | ||
throw new UnsupportedOperationException("Unimplemented method 'stopMotor'"); | ||
} | ||
|
||
} |
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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
package frc.tools; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.StandardOpenOption; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import frc.tools.modify.ClassTransformer; | ||
import frc.tools.modify.SimReplace; | ||
|
||
/** Class file modifier that adds profiling commands, replaces hardware in sim mode. */ | ||
public class ModifyClasses { | ||
|
||
/** Entrypoint */ | ||
public static void main(String[] args) throws IOException { | ||
ClassTransformer transformer = new ClassTransformer(); | ||
if (true) { | ||
transformer.add(SimReplace::new); | ||
} | ||
|
||
List<Path> result; | ||
try (Stream<Path> walk = Files.walk(Path.of("build/classes/java/main"))) { | ||
result = walk.filter(Files::isRegularFile) | ||
.filter(p -> p.getFileName().toString().endsWith(".class")) | ||
.filter(p -> !p.getFileName().toString().endsWith("Robot$1.class")) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
for (Path p : result) { | ||
byte[] input = Files.readAllBytes(p); | ||
byte[] output = transformer.transform(input); | ||
Files.write(p, output, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.