Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Load path file from single location only #3

Merged
merged 1 commit into from
Apr 6, 2022
Merged

Conversation

virtuald
Copy link
Member

@virtuald virtuald commented Apr 3, 2022

  • /home/lvuser/py/deploy/pathplanner/*.path on RoboRIO
  • __main__ / deploy/pathplanner/*.path in simulation

@virtuald virtuald requested a review from TheTripleV April 3, 2022 22:22
Copy link
Member

@TheTripleV TheTripleV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will paths relative to robot.py still work? We've been using relative paths for all of our extra files (pathplanner and pathweaver before it).

@virtuald
Copy link
Member Author

virtuald commented Apr 4, 2022

The path is relative to dirname(__main__.__file__), which should generally work. I'll try it on a roborio later tonight, but there's no reason it shouldn't work AFAIK.

@virtuald
Copy link
Member Author

virtuald commented Apr 4, 2022

Confirmed on RoboRIO that this approach tries to load from /home/lvuser/py/deploy/pathplanner/*.path

@virtuald
Copy link
Member Author

virtuald commented Apr 4, 2022

Will depend on robotpy/robotpy-wpilib#710 once merged.

- /home/lvuser/py/deploy/pathplanner/*.path on RoboRIO
- __main__ / deploy/pathplanner/*.path in simulation
@virtuald virtuald merged commit 264d87d into main Apr 6, 2022
@virtuald virtuald deleted the fix-deploy-path branch April 6, 2022 04:15
@TheTripleV
Copy link
Member

Paths relative to robot.py don't work with this PR.
A sample from our code::

self.scheduler.schedule(commands.autonomous.DriveTrajectory(self, './paths/5Ball1', 2, 3, False))

./paths/5Ball1 resolved before but doesn't now.

I get that pathplannerlib originally looked in a specific folder, but everywhere else in robot code, relative paths are relative to robot.py and it would be confusing to deviate from that.

@virtuald
Copy link
Member Author

When you specify a robot 'project' in pathplanner, by default puts the files in the specific folder as you mention. It seems confusing to force users to have to copy the pathplanner files (as presumably your team does?). Additionally, the API specifies loading by name, not by a path, so this is staying with the original intent of the API.

With all that said, I agree that it would make sense to be able to load from any arbitrary location also, so maybe let's add another function that does that? Not sure what the right name would be though... loadFile?

@TheTripleV
Copy link
Member

It's weird because here, the Path in loadPath refers to a trajectory but it generally refers to a PathLike. I'm fine with loadFile. Alternatively, would loadPath trying both be bad?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants