Quote:
Originally Posted by Tominator368
Hi ozrien,
To start, I'd like to be able to do pretty much exactly what is described in that thread: - I'd like to drive forward to a setpoint using an encoder (the first input).
- I'd like to simultaneously be able to correct that movement for drift using a gyro reading (the second input).
- Then, I'd like to be able to stop using that system entirely, and literally switch to using some frontal omni wheels as my output, using a separate encoder on those wheels as my new input (the third possible input).
I apologize for not giving a description of the actual goal in the original post. The biggest thing that I'm interested in knowing is whether or not the way I described in the original post is the actual way PID control with WPILib works. Thanks so much for the help!
|
Our library does that for years. We combined multiple PID controllers. The goal was to do PID control on a subsystem level, not on a motor level. For example, we have a driveBase.setTarget method that can specify the X, Y, and Turn targets. So on a mecanum drive base, autonomous can set an X, Y position as well as a heading, the robot will execute it. This is achieved by combining three PID controllers, one for X, one for Y and one for TURN. The input sources for X and Y are encoders and gyro for TURN. In fact, our library allows you to combine any PID controllers for the drive base. For example, we used it quite often in FTC where we do line following using driveBase.setTarget by specifying a Y PID controller using Ultrasonic sensor as the PIDInput and light sensor as the TURN PID controller's PIDInput.