View Single Post
  #2   Spotlight this post!  
Unread 11-02-2014, 15:50
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,112
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Still Having Pneumatics Problems

Caveat: While I know java, I'm not a robot programmer so I might be completely wrong about this.

That said, it seems like a really bad idea to use while loops in that way, as it makes it impossible for any code to execute at the same time as your solenoid commands. Moreover, since there is always one of your conditions that is true, you will in general never be able to execute any code other than that specific set of solenoid commands. Using different buttons for forward and backward commands on a double solenoid seems bad practice, too, without some sort of way to handle the case where both buttons are pressed at once, though I do not know off the top of my head what the behavior would be in this situation without something explicitly handling it in code, I could imagine it might be unfortunate (ironically, the fact that you're going to get caught in a loop with your given code handles this problem by itself as the forward and backward commands can't execute simultaneously, but upon revising it it'd rear its head).
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016

Last edited by Oblarg : 11-02-2014 at 15:57.