View Single Post
  #11   Spotlight this post!  
Unread 04-05-2010, 06:03 PM
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
Re: What was the hardest to program this year in Java?

The hardest part of programming is always convincing everyone that it's not a code problem! Fine, it was twice, when someone accidentally would comment out `break;' on one-line cases in switches.

Things we did abstract farther:
Our side kicker was incredibly complex. So, I created a the `hardware.SideKicker' class that made it work work like ``sideKicker.set(SideKicker.Mode.kLoad);''. It had 4 states: kick, load, close, and wait (which are normally run in that order). Beside that, I further broke the kicker down into the `hardware.sideKicker.Loader' and `hardware.sideKicker.Latch', both of which `hardware.SideKicker' used. Even after that, all the timing logic and such is still fairly complex, but I did manage to make it pretty zen.

Same thing with the front kicker, although it is a lot more straight forward (kick and load), no timer issues other than the 2 second rules of the competition.

We also further abstracted the driverstation ``LCD''.
  • LCD.lines[0-5] is an array storing the desired text.
  • LCD.update() updates the hardware based on the array, adding spaces if necessary (having parts of long numbers left over can be very confusing when debugging a problem).
  • LCD.println(str) adds a line, scrolling the other lines (this changes the array, and runs LCD.update()
Reply With Quote