Cannot access values from PhotonPostestimator in c++

Hey folks. We are working on our auto code, and we’re trying to access values from the Protonlib post estimator. Specifically, we are calling this method:


as a part of the Photonlib c++ docs for the purpose of feeding the value to our Wpilib RobotPostEstimator as seen here:

(Picture FYI)

This is the error we are getting:

I have tried to use a different type definition, casting result to std::pair, among other things, but the type auto doesn’t allow us to access the values inside of the EstimatedRobotPose, particularly its members frc::Pose3d estimatedPose and units::second_t timestamp.

Here is the rest of the .h file:

I am literally copy and pasting code, so there has to be something going on…

p.s. Please ignore the error in line 202 of the .h file - that is WIP. I don’t think that’s causing the issue

It looks like Update() returns a std::optional<EstimatedRobotPose> instead of a std::pair<frc::Pose3d,units::second_t>, so the correct code looks something like:

if (result) {
  return {result->estimatedPose.ToPose2d(), currentTime - result->timestamp};
} else {
  return {frc::Pose2d(), 0_ms};

Thanks for the help! It compiles now.