mirror of
https://github.com/Team4388/2026KPopRobotHunters.git
synced 2026-06-09 00:38:03 -06:00
Mira goofy test
This commit is contained in:
@@ -42,6 +42,7 @@ import frc4388.robot.subsystems.swerve.SwerveDrive;
|
|||||||
import frc4388.robot.subsystems.vision.Vision;
|
import frc4388.robot.subsystems.vision.Vision;
|
||||||
import frc4388.utility.DeferredBlock;
|
import frc4388.utility.DeferredBlock;
|
||||||
import frc4388.utility.compute.TimesNegativeOne;
|
import frc4388.utility.compute.TimesNegativeOne;
|
||||||
|
import frc4388.utility.configurable.ConfigurableString;
|
||||||
import frc4388.utility.controller.DeadbandedXboxController;
|
import frc4388.utility.controller.DeadbandedXboxController;
|
||||||
// Autos
|
// Autos
|
||||||
import frc4388.utility.controller.VirtualController;
|
import frc4388.utility.controller.VirtualController;
|
||||||
@@ -62,6 +63,8 @@ public class RobotContainer {
|
|||||||
|
|
||||||
/* Subsystems */
|
/* Subsystems */
|
||||||
public final LED m_robotLED = new LED();
|
public final LED m_robotLED = new LED();
|
||||||
|
//Testing of Colors
|
||||||
|
|
||||||
public final Vision m_vision = new Vision(m_robotMap.rightCamera, m_robotMap.leftCamera);
|
public final Vision m_vision = new Vision(m_robotMap.rightCamera, m_robotMap.leftCamera);
|
||||||
public final SwerveDrive m_robotSwerveDrive = new SwerveDrive(m_robotMap.swerveDrivetrain, m_vision);
|
public final SwerveDrive m_robotSwerveDrive = new SwerveDrive(m_robotMap.swerveDrivetrain, m_vision);
|
||||||
private Boolean operatorManualMode = false;
|
private Boolean operatorManualMode = false;
|
||||||
@@ -90,7 +93,12 @@ public class RobotContainer {
|
|||||||
private Command autoCommand;
|
private Command autoCommand;
|
||||||
|
|
||||||
private Command RobotShoot = new SequentialCommandGroup(
|
private Command RobotShoot = new SequentialCommandGroup(
|
||||||
new InstantCommand(() -> m_robotLED.setMode(LEDPatterns.PARTY_TWINKLES), m_robotLED)
|
new InstantCommand(() -> System.out.println(m_robotLED.getMode())),
|
||||||
|
new InstantCommand(() -> m_robotLED.setMode(LEDPatterns.PARTY_TWINKLES), m_robotLED),
|
||||||
|
new InstantCommand(() -> System.out.println(m_robotLED.getMode())),
|
||||||
|
new WaitCommand(5),
|
||||||
|
new InstantCommand(() -> m_robotLED.setMode(LEDPatterns.SOLID_RED), m_robotLED),
|
||||||
|
new InstantCommand(() -> System.out.println(m_robotLED.getMode()))
|
||||||
);
|
);
|
||||||
|
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ public final class BuildConstants {
|
|||||||
public static final String MAVEN_GROUP = "";
|
public static final String MAVEN_GROUP = "";
|
||||||
public static final String MAVEN_NAME = "2026KPopRobotHunters";
|
public static final String MAVEN_NAME = "2026KPopRobotHunters";
|
||||||
public static final String VERSION = "unspecified";
|
public static final String VERSION = "unspecified";
|
||||||
public static final int GIT_REVISION = 23;
|
public static final int GIT_REVISION = 24;
|
||||||
public static final String GIT_SHA = "8bda61b9837d7450a2fb4650bf02ffb1f4f06213";
|
public static final String GIT_SHA = "5d381731689602f5fac161f1552170003ef30c14";
|
||||||
public static final String GIT_DATE = "2026-01-29 16:59:53 MST";
|
public static final String GIT_DATE = "2026-01-29 18:07:19 MST";
|
||||||
public static final String GIT_BRANCH = "Subsystem-Boilerplate";
|
public static final String GIT_BRANCH = "Subsystem-Boilerplate";
|
||||||
public static final String BUILD_DATE = "2026-01-29 17:04:31 MST";
|
public static final String BUILD_DATE = "2026-01-29 19:27:45 MST";
|
||||||
public static final long BUILD_UNIX_TIME = 1769731471423L;
|
public static final long BUILD_UNIX_TIME = 1769740065495L;
|
||||||
public static final int DIRTY = 0;
|
public static final int DIRTY = 1;
|
||||||
|
|
||||||
private BuildConstants(){}
|
private BuildConstants(){}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
package frc4388.robot.constants;
|
package frc4388.robot.constants;
|
||||||
|
|
||||||
import com.ctre.phoenix6.configs.Slot0Configs;
|
|
||||||
|
|
||||||
import edu.wpi.first.apriltag.AprilTagFieldLayout;
|
import edu.wpi.first.apriltag.AprilTagFieldLayout;
|
||||||
import edu.wpi.first.apriltag.AprilTagFields;
|
import edu.wpi.first.apriltag.AprilTagFields;
|
||||||
import edu.wpi.first.math.Matrix;
|
import edu.wpi.first.math.Matrix;
|
||||||
@@ -21,7 +19,6 @@ import edu.wpi.first.math.numbers.N3;
|
|||||||
import edu.wpi.first.math.util.Units;
|
import edu.wpi.first.math.util.Units;
|
||||||
import edu.wpi.first.wpilibj.RobotBase;
|
import edu.wpi.first.wpilibj.RobotBase;
|
||||||
import frc4388.utility.compute.Trim;
|
import frc4388.utility.compute.Trim;
|
||||||
import frc4388.utility.status.CanDevice;
|
|
||||||
import frc4388.utility.structs.Gains;
|
import frc4388.utility.structs.Gains;
|
||||||
import frc4388.utility.structs.LEDPatterns;
|
import frc4388.utility.structs.LEDPatterns;
|
||||||
|
|
||||||
@@ -92,6 +89,7 @@ public final class Constants {
|
|||||||
public static final Matrix<N3, N1> kMultiTagStdDevs = VecBuilder.fill(0.1, 0.1, 1);
|
public static final Matrix<N3, N1> kMultiTagStdDevs = VecBuilder.fill(0.1, 0.1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final class LEDConstants {
|
public static final class LEDConstants {
|
||||||
public static final int LED_SPARK_ID = 9;
|
public static final int LED_SPARK_ID = 9;
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,15 @@ public class LED extends SubsystemBase implements Queryable {
|
|||||||
|
|
||||||
private static Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
private static Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
||||||
private LEDPatterns mode = LEDConstants.DEFAULT_PATTERN;
|
private LEDPatterns mode = LEDConstants.DEFAULT_PATTERN;
|
||||||
//hello
|
|
||||||
public void setMode(LEDPatterns pattern){
|
public void setMode(LEDPatterns pattern){
|
||||||
this.mode = pattern;
|
this.mode = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMode(){
|
||||||
|
return mode.name();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
update();
|
update();
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ package frc4388.robot.subsystems.vision;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.littletonrobotics.junction.AutoLogOutput;
|
import org.littletonrobotics.junction.AutoLogOutput;
|
||||||
import org.littletonrobotics.junction.Logger;
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
import com.ctre.phoenix6.Utils;
|
import com.ctre.phoenix6.Utils;
|
||||||
import com.ctre.phoenix6.hardware.CANcoder;
|
|
||||||
import com.ctre.phoenix6.hardware.TalonFX;
|
|
||||||
import com.ctre.phoenix6.swerve.SwerveDrivetrain;
|
|
||||||
|
|
||||||
import edu.wpi.first.math.geometry.Pose2d;
|
import edu.wpi.first.math.geometry.Pose2d;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
@@ -18,20 +14,22 @@ import frc4388.robot.subsystems.vision.VisionIO.PoseObservation;
|
|||||||
import frc4388.utility.status.FaultReporter;
|
import frc4388.utility.status.FaultReporter;
|
||||||
import frc4388.utility.status.Queryable;
|
import frc4388.utility.status.Queryable;
|
||||||
import frc4388.utility.status.Status;
|
import frc4388.utility.status.Status;
|
||||||
|
import frc4388.utility.structs.LEDPatterns;
|
||||||
|
|
||||||
public class Vision extends SubsystemBase implements Queryable {
|
public class Vision extends SubsystemBase implements Queryable{
|
||||||
VisionIO[] io;
|
VisionIO[] io;
|
||||||
VisionStateAutoLogged[] state;
|
VisionStateAutoLogged[] state;
|
||||||
|
|
||||||
|
|
||||||
public Pose2d lastVisionPose = new Pose2d();
|
public Pose2d lastVisionPose = new Pose2d();
|
||||||
public Pose2d lastPhysOdomPose = new Pose2d();
|
public Pose2d lastPhysOdomPose = new Pose2d();
|
||||||
|
public LED m_robotLED;
|
||||||
|
|
||||||
public Vision(VisionIO... devices) {
|
public Vision(VisionIO... devices) {
|
||||||
FaultReporter.register(this);
|
FaultReporter.register(this);
|
||||||
io = devices;
|
io = devices;
|
||||||
state = new VisionStateAutoLogged[io.length];
|
state = new VisionStateAutoLogged[io.length];
|
||||||
|
m_robotLED = new LED();
|
||||||
for(int i = 0; i < io.length; i++) {
|
for(int i = 0; i < io.length; i++) {
|
||||||
state[i] = new VisionStateAutoLogged();
|
state[i] = new VisionStateAutoLogged();
|
||||||
}
|
}
|
||||||
@@ -44,6 +42,10 @@ public class Vision extends SubsystemBase implements Queryable {
|
|||||||
Logger.processInputs("Vision/Camera" + i , state[i]);
|
Logger.processInputs("Vision/Camera" + i , state[i]);
|
||||||
}
|
}
|
||||||
Logger.recordOutput("Vision/isTagDectected", isTag());
|
Logger.recordOutput("Vision/isTagDectected", isTag());
|
||||||
|
|
||||||
|
if (isTag()){
|
||||||
|
m_robotLED.setMode(LEDPatterns.SOLID_GREEN_DARK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PoseObservation> getPosesToAdd(){
|
public List<PoseObservation> getPosesToAdd(){
|
||||||
@@ -93,4 +95,10 @@ public class Vision extends SubsystemBase implements Queryable {
|
|||||||
// throw new UnsupportedOperationException("Unimplemented method 'diagnosticStatus'");
|
// throw new UnsupportedOperationException("Unimplemented method 'diagnosticStatus'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple LED helper class for compilation and basic usage; replace with real implementation if available.
|
||||||
|
private static class LED {
|
||||||
|
public void setMode(LEDPatterns mode) {
|
||||||
|
// no-op stub for compilation; integrate with hardware driver as needed
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public class ConfigurableString {
|
|||||||
* @param name the name of the Smart Dashboard key.
|
* @param name the name of the Smart Dashboard key.
|
||||||
* @param defualtValue the initilization value
|
* @param defualtValue the initilization value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ConfigurableString(String name, String defualtValue) {
|
public ConfigurableString(String name, String defualtValue) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.defualtValue = defualtValue;
|
this.defualtValue = defualtValue;
|
||||||
@@ -20,4 +21,5 @@ public class ConfigurableString {
|
|||||||
public String get() {
|
public String get() {
|
||||||
return SmartDashboard.getString(name, defualtValue);
|
return SmartDashboard.getString(name, defualtValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user