Skip to content

Comments

Vision Code#19

Open
PillageDev wants to merge 8 commits intodevelopfrom
17-vision
Open

Vision Code#19
PillageDev wants to merge 8 commits intodevelopfrom
17-vision

Conversation

@PillageDev
Copy link
Member

Adds vision code for the robot

  • 2 cameras (with the ability to add more in the list)
  • Kalman filter for positions (scales with distance to tag)
  • Validation checks for ambiguity

Closes #17

@PillageDev PillageDev requested review from a team February 20, 2026 02:37
@PillageDev PillageDev linked an issue Feb 20, 2026 that may be closed by this pull request
NathanEdg
NathanEdg previously approved these changes Feb 20, 2026
import java.util.Optional;

public class Camera {
private static final double AMBIGUITY_THRESHOLD = 0.2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this constant do? Add comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ambiguity refers to pose confidence. lower ambiguity means higher confidence in the robot's position, and vice versa. 0.2 is recommended

Copy link
Contributor

@bjmcternan bjmcternan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too bad. Please add comments so we can better understand what this does.

realtrev
realtrev previously approved these changes Feb 20, 2026
@PillageDev PillageDev dismissed stale reviews from realtrev and NathanEdg via 9431f9f February 22, 2026 17:51
NathanEdg
NathanEdg previously approved these changes Feb 22, 2026
afranchuk
afranchuk previously approved these changes Feb 23, 2026
Copy link

@afranchuk afranchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start overall!

Comment on lines +31 to +36
double totalDist = 0;
for (var target : pose.targetsUsed) {
totalDist += target.getBestCameraToTarget().getTranslation().getNorm();
}

avgDist = totalDist / pose.targetsUsed.size();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but if there's more than one target, wouldn't this be calculating the average distance to targets that are in different locations? If so, that seems like a useless value. Am I wrong in assuming "target"s are different april tags?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The average distance is the average distance to the targets. The average distance is computed as a scalar multiplied to the current standard deviations. Photon vision already does the pose fusing for us, this is just adjusting the std devs based on distance to the target.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I understand how this value is used now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vision

6 participants