Seeking Pose Estimation Example for Turrets

I’m interested if anyone has an example they would be willing to share of some working pose estimation code that they used to keep a turret pointed at a goal even if it’s from last year.

We use a limelight on our turret and have Falcon500s in our drivetrain so we believe we can collect the relevant sensor data to potentially implement this feature ourselves.

We actually have done pose estimation by calculating the field relative heading of the turret and in the other hand calculating the perpendicular distance to the target. by calculating these two you can use them to find your X and Y offsets relative to the target and since you already know the position of the target you can easily calculate where you are at on the field.

I know we use pose estimation this year to aim our swerve without vision and in 2020 to aim our turret. I’ll page @dan @adamv for more details

This year we decided to have our swerve turn roughly to the correct angle based on odometry without vision and then fix the error with the relative yaw error, which worked fine for us. If you would like a more general and robust implementation, we did try using Wpilib’s SwervePoseEstimator class that integrates the vision readings with the current pose based on the encoders (the code commented out here is relevant for you). A version for tank drive can be found here.

Good luck! and if you need some more info I can also send our 2020 code (turret with tank drive).


Here is our command that constantly keeps track of where the hub is, based on our current pose.

This thread was helpful in coming up with our strategy

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.