is there any way of using pathplanner with timed robot structure
Not really, since PathPlannerLib produces commands to actually execute the paths you create.
Timed robot isn’t really suitable except for maybe the most simple of robots. Even then, there are advantages to using command based, like this.
We used it with timed robot last year without issues.
I’d wait for the 2024 examples to be put out, though. The API has changed.
Could just be me, but seems like a lot of extra work to make PathPlanner work with a TimedRobot project. Could instead be using the AutoBuilder and scheduling that command. Effectively makes running paths a single line of code.
The same could be said for learning and picking up command based three weeks before kickoff.
OP, the literal answer to your question is “Yes, there is a way” - parse the json, then sample the path regularly and pass the desired velocity and pose into your drivetrain control.
If you’re asking if you should do that, I can’t say I know enough about your team’s background and limits to advise. Would be happy to discuss it with more if that’s where you desire the conversation to go.
yes, our rookie year was last year and i only know how to code in timed robot. we are using swerve drive this year and it would be really helpful if you teached me how to do what you said. I really dont want to use command based structure
Sure.
So caveat, without knowing your current robot code, it’s hard to advise on exactly what to do. Additionally, what I’m sharing is for 2023 pathplanner. 2024 has made some major changes you’ll need to be on the lookout for.
But, what we did in 2023:
- When the autonomous mode is selected (say, during robot Init?), one time, init the trajectory from the json file
- Periodically, during autonomous, sample the path at the current time to determine the current desired position and velocity.
- Use the path sample as input to your holonomic drivetrain controller.
Some notes:
- I assume you have a functional drivetrain for teleop, and a functional and tuned holonomic drive controller. Make sure these are in place first before trying pathplanning.
- Be sure to handle the selection, resetting, and sequencing of autonomous. TimedRobot makes no assumptions of how this is done, so it’s on you to invent the world as you see fit.
We do have a functional drivetrain but i don’t know how to create a holonomic drivetrain or parse the json file. Is there any possibility that you have an example code? Thanks again.
I mean if you have a code explaining what it actually does because I can’t comprehend. Thanks again