View Single Post
  #2   Spotlight this post!  
Unread 27-10-2012, 21:24
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Limit switches on a lift -- best practice

To me, dealing with limit switches is a problem internal to the Subsystem - if it had to be dealt with by Commands, it would make every one of your Commands more complicated, which to me seems like insufficient abstraction. As for how to do it, I'd probably do something similar to how WPILibJ's PIDController works - use an internal TimerTask or Thread to handle the checking and overriding. That way, it doesn't matter what the Commands try to do - the Subsystem simply won't allow it to go beyond the limits.