|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
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.
|
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
||||
|
||||
|
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); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|