Skip to content

feat: add localization#3

Open
Lubcas wants to merge 4 commits into
mainfrom
lucas/vision
Open

feat: add localization#3
Lubcas wants to merge 4 commits into
mainfrom
lucas/vision

Conversation

@Lubcas
Copy link
Copy Markdown

@Lubcas Lubcas commented Jan 20, 2026

No description provided.

@minhd-vu minhd-vu changed the title feat: Localization feat: add localization Jan 20, 2026
// Process latest vision results

for (PhotonPipelineResult result : results) {
if (result.hasTargets()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (result.hasTargets()) {
if (!result.hasTargets()) {
continue;
}

We do this as an early return.

Comment thread src/main/java/frc/robot/subsystems/VisionSubsystem.java Outdated
double STRAFE = 0.0;
double TURN = 0.0;

if (hasTarget()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (hasTarget()) {
if (!hasTarget()) {
continue;
}

Early return, this reduces nesting.

private AprilTagFieldLayout fieldLayout = null;
// State for alignment
private boolean hasTarget = false;
private double targetYawDeg = 0.0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you should be using the units library

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.

2 participants