2020
2121public class Robot extends LoggedRobot {
2222 private Command m_autonomousCommand ;
23+
2324 private final RobotContainer m_robotContainer ;
24- private final Servo phlapServo ;
2525
26- // ✅ Added: reference to localization subsystem
27- private final localizationSubsystem m_localization = new localizationSubsystem ();
26+ private final Servo phlapServo ;
2827
2928 public Robot () {
3029
3130 phlapServo = new Servo (3 );
3231
3332 PurpleManager .initialize (
34- this ,
35- Constants .Field .FIELD_LAYOUT ,
36- Path .of ("/media/sda1" ),
37- BuildConstants .MAVEN_NAME ,
38- BuildConstants .GIT_SHA ,
39- BuildConstants .BUILD_DATE ,
40- false ,
41- false );
42-
33+ this ,
34+ Constants .Field .FIELD_LAYOUT ,
35+ Path .of ("/media/sda1" ),
36+ BuildConstants .MAVEN_NAME ,
37+ BuildConstants .GIT_SHA ,
38+ BuildConstants .BUILD_DATE ,
39+ false ,
40+ false
41+ );
42+
4343 m_robotContainer = new RobotContainer ();
4444
4545 CameraServer .startAutomaticCapture ();
4646
4747 RobotController .setBrownoutVoltage (6.75 );
4848
49- // ✅ Initialize Limelight calibration ranges once here
50- m_localization .setCalibrationRanges (
51- new double [] {29000 , 31000 },
52- new double [] {12200 , 12400 },
53- new double [] {6200 , 6400 },
54- new double [] {3600 , 3800 },
55- new double [] {1900 , 2100 });
56-
5749 // Threads.setCurrentThreadPriority(true, 99);
5850 }
5951
@@ -63,23 +55,13 @@ public void robotPeriodic() {
6355 LoopTimer .resetTimer ();
6456 CommandScheduler .getInstance ().run ();
6557 LoopTimer .addTimestamp ("CommandScheduler" );
66-
67- // ✅ Feed real-time heading into localization subsystem each loop
68- try {
69- double headingDeg =
70- m_robotContainer .DRIVE_SUBSYSTEM .getPose ().getRotation ().getDegrees ();
71- m_localization .setRobotHeadingDeg (headingDeg );
72- } catch (Exception e ) {
73- Logger .recordOutput (
74- "Localization/HeadingUpdateError" ,
75- e .getMessage () == null ? "unknown" : e .getMessage ());
76- }
77-
7858 Threads .setCurrentThreadPriority (false , 0 );
7959 }
8060
8161 @ Override
82- public void disabledInit () {}
62+ public void disabledInit () {
63+
64+ }
8365
8466 @ Override
8567 public void disabledPeriodic () {
@@ -93,7 +75,7 @@ public void disabledExit() {}
9375 public void autonomousInit () {
9476 Logger .recordOutput ("Auto/Lift/State" , "starting" );
9577 m_autonomousCommand = m_robotContainer .getAutonomousCommand ();
96-
78+
9779 phlapServo .set (1 );
9880
9981 if (m_autonomousCommand != null ) {
@@ -121,13 +103,7 @@ public void teleopInit() {
121103 @ Override
122104 public void teleopPeriodic () {
123105 m_robotContainer .checkRumble ();
124-
125- // ✅ Optional: log plan outputs for testing
126- var plan = m_localization .getPlan ();
127- Logger .recordOutput ("Teleop/AlignRecommendation" , plan .recommendation );
128- Logger .recordOutput ("Teleop/ForwardError_m" , plan .forwardErrorMeters );
129- Logger .recordOutput ("Teleop/StrafeError_m" , plan .strafeErrorMeters );
130- Logger .recordOutput ("Teleop/HeadingError_deg" , plan .headingErrorDeg );
106+ //localizationSubsystem.localizationSubsystem();
131107 }
132108
133109 @ Override
0 commit comments