diff --git a/pathplannerlib/src/sources.patch b/pathplannerlib/src/sources.patch index 70d82bd..9ec45a1 100644 --- a/pathplannerlib/src/sources.patch +++ b/pathplannerlib/src/sources.patch @@ -1,45 +1,21 @@ --- orig/pathplanner/lib/PathPlanner.cpp 2022-04-03 03:30:25.000000000 -0500 +++ patched/pathplanner/lib/PathPlanner.cpp 2022-04-03 03:30:37.000000000 -0500 -@@ -16,18 +16,35 @@ +@@ -10,6 +10,8 @@ + #include + #include ++#include ++ + using namespace pathplanner; + + double PathPlanner::resolution = 0.004; +@@ -17,7 +19,8 @@ double PathPlanner::resolution = 0.004; PathPlannerTrajectory PathPlanner::loadPath(std::string name, units::meters_per_second_t maxVel, units::meters_per_second_squared_t maxAccel, bool reversed){ std::string line; -+ wpi::json json; -+ -+ std::vector prefixes = { -+ frc::filesystem::GetDeployDirectory() + "/pathplanner/", -+ "./", -+ "/home/lvuser/py/" -+ }; - std::string filePath = frc::filesystem::GetDeployDirectory() + "/pathplanner/" + name + ".path"; -+ bool fileFound = false; -+ std::string errorMessage = "Cannot open file: \n"; - -- std::error_code error_code; -- wpi::raw_fd_istream input{filePath, error_code}; -+ for(auto prefix : prefixes){ -+ std::string filePath = prefix + name + ".path"; - -- if(error_code){ -- throw std::runtime_error(("Cannot open file: " + filePath)); -+ std::error_code error_code; -+ wpi::raw_fd_istream input{filePath, error_code}; -+ -+ if(!error_code){ -+ fileFound = true; -+ input >> json; -+ break; -+ } ++ std::string filePath = (robotpy::filesystem::GetDeployDirectoryFs() / "pathplanner" / (name + ".path")).string(); + -+ errorMessage += " - " + filePath + "\n"; - } - -- wpi::json json; -- input >> json; -+ if(!fileFound){ -+ throw std::runtime_error(errorMessage); -+ } - std::vector waypoints; - for (wpi::json::reference waypoint : json.at("waypoints")){ + std::error_code error_code; + wpi::raw_fd_istream input{filePath, error_code}; diff --git a/pyproject.toml b/pyproject.toml index 2de1788..a781600 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "robotpy-build<2023.0.0,>=2022.2.1", - "wpilib<2023.0.0,>=2022.4.1.0", + "wpilib<2023.0.0,>=2022.4.1.6", "robotpy-wpimath<2023.0.0,>=2022.4.1.3", ] @@ -60,5 +60,5 @@ author_email = "robotpy@googlegroups.com" url = "https://github.com/robotpy/robotpy-pathplannerlib" license = "BSD-3-Clause" install_requires = [ - "wpilib<2023.0.0,>=2022.4.1.0", + "wpilib<2023.0.0,>=2022.4.1.6", ] \ No newline at end of file