Log in

View Full Version : Code Review - Pneumatic Gear Shifting


shawn.schwartz
26-07-2012, 04:32
Hello CD,

I have been working on programming a pneumatic gear shifting system for one of our old robots. I have never programmed pneumatics before, so I am not sure if it setup properly. We used Team 3946's pneumatic gear shifting code as a basis for ours, but are still not sure if it is setup properly.

Our code can be found at: https://github.com/team4element/6-Wheel-West-Coast-Drive

If anyone is willing to do a review of our code to see if the logic, setup, or organization is proper or wrong, please do.

Thank you so much, we would really appreciate it. :]

Jared Russell
27-07-2012, 11:09
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).

Bryce Paputa
27-07-2012, 11:23
I agree with everything that Jared said. Also, in Chassis.java


public void turnLeft() {
drive.arcadeDrive(0.0, 1.0);
}

public void turnRight() {
drive.arcadeDrive(0.0, 1.0);
}

I'm not an expert at arcade drive style, but I'm pretty sure that turnLeft() should use the parameters (0.0, -1.0). Other than those issues, Good Luck!

Also, why is the robot called "failbot"?

shawn.schwartz
28-07-2012, 00:33
Thank you guys for the excellent tips and feedback! :)

Bryce,

I am going to test the code soon once I am back at school. If it doesn't drive properly, I will test your code. Thank you for noticing a possible error.

Also, the reason it is called the "failbot" is because it is our drive base from 2007's game. Ever since then, we have used that robot for prototyping all robotic subsystems, and it never fails on us. It is simply a 6 Wheel WCD.


Thank you guys again!