Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EstimateCamPosePNP defined but not used Warnings #1716

Closed
Liam-Stow opened this issue Jan 13, 2025 · 1 comment · Fixed by #1721
Closed

EstimateCamPosePNP defined but not used Warnings #1716

Liam-Stow opened this issue Jan 13, 2025 · 1 comment · Fixed by #1721
Labels
bug Something isn't working

Comments

@Liam-Stow
Copy link
Contributor

Liam-Stow commented Jan 13, 2025

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.
@Liam-Stow Liam-Stow added the bug Something isn't working label Jan 13, 2025
@mcm001
Copy link
Contributor

mcm001 commented Jan 13, 2025

Could you please slap a [[maybe_unused]] on that function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants