Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
261 changes: 261 additions & 0 deletions src/main/deploy/apriltag/practice_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
{
"tags": [
{
"ID": 2,
"pose": {
"translation": {
"x": 2.91849684715271,
"y": -4.538444519042969,
"z": 0.5754019021987915
},
"rotation": {
"quaternion": {
"W": -0.0015464945463463664,
"X": -0.002658718964084983,
"Y": -0.0027845054864883423,
"Z": 0.9999912977218628
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 3.127329111099243,
"y": -5.131237030029297,
"z": 0.5727609395980835
},
"rotation": {
"quaternion": {
"W": 0.7085180282592773,
"X": 0.006599326618015766,
"Y": 0.011610775254666805,
"Z": -0.7055661678314209
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 3.4936864376068115,
"y": -5.135638236999512,
"z": 0.5759871602058411
},
"rotation": {
"quaternion": {
"W": 0.718272864818573,
"X": 0.014575175009667873,
"Y": 0.012147395871579647,
"Z": -0.6955026984214783
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 4.056725025177002,
"y": -4.525740146636963,
"z": 0.5659568905830383
},
"rotation": {
"quaternion": {
"W": 0.9966632127761841,
"X": 0.0158087145537138,
"Y": 0.05140738934278488,
"Z": -0.061398304998874664
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 6.9187750816345215,
"y": -4.504202842712402,
"z": 0.33130407333374023
},
"rotation": {
"quaternion": {
"W": 0.7302694320678711,
"X": -0.015144702978432178,
"Y": -0.021585887297987938,
"Z": -0.6826500296592712
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 6.847953796386719,
"y": -4.535053253173828,
"z": 0.3529137372970581
},
"rotation": {
"quaternion": {
"W": 0.6875620484352112,
"X": -0.07726679742336273,
"Y": 0.07092981785535812,
"Z": 0.7185103893280029
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 4.087681293487549,
"y": -4.171364784240723,
"z": 0.5756258964538574
},
"rotation": {
"quaternion": {
"W": 0.9976387619972229,
"X": -0.0018898008856922388,
"Y": -0.06773331016302109,
"Z": 0.011198120191693306
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 3.9083917140960693,
"y": -3.990419626235962,
"z": 0.5789980888366699
},
"rotation": {
"quaternion": {
"W": 0.6651341319084167,
"X": -0.028980275616049767,
"Y": 0.010910031385719776,
"Z": 0.746081531047821
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 3.5427753925323486,
"y": -3.962294578552246,
"z": 0.5722489356994629
},
"rotation": {
"quaternion": {
"W": 0.7077287435531616,
"X": 0.007673805113881826,
"Y": -0.006959905382245779,
"Z": 0.7064082622528076
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 2.918107748031616,
"y": -4.178390026092529,
"z": 0.5687437057495117
},
"rotation": {
"quaternion": {
"W": 0.011189894750714302,
"X": 0.047166742384433746,
"Y": 0.007510459516197443,
"Z": 0.9987960457801819
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"rotation": {
"quaternion": {
"W": 0.7069476246833801,
"X": 0.009696598164737225,
"Y": 0.015003656037151814,
"Z": -0.7070401310920715
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 0.442140132188797,
"y": 0.02667858824133873,
"z": -0.00486380560323596
},
"rotation": {
"quaternion": {
"W": 0.7105119824409485,
"X": -0.07282736897468567,
"Y": -0.0551576092839241,
"Z": -0.6977295279502869
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 3.3096587657928467,
"y": 0.017690449953079224,
"z": 0.0063992817886173725
},
"rotation": {
"quaternion": {
"W": 0.702315092086792,
"X": 0.007732210215181112,
"Y": -0.003434067592024803,
"Z": -0.7118158936500549
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 3.851165771484375,
"y": 0.019229983910918236,
"z": 0.014089105650782585
},
"rotation": {
"quaternion": {
"W": 0.7048658728599548,
"X": 0.0179976224899292,
"Y": -0.003626205725595355,
"Z": -0.709102988243103
}
}
}
}
],
"field": {
"length": 6.2402091979980465,
"width": 9.050808906555176
},
"_comment": "generated by PractiCal 1.0.4 (7) on 1/29/2026"
}
3 changes: 3 additions & 0 deletions src/main/java/org/team2342/frc/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
import org.littletonrobotics.junction.networktables.NT4Publisher;
import org.littletonrobotics.junction.wpilog.WPILOGReader;
import org.littletonrobotics.junction.wpilog.WPILOGWriter;
// import org.team2342.frc.subsystems.CANdleSystem.CANdleSystem;
import org.team2342.frc.util.PhoenixUtils;
import org.team2342.lib.logging.ExecutionLogger;

public class Robot extends LoggedRobot {
private Command autonomousCommand;
private static final double loopOverrunWarningTimeout = 0.2;
// private final CANdleSystem candle = new CANdleSystem(null);

private final RobotContainer robotContainer;

Expand Down Expand Up @@ -160,6 +162,7 @@ public void robotPeriodic() {
robotContainer.updateAlerts();

ExecutionLogger.log("RobotPeriodic");
// candle.periodic();
}

@Override
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/team2342/frc/util/PhoenixUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import com.ctre.phoenix6.BaseStatusSignal;
import com.ctre.phoenix6.StatusCode;
import com.ctre.phoenix6.signals.RGBWColor;
import edu.wpi.first.wpilibj.util.Color;
import java.util.function.Supplier;

public class PhoenixUtils {
Expand Down Expand Up @@ -47,4 +49,17 @@ public static void refreshSignals() {
// Check to make sure there are signals to refresh
if (registeredSignals.length > 0) BaseStatusSignal.refreshAll(registeredSignals);
}

/**
* Used to convert {@link edu.wpi.first.wpilibj.util.Color} to {@link
* com.ctre.phoenix6.signals.RGBWColor}
*
* @param c WPILib Color to be converted
*/
public static RGBWColor toCTREColor(Color c) {
if (c == null) {
return new RGBWColor(0, 0, 0, 0);
}
return new RGBWColor((int) (c.red * 255), (int) (c.green * 255), (int) (c.blue * 255), 0);
}
}
35 changes: 34 additions & 1 deletion src/main/java/org/team2342/lib/leds/LedIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,37 @@

package org.team2342.lib.leds;

public interface LedIO {}
import edu.wpi.first.wpilibj.util.Color;
import org.littletonrobotics.junction.AutoLog;

public interface LedIO {
@AutoLog
public static class LedIOInputs {
public Color firstHalfColor = Color.kBlack;
public Color secondHalfColor = Color.kBlack;
public LedEffect firstHalfEffect = LedEffect.OFF;
public LedEffect secondHalfEffect = LedEffect.OFF;
}

public default void updateInputs(LedIOInputs inputs) {}

public default void setEffect(Half half, LedEffect effect, Color color) {}

public enum Half {
FIRST,
SECOND,
// ALL
}

public enum LedEffect {
SOLID,
FLASHING,
FIRE,
TWINKLE,
COLOR_FLOW,
LARSON,
RGB_FADE,
RAINBOW,
OFF
}
}
Loading