Skip to content

Conversation

@me-it-is
Copy link
Collaborator

@me-it-is me-it-is commented Feb 8, 2026

Tested irl on commit 224fb89 with f424890 reverted because the orange pi was still running 2025 photon vision
only formatting changes made since then and it works in sim.

Copy link

@jovapo jovapo left a comment

Choose a reason for hiding this comment

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

Comments in line. The main items are:

  1. isMinimumDistanceTooSmall naming confusing: the name says "too small" but the logic rejects targets that are too far (>= 2.5m). Either rename or fix the logic.
  2. FieldCentricFacingAngle allocated every loop cycle: creates a new object + resets the heading PID every 20ms. Pull it out to a field like the other swerve requests.
  3. Try to get pose from lib not hard coded

return false;
}

public boolean isMinimumDistanceTooSmall(EstimatedRobotPose pose) {
Copy link

@jovapo jovapo Feb 11, 2026

Choose a reason for hiding this comment

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

isMinimumDistanceTooSmall could have a better name — the logic rejects poses where distance is large (>= 2.5m), not small. Consider renaming to isClosestTagTooFar or similar.


private List<CamAndEstimator> cameras = new ArrayList<>();

public Consumer<VisionPose> updateDrivetrain;
Copy link

Choose a reason for hiding this comment

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

These fields (updateDrivetrain, getSimPose, visionSim, cameraProp) should be private. Being public + @Logged may cause issues with non-serializable types like VisionSystemSim.

}
}

public boolean usingTwoTags(EstimatedRobotPose pose) {
Copy link

Choose a reason for hiding this comment

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

usingTwoTags is defined but never called — remove it or wire it up.

&& (pose.estimatedPose.getY() > 0);
}

public Pose3d khubLoc() {
Copy link

Choose a reason for hiding this comment

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

khubLoc() is unused and doesn't follow Java naming conventions. Remove or rename to getHubLocation().


public static final double kAmbiguityTolerance = 0.25;
public static final double kDistanceTolerance = 2.5;
public static final double kMaxAngleTolerance = 70;
Copy link

Choose a reason for hiding this comment

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

kMaxAngleTolerance is defined but never used anywhere. Remove or add TODO for future use.

public static final Distance kFieldHeight = Meters.of(8.07); // y
public static final Distance kFieldWidth = Meters.of(16.54); // x

public static List<Transform3d> kCameraOffsets =
Copy link

Choose a reason for hiding this comment

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

kCameraOffsets should be final and use List.of(...) directly instead of wrapping in new ArrayList<>(). Currently it's a mutable list — anyone could accidentally .add() or .clear() it.

/*new Transform3d(0, -0.4347972, 0.54864, new Rotation3d(0, 0, Math.PI / 2))*/ ));

public static final Pose3d kHubLocation =
new Pose3d(Inches.of(469.11), Inches.of(158.84), Inches.of(72), new Rotation3d()); // );
Copy link

Choose a reason for hiding this comment

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

Is there some constant we can reference in the frc lib? That would be better than something hard coded here. If you need to hardcode it make sure this pose3D constructor actually takes Distance vs doubles.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's not much of a point doing calculations on the april-tag maps when you can just reference the field drawings


public static final Pose3d kHubLocation =
new Pose3d(Inches.of(469.11), Inches.of(158.84), Inches.of(72), new Rotation3d()); // );
public static Matrix<N3, N1> kBaseDeviation = VecBuilder.fill(1.5, 1.5, 10);
Copy link

Choose a reason for hiding this comment

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

kBaseDeviation is missing final.

cameraProp = new SimCameraProperties();
cameraProp.setCalibration(1280, 800, Rotation2d.fromDegrees(70));
cameraProp.setCalibError(0.25, 0.08);
cameraProp.setFPS(20);
Copy link

Choose a reason for hiding this comment

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

This should be 59 or ~60

}
}

if (minDistance >= kDistanceTolerance) {
Copy link

Choose a reason for hiding this comment

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

minDistance can at most be 1 but kDistanceTolerance is set to 2.5 so this will never trigger

Copy link

@jovapo jovapo left a comment

Choose a reason for hiding this comment

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

a few minor things still to fix but giving a stamp to unblock.

drivetrain.applyRequest(
() ->
// on y button press rotate robot to angle from getAngleToHub()
new SwerveRequest.FieldCentricFacingAngle()
Copy link

Choose a reason for hiding this comment

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

we can cover best practices here at a later meeting. This will add some latency but might not be the worst. The real question is how many times will this be called in a round. If over 100 (could be) then likely we should fix it.

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.

4 participants