|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Oscillating Motor - PID Subsystem
I haven't looked at your details yet, but in general a larger magnitude for D (that is, derivative of the error, or velocity for a mechanical system going for a position) will act like a dashpot/shock absorber and dampen your system.
|
|
#2
|
|||
|
|||
|
Re: Oscillating Motor - PID Subsystem
Quote:
How would the tuning work if the system has an issue with just a P-closed loop essentially? Would that not continue having error in the sense of a continued oscillation? Last edited by Asymons : 25-11-2015 at 20:56. |
|
#3
|
|||||
|
|||||
|
Re: Oscillating Motor - PID Subsystem
Quote:
A P-only PID feedback system is (assuming that the mechanical system is linear) is mathematically identical to an undamped spring-and-mass; you would expect it to oscillate for a long time. When the system is far from the target, it is accelerated towards the target. By the time it reaches the target, it has significant speed, but there is no frictional term to slow it down, so it overshoots. You have essentially made a system in which F=kx (Hooke's Law). In terms of a differential equation, it becomes the simple x''=(k/m)x, where k/m is proportional to your P term. If you have done calculus 1 it is easy to verify that one solution to this equation is x=sin(sqrt(k/m)t), that is displacement is described as an undamped sine wave. Some sort of friction term is required to dissipate the initial "potential energy"; neither P nor I do this. Both D and mechanical friction will dampen the oscillations. Last edited by GeeTwo : 25-11-2015 at 21:32. |
|
#4
|
|||
|
|||
|
Re: Oscillating Motor - PID Subsystem
Quote:
![]() |
|
#5
|
|||||
|
|||||
|
Re: Oscillating Motor - PID Subsystem
Quote:
--Gus |
|
#6
|
||||
|
||||
|
Re: Oscillating Motor - PID Subsystem
Regarding the command continuing to run between the robot being enabled/disabled:
Your command will only finish if the onTarget method returns true. Code:
protected boolean isFinished() {
return Robot.pidelevator.onTarget();
}
Add something like: Code:
Scheduler.getInstance().removeAll(); Scheduler.getInstance().disable(); |
|
#7
|
|||
|
|||
|
Re: Oscillating Motor - PID Subsystem
In that case, Gus' suggestion, as well as James worked!
So my solution was as followed: -Added the D value, set it to 1.0 and eventually lowered this value to 0.1 due to the lift "skipping". -Absolute Tolerance was adjusted from 200 to 20, which it finally remained at 50 to keep the lift moving smoothly. -P value was adjusted to 0.05 -Added Robot.elevator.disable(); at end of command Doing all this, I was able to get the lift to stop at a set point, or have it skip once and get to the set point. I'm most likely going to learn common tuning practices;however, I've mostly seen people use the "guess and check" method. Last edited by Asymons : 26-11-2015 at 12:11. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|