We are using pathplanner for the first time and having success with the odometry and getting the robot to follow paths. However, we cannot figure out how to get the wait command to work. We want the robot to wait at the start so we can shoot a note and it takes off right away on its path without first waiting. Any help would be appreciated. One student is solving all of our code with no mentor or coach help as we don’t have a programming mentor. This is his 3rd year programming the robot so he has a good handle on stuff but no formal training just teaching himself.
Well, assuming that by using PathPlanner, you’re using PathPlanner to build the auto as well.
If so, you can look at the command sequence in the .auto file that is in the deploy directory to make sure that the wait time is set to more than 0.
If your student has code in Github that is accessible post the link here and we can take a look and see if anything sticks out but in my experience (first time PathPlanner user as well, the wait commands in the sequence have properly waited for the time).
I think according to my read of the documentation the steps you’ll want to follow to have PathPlannerLib build your auto are:
- Design the auto, using paths, and NamedCommands
- Register the named commands with PPLib
- Call the configuration for your drivetrain with Autobuilder (e.g. AutoBuilder.configureHolonomic())
- Construct a PathPlannerAuto instance with your named Auto
This is the programmer for 5348. I looked in the deploy directory and the wait time is set to more than zero. Here is the github repository if you want to look into it further. GitHub - 5438chargersrobotics/2024-Code
None of your autos have WaitCommands in them, at least not with what is in your main branch on Github.
Your current RobotContainer is using TestAuto.
I made a quick PathPlanner edit, and added a wait command to your Test Auto and the resulting .auto file looks like this:
"version": 1.0,
"startingPose": {
"position": {
"x": 1.3186789318946823,
"y": 5.401366052138281
},
"rotation": 0
},
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "wait",
"data": {
"waitTime": 3.0
}
},
{
"type": "path",
"data": {
"pathName": "Test Path"
}
},
{
"type": "path",
"data": {
"pathName": "Test Path 2"
}
}
]
}
},
"folder": null,
"choreoAuto": false
}
From the git diff you can see the difference:
index 8c85708..2915862 100644
--- a/src/main/deploy/pathplanner/autos/Test Auto.auto
+++ b/src/main/deploy/pathplanner/autos/Test Auto.auto
@@ -11,6 +11,12 @@
"type": "sequential",
"data": {
"commands": [
+ {
+ "type": "wait",
+ "data": {
+ "waitTime": 3.0
+ }
+ },
{
"type": "path",
"data": {
Just in case you need the whole file contents to replace in your source tree:
{
"version": 1.0,
"startingPose": {
"position": {
"x": 1.3186789318946823,
"y": 5.401366052138281
},
"rotation": 0
},
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "wait",
"data": {
"waitTime": 3.0
}
},
{
"type": "path",
"data": {
"pathName": "Test Path"
}
},
{
"type": "path",
"data": {
"pathName": "Test Path 2"
}
}
]
}
},
"folder": null,
"choreoAuto": false
}
The PathPlanner UI will not necessarily wait the 3 seconds when animating the auto, but when it’s run on the robot it definitely will.
In the code, the event markers and waits are in the paths, not the autos. The following code is from Test Path.
“eventMarkers”: [
{
“name”: “wait”,
“waypointRelativePos”: 0.5,
“command”: {
“type”: “sequential”,
“data”: {
“commands”: [
{
“type”: “wait”,
“data”: {
“waitTime”: 3.0
}
}
]
Would it be better to put the event markers in the autos instead of the paths?
I’m not sure, I’m new to PathPlanner.
I have tested WaitCommands in the auto sequences, and I know they work. We haven’t used any event markers yet, so I’m not sure how to expect them to work.
We were able to get our autos working. We put any commands that need to run when the robot is stopped in the auto file and the commands that run when the robot is moving in the paths. Thank you for all of your help with getting our autos working.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.