Questions regarding SwerveDrivePoseEstimator & robot localization with limelight

My team is building a swerve drive this year using the REV ION swerve drive kits and their example code. Our drive base is functional using field oriented drive but I would like to use SwerveDrivePoseEstimator instead of the SwerveDriveOdometry and .AddVisionMeasurement() in order to correct errors using the limelight. However, I am left with multiple questions before starting:

  • Our lime light is functional and I have uploaded the 2024 apriltag map to it. Will the PoseEstimator, with the help of limelight, be able to determine its position on the field before the round starts just by seeing apriltags? For example, lets say our robot starts the match in the middle of the field. I tell the PoseEstimator the robots current position is 0,0, then add the input of the limelight. Will the limelight be able to change the robots pose to its real one on the field? If so, what is the unit the apriltag map uses?

  • I noticed online that limelight has a java class you can insert into your project called ‘limelighthelper’ and with it a method called .getBotPose(). Will calling the method: estimator.AddVisionMeasurement(limelighthelper.getBotPose(“limelight”),Timer.getFGATimestamp())
    function as intended, making the robot pose more accurate?

  • If what I talked about in the first question isn’t possible or reliable, would setting the robots pose when creating the poseestimator object as the pose the limelight reads off apriltags work? If I recall correctly from when configuring the limelight you can see (and access in the code) the current X, Y, and Z position of the robot according to the apriltags.

Thanks for reading, sorry it is wordy

In order:

  1. yes depending on if you do any pose filtering (i.e. reject poses too far away from where you think you are), and the output is in meters and radians
  2. that will do the same thing as what you said in the first bullet point
  3. Not really, unless you dont create the pose estimator until you know you are on the field. A good option could be to have the pose get reset by the drivers selecting the auton option and letting the limelight correct that to the “true” pose as needed. There are many ways to go about this and to an extent it’s up to you to decide what works best for you.
3 Likes