@@ -366,66 +366,7 @@ public void setLimelightPipelines(int pipeline) {
366
366
limelight .setLimelightPipeline (pipeline );
367
367
}
368
368
}
369
-
370
- // ------------------------------------------------------------------------------
371
- // Config
372
- // ------------------------------------------------------------------------------
373
-
374
- /**
375
- * CommandConfig used to create a PIDController and for vision commands using other subsystems
376
- * (i.e. swerve)
377
- */
378
- public static class CommandConfig {
379
- public double kp ;
380
- public double tolerance ;
381
- public double maxOutput ;
382
- public double error ;
383
- public int pipelineIndex ;
384
- public Limelight limelight ;
385
- /* For Drive-To commands */
386
- public CommandConfig alignCommand ;
387
- public double verticalSetpoint ; // numbers get small as the cone gets closer
388
- public double verticalMaxView ;
389
-
390
- public void configKp (double kp ) {
391
- this .kp = kp ;
392
- }
393
-
394
- public void configTolerance (double tolerance ) {
395
- this .tolerance = tolerance ;
396
- }
397
-
398
- public void configMaxOutput (double maxOutput ) {
399
- this .maxOutput = maxOutput ;
400
- }
401
-
402
- public void configError (double error ) {
403
- this .error = error ;
404
- }
405
-
406
- public void configPipelineIndex (int pipelineIndex ) {
407
- this .pipelineIndex = pipelineIndex ;
408
- }
409
-
410
- public void configLimelight (Limelight limelight ) {
411
- this .limelight = limelight ;
412
- }
413
-
414
- public void configVerticalSetpoint (double verticalSetpoint ) {
415
- this .verticalSetpoint = verticalSetpoint ;
416
- }
417
-
418
- public void configVerticalMaxView (double verticalMaxView ) {
419
- this .verticalMaxView = verticalMaxView ;
420
- }
421
-
422
- public void configAlignCommand (CommandConfig alignCommand ) {
423
- this .alignCommand = alignCommand ;
424
- }
425
-
426
- public CommandConfig () {}
427
- }
428
-
369
+
429
370
// ------------------------------------------------------------------------------
430
371
// Calculation Functions
431
372
// ------------------------------------------------------------------------------
@@ -483,7 +424,7 @@ public double getReefTagAngle() {
483
424
}
484
425
485
426
public double getAdjustedThetaToReefFace () {
486
- int closestReefFace = closestReefFace ();
427
+ int closestReefFace = ( int ) frontLL . getClosestTagID ();
487
428
double [][] reefBlueAngles = {
488
429
{17 , 60 }, {18 , 0 }, {19 , -60 }, {20 , -120 }, {21 , 180 }, {22 , 120 }
489
430
}; // values in theta
@@ -517,33 +458,7 @@ public double getAdjustedThetaToReefFace() {
517
458
return -1 ; // no reef tag found
518
459
}
519
460
520
- public int closestReefFace () {
521
- double [] reefdistance = getDistanceToReefFromRobot ();
522
- if (reefdistance [0 ] > -1 ) {
523
- RawFiducial [] tags = frontLL .getRawFiducial ();
524
- if (Field .isRed ()) {
525
- int closestReef = tags [0 ].id ;
526
- for (RawFiducial tag : tags ) {
527
- if (tag .distToRobot < tags [closestReef ].distToRobot ) {
528
- closestReef = tag .id ;
529
- }
530
- }
531
- Telemetry .print ("Closest Reef Face: " + closestReef , PrintPriority .HIGH );
532
- return closestReef ; // red reef tag
533
- } else {
534
- int closestReef = tags [0 ].id ;
535
- for (RawFiducial tag : tags ) {
536
- if (tag .distToRobot < tags [closestReef ].distToRobot ) {
537
- closestReef = tag .id ;
538
- }
539
- }
540
- Telemetry .print ("Closest Reef Face: " + closestReef , PrintPriority .HIGH );
541
- return closestReef ; // blue reef tag
542
- }
543
- }
544
- Telemetry .print ("No reef tag found" , PrintPriority .HIGH );
545
- return -1 ; // no reef tag found
546
- }
461
+
547
462
548
463
/** Returns the distance from the reef in meters, adjusted for the robot's movement. */
549
464
public double [] getDistanceToReefFromRobot () {
@@ -590,7 +505,7 @@ public double[] getDistanceToReefFromRobot() {
590
505
*/
591
506
public Translation2d getAdjustedReefPos () {
592
507
593
- int reefID = closestReefFace (); // must call closestReefFace before this method gets passed
508
+ int reefID = ( int ) frontLL . getClosestTagID (); // must call closestReefFace before this method gets passed
594
509
Pose2d [] reefFaces = Field .Reef .getCenterFaces ();
595
510
double NORM_FUDGE = 0.075 ;
596
511
// double tunableNoteVelocity = 1;
0 commit comments