19
19
import edu .wpi .first .math .geometry .Pose2d ;
20
20
import edu .wpi .first .math .geometry .Pose3d ;
21
21
import edu .wpi .first .net .PortForwarder ;
22
+ import edu .wpi .first .wpilibj .smartdashboard .SmartDashboard ;
22
23
23
24
public class VisionIOPhoton implements VisionIO {
24
25
@@ -53,6 +54,8 @@ public VisionIOPhoton() {
53
54
camera3Estimator = new PhotonPoseEstimator (kTagLayout , PoseStrategy .MULTI_TAG_PNP_ON_COPROCESSOR , camera3 ,
54
55
cam3RobotToCam );
55
56
camera3Estimator .setMultiTagFallbackStrategy (PoseStrategy .LOWEST_AMBIGUITY );
57
+
58
+ SmartDashboard .putBoolean ("KillSideCams" , false );
56
59
}
57
60
58
61
@ Override
@@ -68,14 +71,20 @@ public void updateInputs(VisionIOInputs inputs, Pose2d currentEstimate) {
68
71
inputs .timestamp = estimateLatestTimestamp (results );
69
72
70
73
if (hasEstimate (results )) {
71
- //inputs.results = results;
74
+ // inputs.results = results;
72
75
inputs .estimate = getEstimatesArray (results , photonEstimators );
73
76
inputs .hasEstimate = true ;
74
-
77
+
75
78
int [][] cameraTargets = getCameraTargets (results );
76
79
inputs .camera1Targets = cameraTargets [0 ];
77
- inputs .camera2Targets = cameraTargets [1 ];
78
- inputs .camera3Targets = cameraTargets [2 ];
80
+
81
+ if (SmartDashboard .getBoolean ("KillSideCams" , false )) {
82
+ inputs .camera2Targets = new int [0 ];
83
+ inputs .camera3Targets = new int [0 ];
84
+ } else {
85
+ inputs .camera2Targets = cameraTargets [1 ];
86
+ inputs .camera3Targets = cameraTargets [2 ];
87
+ }
79
88
80
89
Pose3d [] tags = getTargetsPositions (results );
81
90
Logger .recordOutput ("Vision/Targets3D" , tags );
@@ -93,6 +102,14 @@ public void updateInputs(VisionIOInputs inputs, Pose2d currentEstimate) {
93
102
}
94
103
95
104
private PhotonPipelineResult [] getAprilTagResults () {
105
+ if (SmartDashboard .getBoolean ("KillSideCams" , false )) {
106
+ PhotonPipelineResult cam1_result = getLatestResult (camera1 );
107
+
108
+ printStuff ("cam1" , cam1_result );
109
+
110
+ return new PhotonPipelineResult [] { cam1_result };
111
+ }
112
+
96
113
PhotonPipelineResult cam1_result = getLatestResult (camera1 );
97
114
PhotonPipelineResult cam2_result = getLatestResult (camera2 );
98
115
PhotonPipelineResult cam3_result = getLatestResult (camera3 );
@@ -115,6 +132,12 @@ private void printStuff(String name, PhotonPipelineResult result) {
115
132
}
116
133
117
134
private PhotonPoseEstimator [] getAprilTagEstimators (Pose2d currentEstimate ) {
135
+ if (SmartDashboard .getBoolean ("KillSideCams" , false )) {
136
+ camera1Estimator .setReferencePose (currentEstimate );
137
+
138
+ return new PhotonPoseEstimator [] { camera1Estimator };
139
+ }
140
+
118
141
camera1Estimator .setReferencePose (currentEstimate );
119
142
camera2Estimator .setReferencePose (currentEstimate );
120
143
camera3Estimator .setReferencePose (currentEstimate );
0 commit comments