Skip to content

EstimateCamPosePNP defined but not used Warnings #1716

Closed
@Liam-Stow

Description

@Liam-Stow

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:

  1. Create a blank cpp project (I used the Timed Robot Skeleton template)
  2. Install photonlib v2025.0.0-beta-8
  3. Add #include <photon/simulation/VisionSystemSim.h> or photon/estimation/VisionEstimation.h to Robot.h
  4. Run WPILib: Build Robot Code from the vscode command pallet
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions