View Single Post
  #2   Spotlight this post!  
Unread 27-07-2012, 11:09
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Code Review - Pneumatic Gear Shifting

At a quick glance, I don't see anything major that is incorrect.

Some tips:

* Generally in Java, all class names should be in camel case, e.g. ThisIsAClass. When I saw your "shift" command, I was at first confused because I did not think it was a class name.

* You should never re-use a class name as a variable name. Consider the following line in CommandBase.java:

public static transmission transmission = new transmission();

While it works technically, this is confusing! Better to use the camel case class name, and then lower case for the actual instance.

* You probably want another command to shift back down - currently once you have shifted to high, there is no way back to low!

* In your "shift" command, you check if you are finished based on whether or not the current value of the solenoid has changed. This will work, but just be aware that the solenoid value will read as changed instantaneously...there is no sensor or anything to tell you when it has actually changed gears (typically it happens very quickly anyhow).
Reply With Quote