View Single Post
  #6   Spotlight this post!  
Unread 08-03-2012, 14:44
DavidGitz's Avatar
DavidGitz DavidGitz is offline
Lead Technical Advisor
FRC #1208 (MeTool Brigade)
Team Role: Coach
 
Join Date: Dec 2006
Rookie Year: 1996
Location: O'Fallon, IL
Posts: 341
DavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud of
Send a message via AIM to DavidGitz Send a message via MSN to DavidGitz Send a message via Yahoo to DavidGitz
Re: How to make sequence happen ONCE, Period!

I'm not going to attempt troubleshooting the logic on this. Here are a few suggestions though.
1. You really should put your switch reads in a loop in Periodic Tasks. It is more of a safety net for what you're doing, just to ensure that nothing holds up reading the switch values. You could then combine these switch values to different states then use those states in your other code, which could drastically reduce the complexity of this.
2. It is much better/easier to troubleshoot if you put your motor sets at the very end of your teleop vi and wire the numeric outputs of each of your case structure to the motor drive itself. Again, a safety net to ensure that you aren't getting to a "weird" (i.e. unanticipated) state where you set the motor to different values at the same time or they flip back and forth. As it is right now, it is very easy to set a motor reference to different values at the same time, you should try to avoid this.
3. VI encapsulation... Makes your code a lot easier to read. What you have here is what we like to (affectionately) call spaghetti code.

I will say that your comments are great, very rare to see code documented this well.
__________________
Reply With Quote