![]() |
Re: Help me understand PIDController::OnTarget()
Quote:
|
Re: Help me understand PIDController::OnTarget()
Quote:
|
Re: Help me understand PIDController::OnTarget()
Quote:
the first is a semaphore used for mutual exclusion (to protect the critical region), in this use-case the semaphore is taken before and given after a critical region of code and always in the same context - the semaphore includes the concept of ownership (by the thread/task) and recursion the second is a semaphore used for synchronization, in this use-case the semaphore is taken in one context/thread/task and given or flushed in another context - for example given/flushed in a periodic timer callback function (or maybe an interrupt service routine) and taken in a task/thread hth |
Re: Help me understand PIDController::OnTarget()
Quote:
|
Re: Help me understand PIDController::OnTarget()
Quote:
Quote:
Using my example of a shooter speed controller with minimum input of 0 and maximum input of 100 fps. Say I step my setpoint from 0 to 100. My error would be equal to 100 on the first iteration. So 100 is greater than (100 - 0) / 2 and 100 is greater than zero so m_error ends up being set equal to 100 - 100 + 0. So if I step my speed controller from zero to maximum the output will be computed as zero?! Another scenario, I step the setpoint from 0 to 60. The error of 60 is greater than 50 and greater than zero so the m_error becomes 60 - 100 + 0 = -40. Now my positive error became negative error..I'm confused. Code:
if (m_continuous) |
Re: Help me understand PIDController::OnTarget()
Quote:
For example, if your setpoint is 10 degrees and your process variable is 350 degrees, you want to rotate clockwise 20 degrees, not counterclockwise 340 degrees. |
Re: Help me understand PIDController::OnTarget()
m_continuous is used to indicate if the range specified should be considered to be continuous (wraps from max to min) or not (the default is false). This is explained some in the documentation for the SetContinuous method.
So for something like a continuous rotation turret or swerve pod, you may set min as zero, max as 360 and continuous to true using SetContinuous(true). In this case the minimum and maximum represent the same value so the error for your hypothetical is indeed 0. |
Re: Help me understand PIDController::OnTarget()
Quote:
Jeez - I've got to stop giving advice from memory - sorry again. Despite the name it seems the Synchronized class is also used for mutual exclusion - weird. The destructor gives the semaphore - I missed that. The Notifier class uses a semaphore for synchronization and the DriverStation has a semFlush example. |
Re: Help me understand PIDController::OnTarget()
Quote:
OK that's pretty neat. I'm learning a lot about the PIDController implementation on this thread. |
| All times are GMT -5. The time now is 14:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi