Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a12d22b
feat: create ElevatorIO
dabeycorn Aug 26, 2025
b336a19
feat: add accel arguement to setPose method (ElevatorIO)
dabeycorn Aug 26, 2025
96e13f8
feat: create empty ElevatorIO
dabeycorn Aug 26, 2025
02b5350
feat: create ElevatorState enum
dabeycorn Aug 26, 2025
9c581e5
feat: create elevator public interface
dabeycorn Aug 26, 2025
8cf37ad
fix: add elevator characterization values
dabeycorn Aug 27, 2025
2b3686a
feat: create simulated elevatorIO
dabeycorn Aug 27, 2025
58a92b6
refactor: rename ElevatorState enum to ElevatorExtension
dabeycorn Aug 28, 2025
d3d2eb9
fix: add feedforward to simulated elevator to eliminate steady-state …
dabeycorn Aug 28, 2025
57ff61c
feat: create elevator visualizer
dabeycorn Aug 28, 2025
09b7f32
deprecate elevator hold extension command because it's lowkey broken
dabeycorn Aug 28, 2025
6b75c40
fix: slow elevator sim down for realism
dabeycorn Aug 28, 2025
57b8013
feat: add an elevatorIO method for setting setpoint pose /w setpoint …
dabeycorn Aug 28, 2025
fcf3fcc
del: remove runSlowExtension commands in elevator subsystem
dabeycorn Aug 28, 2025
6f2bf61
feat: 'borrow' 1155's testUtil class
dabeycorn Aug 28, 2025
206a1b1
feat: create elevator tests
dabeycorn Aug 28, 2025
a76c91e
feat: add './gradlew test' to github build workflow
dabeycorn Aug 28, 2025
bc2cc86
chore: add jvm args for vm-profiling
dabeycorn Aug 28, 2025
b587c18
doc: final javadoc cleanup
dabeycorn Aug 28, 2025
8711dd9
del: remove elevatorIO's setPose /w accel method
dabeycorn Aug 29, 2025
e6ebad5
refactor: rename ElevatorExtension enum to ElevatorState
dabeycorn Aug 29, 2025
c73f307
feat: create ElevatorIOReal
dabeycorn Aug 29, 2025
1b3fd2b
feat: create elevator factory for initializing the elevator subsystem
dabeycorn Aug 29, 2025
9335cd8
deprecrate CANDeviceId
dabeycorn Aug 29, 2025
8a69d0e
refactor: store elevator CAN constants in subsystem class
dabeycorn Aug 29, 2025
e2bd3eb
fix: add soft limit switch for max extension height in ElevatorIOReal
dabeycorn Aug 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ jobs:
git commit -m "auto generated"
git push
- name: Build Robot Code
run: ./gradlew build
run: ./gradlew build
- name: Run Tests
run: ./gradlew test
16 changes: 12 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ deploy {
jvmArgs.add("-XX:+UseSerialGC")
jvmArgs.add("-XX:MaxGCPauseMillis=50")

// Enable VisualVM connection
jvmArgs.add("-Dcom.sun.management.jmxremote=true")
jvmArgs.add("-Dcom.sun.management.jmxremote.port=1198")
jvmArgs.add("-Dcom.sun.management.jmxremote.local.only=false")
jvmArgs.add("-Dcom.sun.management.jmxremote.ssl=false")
jvmArgs.add("-Dcom.sun.management.jmxremote.authenticate=false")
jvmArgs.add("-Djava.rmi.server.hostname=10.64.23.2")

// RIO 2.0 ONLY
final MAX_JAVA_HEAP_SIZE_MB = 100;
jvmArgs.add("-Xmx" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-Xms" + MAX_JAVA_HEAP_SIZE_MB + "M")
jvmArgs.add("-XX:+AlwaysPreTouch")
// final MAX_JAVA_HEAP_SIZE_MB = 100;
// jvmArgs.add("-Xmx" + MAX_JAVA_HEAP_SIZE_MB + "M")
// jvmArgs.add("-Xms" + MAX_JAVA_HEAP_SIZE_MB + "M")
// jvmArgs.add("-XX:+AlwaysPreTouch")
}


Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/frc6423/lib/types/CanDeviceId.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package org.frc6423.lib.types;

@Deprecated
public class CanDeviceId {
private final String busName;
private final int canId;
Expand Down
70 changes: 69 additions & 1 deletion src/main/java/org/frc6423/lib/utilities/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@

package org.frc6423.lib.utilities;

import static edu.wpi.first.units.Units.Seconds;

import edu.wpi.first.hal.AllianceStationID;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.units.measure.Time;
import edu.wpi.first.wpilibj.simulation.DriverStationSim;
import edu.wpi.first.wpilibj.simulation.SimHooks;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import org.frc6423.robot.Constants.Flags;

/** Contains static methods for creating tests */
/** Contains static methods for creating tests "Inspired" by FRC 1155 */
public class TestUtils {
/** Set up DS and initalizes HAL with default values and asserts that it doesn't fail */
public static void setupTest() {
Expand All @@ -38,4 +43,67 @@ public static void reset(AutoCloseable... subsystems) throws Exception {
subsystem.close();
}
}

/**
* Runs CommandScheduler and updates timer repeatedly to fast forward subsystems and run commands.
*
* @param ticks The number of times CommandScheduler is run
*/
public static void fastForward(int ticks) {
for (int i = 0; i < ticks; i++) {
CommandScheduler.getInstance().run();
SimHooks.stepTiming(Flags.PERIOD.in(Seconds));
}
}

/**
* Fasts forward in time by running CommandScheduler and updating timer.
*
* @param time
*/
public static void fastForward(Time time) {
fastForward((int) (time.in(Seconds) / Flags.PERIOD.in(Seconds)));
}

/**
* Runs CommandScheduler and updates timer to fast forward subsystems by 4 seconds and run
* commands.
*/
public static void fastForward() {
fastForward(Seconds.of(4));
}

/**
* Schedules and runs a command.
*
* @param command The command to run.
*/
public static void run(Command command) {
run(command, 1);
}

/**
* Schedules and runs a command.
*
* @param command The command to run.
* @param runs The number of times CommandScheduler is run.
*/
public static void run(Command command, int runs) {
command.schedule();
fastForward(runs);
}

/**
* Schedules a command and runs it until it ends. Be careful -- if the command you give never
* ends, this will be an infinite loop!
*
* @param command
*/
public static void runToCompletion(Command command) {
command.schedule();
fastForward(1);
while (command.isScheduled()) {
fastForward(1);
}
}
}
1 change: 1 addition & 0 deletions src/main/java/org/frc6423/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Flags {
}

/** Constants representing port IDs that devices are connected to */
@Deprecated
public class Ports {
// * CANIVORE LOOP
public static final CANBus CANCHAN = new CANBus("CANchan"); // :3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ public class ArmPivot extends SubsystemBase implements AutoCloseable {

private final LinearFilter pivotCurrentFilter = LinearFilter.movingAverage(5);

@Logged(name = "Filted Pivot Motor Current (Amps)")
@Logged(name = "Filted Pivot Motor Stator Current (Amps)")
private double filteredPivotCurrent;

@Logged(name = "Is Zeroed (bool)")
private boolean isZeroed = false;

private final Mechanism2d canvas =
Expand Down Expand Up @@ -78,6 +77,14 @@ public void periodic() {
Rotation2d.fromRadians(hardware.getAngleRads()).unaryMinus().rotateBy(Rotation2d.k180deg));
}

/**
* @return true if arm has been homed
*/
@Logged(name = "Is Zeroed (bool)")
public boolean isZeroed() {
return isZeroed;
}

/**
* @return true if arm is within a certain tolerance of the setpoint angle
*/
Expand All @@ -94,10 +101,7 @@ public boolean isNearSetpointAngle() {
*/
// TODO CHECK VALUES
public Command runCurrentHoming() {
return this.run(
() -> {
hardware.setVolts(-2.5);
})
return this.run(() -> hardware.setVolts(-2.5))
.until(() -> Math.abs(filteredPivotCurrent) > 50.0)
.finallyDo(
(interupted) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface ArmPivotIO extends AutoCloseable {
public double getStatorCurrentAmps();

/**
* Reset relative encoder to specified position
* Reset relative encoder of pivot motor to specified position
*
* @param poseRads position to reset to in radians
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import edu.wpi.first.wpilibj.simulation.SingleJointedArmSim;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/** Simulated {@link ArmPivotIOReal} */
public class ArmPivotIOSim implements ArmPivotIO {
private final DCMotor pivotModel = DCMotor.getKrakenX60Foc(1);
// TODO stddevs
Expand Down
Loading