View Single Post
  #17   Spotlight this post!  
Unread 09-09-2010, 11:34
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 744
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: [FTC]: And here we go again!

The key to making your NXT programs smarter jet still fit in the NXT is to make strong use of SubVI's (or subroutines).

The code for these is shared, so they take up less room than two sets of duplicate code.
So if you find yourself adding the code to turn 90 Dec several times in your program, you can make your program smaller by creating a SubVI to do that turn.

Better yet, make a SubVI that has the turn angle as an input.

We had an Auto program last year that had 12 different move patterns.
We just kept making the SubVI's smarter, and more generic, till we got to the point that every Auto sequence was built up from three or four VI's (which managed moving and shooting).
To add an entire new sequence we just had to call the existing VIs. This required very little extra code or memory.

Remember. Cut & Paste is the enemy of programs. If you find yourdelf doing a cut & paste of C or LabVIEW code, it's time for a Subroutine or subVI.

Phil.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote