Closed
Description
Describe the bug
In photonlib c++ on Windows, when #including photon/simulation/VisionSystemSim.h and building for the rio, warnings that static std::optional<PnpResult> EstimateCamPosePNP()
is unused get printed to the build console.
To Reproduce
Steps to reproduce the behavior:
- Create a blank cpp project (I used the Timed Robot Skeleton template)
- Install photonlib v2025.0.0-beta-8
- Add
#include <photon/simulation/VisionSystemSim.h>
orphoton/estimation/VisionEstimation.h
to Robot.h - Run WPILib: Build Robot Code from the vscode command pallet
- View warnings in the console:
Warnings in file Robot.cpp ....
In file included from C:\Users\user\.gradle\caches\8.10.2\transforms\b21211e3f0e2860a6b96abf082501de9\transformed\photonlib-cpp-v2025.0.0-beta-8-headers/photon/simulation/PhotonCameraSim.h:31,
from C:\Users\user\.gradle\caches\8.10.2\transforms\b21211e3f0e2860a6b96abf082501de9\transformed\photonlib-cpp-v2025.0.0-beta-8-headers/photon/simulation/VisionSystemSim.h:38,
from C:\src\icrobotics\cpp-photon-test\src\main\include/Robot.h:6,
from C:\src\icrobotics\cpp-photon-test\src\main\cpp\Robot.cpp:1:
C:\Users\user\.gradle\caches\8.10.2\transforms\ba6d2d39cca1288f8b471feb14a98f32\transformed\photontargeting-cpp-v2025.0.0-beta-8-headers/photon/estimation/VisionEstimation.h:51:33: warning: 'std::optional<photon::PnpResult> photon::VisionEstimation::EstimateCamPosePNP(const Eigen::Matrix<double, 3, 3>&, const Eigen::Matrix<double, 8, 1>&, const std::vector<photon::PhotonTrackedTarget>&, const frc::AprilTagFieldLayout&, const photon::TargetModel&)' defined but not used [-Wunused-function]
51 | static std::optional<PnpResult> EstimateCamPosePNP(
| ^~~~~~~~~~~~~~~~~~
Full warning messages: https://github.com/Liam-Stow/cpp-photon-test/blob/simplest-warning-producer/warnings.txt
Example project with this problem: https://github.com/Liam-Stow/cpp-photon-test/blob/simplest-warning-producer/src/main/include/Robot.h
Platform:
- Hardware Platform: Windows x64 (photonlib only, this doesn't relate to the coprocessor)
- Network Configuration (Connection between the Radio and any devices in between, such as a Network Switch): N/A
- PhotonVision Version: v2025.0.0-beta-8
- Browser (with Version) (Chrome, Edge, Firefox, etc.): N/A
- Camera(s) Used: N/A
WPILib project information:
- Project Version: 2025.1.1
- VS Code Version: 1.96.2
- WPILib Extension Version: 2025.1.1
- C++ Extension Version: 1.23.2
- Java Extension Version: 1.38.0
- Java Debug Extension Version: 0.58.1
- Java Dependencies Extension Version 0.24.1
- Java Version: 17
- Java Location: C:\Users\Public\wpilib\2025\jdk
- Vendor Libraries:
- photonlib (v2025.0.0-beta-8)
Additional context
- Removing
targetPlatform wpi.platforms.roborio
from build.gradle removes this problem. - Seems to only be a problem on Windows, we had a Linux machine build without the warnings.
- This problem persists when you actually use the VisionSystemSim.