View Single Post
  #5   Spotlight this post!  
Unread 08-10-2016, 02:04 PM
Waz Waz is offline
Strategy and programming mentor
AKA: Steve
FRC #2357 (System Meltdown)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Raymore, MO
Posts: 12
Waz is an unknown quantity at this point
Re: PIDCommand Java Object life cycle

You have inadvertently asked a trick question. Yes, you are suppose to be able to reset your set point regularly and have the PID loop respond appropriately. However, there was a bug in wpilib this past season that made this problematic (see this thread: https://www.chiefdelphi.com/forums/s...1#post1559101).

It looks like the fix was merged into wpilib in May, so if you get the very latest wpilib code, you should be okay.

Has to how to do it, that depends on why you want to do it.

If you want the re-targeting to to be at direction of the driver, putting it on a button makes sense. You could have a command that simply sets a new suggested target value on the running command (would need to save a reference to it when you create it in OI) and then check apply the value in execute().

We had a use case where we were updating a shooter targeting set point as we drove around. We had a active targeting command that would run when we wanted this behavior and its execute would deal with vision and update the running targeting command's set point as needed. Or something like that, my memory is a bit hazy on the details.

I hope this helps,
Steve
Reply With Quote