Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   PID Control of a Jaguar (http://www.chiefdelphi.com/forums/showthread.php?t=134712)

Pramizle 16-02-2015 16:50

PID Control of a Jaguar
 
We are trying to use a PID loop on our robot to set an elevator-like mechanism at a certain height. We are using an encoder to gain the feedback of where the elevator is sitting. Our primary build mentor has told us that their should be a way to set a maximum and minimum speed of the motor and then the PID loop will just control the acceleration/deceleration. However, we cannot find any place to do this. We have checked the WPI Library files and ReadTheDocs to no avail. If anybody has any experience with this that would be great.

Ethan_P 16-02-2015 17:36

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.

gbear605 16-02-2015 18:14

Re: PID Control of a Jaguar
 
I'm assuming that you can do most of creating the PID loop, and only need help with the specific setting minimum and maximum speeds. If this is the case, you'll need to run the following method in the constructor of the Subsystem, where "pid" is the PID Controller.
Code:

pid.setOutputRange(minimumOutput, maximumOutput);
If you're using a PID Subsystem, you would just call setOutputRange in the constructor of the class.


All times are GMT -5. The time now is 01:42.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi