|
Re: PID Control of a Jaguar
If your elevator is its own subsystem, instead of extending Subsystem, you can extend PIDSubsystem. In the constructor, call the PIDSubsystem constructor (super(double p, double i, double d); ), giving it the three coefficients. After that, you can create properties, if you want to change the defaults, such as (setOutputRange(-1.0.1.0); ), and (setAbsoluteTolerance(0.1); ). You want to read the java docs for all of the methods of PIDSubsystem. Last, you need to create methods (public void usePIDOutput(double value){}) and (public double returnPIDInput() {}) in the curly brackets of usePIDOutput assign you motor(s) the argument 'value', and in returnPIDInput, you would return an number, such as the encoder value.
|