pathplanner icon indicating copy to clipboard operation
pathplanner copied to clipboard

C++ PathPlannerLib: Pi causes issues with WPILib's Units library

Open KingRocco21 opened this issue 8 months ago • 1 comments

Describe the bug When I try to use pi from the WPILib Units library as a double, I get errors if I include <pathplanner/lib/util/swerve/SwerveSetpointGenerator.h> or <pathplanner/lib/util/swerve/SwerveSetpoint.h> in the same file.

To Reproduce Steps to reproduce the behavior:

  1. #include <units/constants.h> and <pathplanner/lib/util/swerve/SwerveSetpointGenerator.h> or <pathplanner/lib/util/swerve/SwerveSetpoint.h> in the same file.
  2. Try to initialize a double with units::constants::pi.

Expected behavior Expected behavior is to be able to use pi from the Units library even if you include a file from PathPlanner. A behavior other than that might confuse programmers. You may want to define pi using a different method than you use now.

Screenshots File without any PathPlanner files included: Image

File with PathPlanner files included: Image

The error message: Image

Versions: (please complete the following information):

  • OS: [Linux Mint 22]
  • GUI Version: [None]
  • PPLib Version: [2025.2.7]
  • PPLib Language: [C++]

KingRocco21 avatar Apr 27 '25 01:04 KingRocco21