-
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
Showing
20 changed files
with
1,106 additions
and
182 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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,16 @@ | ||
{ | ||
"name": "2024 Flipside", | ||
"rotations": [ | ||
{ | ||
"axis": "y", | ||
"degrees": 180.0 | ||
}, | ||
{ | ||
"axis": "z", | ||
"degrees": 270.0 | ||
} | ||
], | ||
"position": [0.4, 0.0, 0.0], | ||
"cameras": [], | ||
"components": [] | ||
} |
Binary file not shown.
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,20 @@ | ||
{ | ||
"name": "2025 RA25", | ||
"rotations": [ | ||
{ | ||
"axis": "x", | ||
"degrees": 90.0 | ||
}, | ||
{ | ||
"axis": "y", | ||
"degrees": 0.0 | ||
}, | ||
{ | ||
"axis": "z", | ||
"degrees": 270.0 | ||
} | ||
], | ||
"position": [0.0, 0.0, 0.0], | ||
"cameras": [], | ||
"components": [] | ||
} |
Binary file not shown.
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,59 @@ | ||
package frc.robot; | ||
|
||
import org.littletonrobotics.junction.AutoLogOutput; | ||
|
||
import au.grapplerobotics.ConfigurationFailedException; | ||
import au.grapplerobotics.LaserCan; | ||
import frc.robot.constants.RobotConstants; | ||
|
||
public class LaserCanHandler { | ||
private static LaserCanHandler m_instance; | ||
|
||
private LaserCan m_indexLaser; | ||
private LaserCan m_entranceLaser; | ||
private LaserCan m_exitLaser; | ||
|
||
public static LaserCanHandler getInstance() { | ||
if (m_instance == null) { | ||
m_instance = new LaserCanHandler(); | ||
} | ||
return m_instance; | ||
} | ||
|
||
private LaserCanHandler() { | ||
m_indexLaser = new LaserCan(RobotConstants.robotConfig.LaserCan.k_indexId); | ||
m_entranceLaser = new LaserCan(RobotConstants.robotConfig.LaserCan.k_entranceId); | ||
m_exitLaser = new LaserCan(RobotConstants.robotConfig.LaserCan.k_exitId); | ||
|
||
try { | ||
m_indexLaser.setRangingMode(LaserCan.RangingMode.SHORT); | ||
m_indexLaser.setRegionOfInterest(new LaserCan.RegionOfInterest(8, 8, 16, 16)); | ||
m_indexLaser.setTimingBudget(LaserCan.TimingBudget.TIMING_BUDGET_33MS); | ||
|
||
m_entranceLaser.setRangingMode(LaserCan.RangingMode.SHORT); | ||
m_entranceLaser.setRegionOfInterest(new LaserCan.RegionOfInterest(8, 8, 16, 16)); | ||
m_entranceLaser.setTimingBudget(LaserCan.TimingBudget.TIMING_BUDGET_33MS); | ||
|
||
m_exitLaser.setRangingMode(LaserCan.RangingMode.SHORT); | ||
m_exitLaser.setRegionOfInterest(new LaserCan.RegionOfInterest(8, 8, 16, 16)); | ||
m_exitLaser.setTimingBudget(LaserCan.TimingBudget.TIMING_BUDGET_33MS); | ||
} catch (ConfigurationFailedException e) { | ||
System.out.println("Configuration failed! " + e); | ||
} | ||
} | ||
|
||
@AutoLogOutput(key = "LaserCans/Index/seesCoral") | ||
public boolean getIndexSeesCoral() { | ||
return m_indexLaser.getMeasurement().distance_mm < 75.0; // Value gotten from Cranberry Alarm code | ||
} | ||
|
||
@AutoLogOutput(key = "LaserCans/Entrance/seesCoral") | ||
public boolean getEntranceSeesCoral() { | ||
return m_entranceLaser.getMeasurement().distance_mm < 75.0; // Value gotten from Cranberry Alarm code | ||
} | ||
|
||
@AutoLogOutput(key = "LaserCans/Exit/seesCoral") | ||
public boolean getExitSeesCoral() { | ||
return m_exitLaser.getMeasurement().distance_mm < 75.0; // Value gotten from Cranberry Alarm code | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package frc.robot.simulation; | ||
|
||
import edu.wpi.first.wpilibj.smartdashboard.Field2d; | ||
|
||
public class Field extends Field2d { | ||
private static Field m_field; | ||
|
||
public static Field getInstance() { | ||
if (m_field == null) { | ||
m_field = new Field(); | ||
} | ||
return m_field; | ||
} | ||
|
||
private Field() { | ||
super(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/frc/robot/simulation/SimulatableCANSparkMax.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,29 @@ | ||
package frc.robot.simulation; | ||
|
||
import com.revrobotics.spark.SparkMax; | ||
|
||
import edu.wpi.first.hal.SimDouble; | ||
import edu.wpi.first.wpilibj.simulation.SimDeviceSim; | ||
|
||
public class SimulatableCANSparkMax extends SparkMax { | ||
SimDeviceSim mCANSparkMaxSim; | ||
|
||
SimDouble mCANSparkMaxSimAppliedOutput; | ||
|
||
public SimulatableCANSparkMax(int deviceId, MotorType type) { | ||
super(deviceId, type); | ||
|
||
// mCANSparkMaxSim = new SimDeviceSim("SPARK MAX ", deviceId); | ||
// mCANSparkMaxSimAppliedOutput = mCANSparkMaxSim.getDouble("Applied Output"); | ||
|
||
// TODO: Add other simulation fields | ||
} | ||
|
||
// @Override | ||
// public void set(double speed) { | ||
// super.set(speed); | ||
|
||
// // TODO: Figure out why this is mad when running on a real robot | ||
// // mCANSparkMaxSimAppliedOutput.set(speed); | ||
// } | ||
} |
Oops, something went wrong.