-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A question about your swerve auto #18
Comments
Hi, Are you talking about our 2021 robot? This repository is for our 2020 robot, which uses a tank drive. Swerve drive and mecanum robots use a holonomicDriveController for trajectory following, and tank drive robots use a RAMSETE controller. We use WPILib's PathWeaver tool to draw trajectories. It's a really easy way to draw spline curve trajectories for autonomous routines, if you write the correct code. As for tuning the PID gains for the holonomic controller, it's just like tuning any other PID controller. The first and second PID controllers for the holonomicDriveController constructor are used for getting the robot to the correct position on the field. To follow a trajectory, you must know where your robot is on the field. What the trajectory tells your code is where the robot needs to be at a given time. The holonomic or RAMSETE controller is responsible for getting the robot to that location. Suppose that you tell the holonomic controller to move your robot to (2m, 4m) and your robot is at (0m, 0m). The first PID controller that you give the holonomic controller is used to get the robot to the x value, and the second is for y. What the holonomic controller does is set the target of the first controller to 2m. The output of that controller is sent to the resulting chassis speeds object, which you use to set the velocities of the robot. I assume that you are using a swerve drive. If that's the case, then the PID gains should be the same for the first two controllers. The third, profiled, PID controller is used for setting the heading of the robot. I hope this helps! |
Yeah, that's how you do it.
The PathWeaver tool is designed for normal tank drive robots, so it automatically points your robot's heading in its direction of travel, which should be ok for most autos.
Yes, the SwerveControllerCommand uses the holonomic controller. You can browse its source here
Really? I thought that was only for tank drive robots. Could you share that page?
Yeah, you can tune it by hand, which is what I did.
The same way you'd tune any PID controller.
Change the gains in your code.
Honestly, I'm not entirely sure, but here's the documentation for it. |
But it seems that my swerve can't drive the path smoothly and l can't control its heading. l wonder whether should l seperate the path into several trajectories. However , how many path should l seperate? And what does the blue straight line in the picture mean? Does it mean the head of my robot?
Maybe you are right.
How can l tune it by hand . Since the PIDController of ProfiledController is only used in the auto , so how can l tune it by hand? Can l tune it in the Phoneix tuner? Any answer is appreciated. |
You use a holonomicDriveController in the auto. How do you draw a trajectory, is there any method to draw it? And how do you tune your 3 PIDcontroller's paramater?
Any help is appreciated.
The text was updated successfully, but these errors were encountered: