Hello, when we run multiple paths in a sequential sequence on path planner, the first path will always run perfectly, but the second path will just go straight forwards. Attached below is a screenshot of the intended path.
Both paths listed on the side are named the exact same, my guess is the rio/code is only running the first one and sees the same name and runs it again…
Thanks for the response, however they are actually named slightly differently. The second path has a lowercase b while the first has a lowercase a at the end.
If you track the robot’s position during the path (e.g. using the Field2d widget), does it think it’s on the path or does it reflect what the robot is doing?
It’s hard to advise you with knowing more about your system. Is it possible to share your codebase?
Could you upload a video of your robot running the auto with the Telemetry panel pulled up? That should show us what is going on under the hood.
I’m not too sure but from what I remember it diverges from the intended path and there is position error. The robot is currently going under some mechanical fixes but I’ll get a for sure answer soon. Here is our code in the meantime: GitHub - redlandsrobotics/2024Crescendo
Thanks for the response!
I’ll upload one soon, but from what I saw on the telemetry it goes off the intended path, and there is a large path inaccuracy starting on the second path.
Thanks for the response!
After looking at your code, I’ve noticed some interesting things that you might want to look at:
First, I wouldn’t leave your translation PID Constants at 0, so set them to something (the docs has them set to 5.0, 0, 0)
new HolonomicPathFollowerConfig(
new PIDConstants(0.0, 0, 0), // Update This!
new PIDConstants(0.5, 1.0 , 0.0),
4.5, // Max module speed, in m/s
0.3556, // Drive base radius in meters. Distance from robot center to furthest module.
new ReplanningConfig() // Default path replanning config. See the API for the options here
)
Next, I noticed that manually add all your autos to your sendableChooser
, which isn’t inherently bad, but Pathplanner provides a function to do that automatically. Consider changing your code to remove that potential faliure point:
public class RobotContainer {
private final SendableChooser<Command> autoChooser;
public RobotContainer() {
// ...
// Build an auto chooser. This will use Commands.none() as the default option.
autoChooser = AutoBuilder.buildAutoChooser();
// Another option that allows you to specify the default auto by its name
// autoChooser = AutoBuilder.buildAutoChooser("My Default Auto");
SmartDashboard.putData("Auto Chooser", autoChooser);
}
from Build an Auto | PathPlanner Docs
Besides this one issue and kinda a QOL feature, I didn’t really find anything else that caught my eye. Try these changes and get back to me.
Thanks a lot! I’ll add those changes. Will get back to you!
I agree with both of those, especially the PID constants.
I also noticed that the co-ordinates used in kDriveKinematics don’t seem to match up. Everywhere else your module order is FL/FR/BL/BR, but here it is BR/BL/FR/FL. See WPILib coordinate system.
Finally, a minor point, but I recommend you get rid of DriveStation.getHeading
, and instead implement getRotation2d
using ADXRS450_Gyro.getRotation2d
.
Got it, thanks for the feedback! Will take a look.
How did that work out for you?