FRC Competition Code – 2024 Season

For the 2024 season, FRC team 537 Charger Robotics developed a comprehensive codebase to control the robot’s many mechanisms. Key features include full integration with PhotonVIsion for vision processing, advanced path planning using WPILib Trajectory, and an assortment of powerful drive features. The codebase is designed to be modular and extensible, allowing for easy integration with both of our competing subteam’s devices. Personally, I focused on the vision aspect of the robot, utilizing PhotonVision alongside my own software to develop a robust system for estimating where the robot is on the field with minimal noise.

OceanView Screenshot OceanView Screenshot
Role: Developer January 2024 - April 2024

Key Code Snippet

The snippet below illustrates the basic algorithm that combined various vision measurements together to reduce detection noise.


// Loop through all of this RobotVision s PhotonVisionCameras and get their estimated robot position
for (PhotonVisionCamera camera : photonVisionCameras) {

    // Get the camera's estimate of the robot's position on the field. If the camera was unable to estimate a
    // position, then skip over to the next camera.
    Optional optionalEstimatedPose = camera.estimateRobotPose();
    if (optionalEstimatedPose.isEmpty()) {
        continue;
    }

    // Get the EstimatedRobotPose from optionalEstimatedPosition since we know the value isnt null.  
    EstimatedRobotPose estimatedRobotPose = optionalEstimatedPose.get();

    // Get the estimated position and convert it to a EstimatedRobotPose3d. Then add it to estimatedRobotPosition
    // so that we can average out each camera   s estimated position and get a more accurate estimate.
    EstimatedRobotPose3d estimatedRobotPose3d = new EstimatedRobotPose3d(estimatedRobotPose.estimatedPose);
    estimatedRobotPosition.add(estimatedRobotPose3d);

    // Add 1 to the numEstimatedPositions so that we can keep track of the total number of positions used in
    // the final estimate. This helps ensure our final position is as accurate as possible. 
    numEstimatedPositions++;
}
      

Additional Information

OceanView leverages a modular, object-oriented Python codebase to deliver advanced vision processing capabilities. Key features include: