View Single Post
  #8   Spotlight this post!  
Unread 04-07-2016, 22:43
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 216
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Why won't this PID loop stop?

Quote:
Originally Posted by virtuald View Post
In particular, #29 is probably the one that is biting you (it bit me for a similar reason). If you keep calling setSetpoint (like that example does), each time it is called it will reset things such that onTarget is false, which means the robot will never stop oscillating.
So if I did a state machine for that setSetpoint like this:

Code:
if state == 1:
    setSetpoint(90)
    state = 2
elif state ==2:
    if onTarget():
        state=3
Would that solve the issue?
__________________
#Python4Life
Reply With Quote