![]() |
Code Review - Pneumatic Gear Shifting
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-Wh...st-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. :] |
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). |
Re: Code Review - Pneumatic Gear Shifting
I agree with everything that Jared said. Also, in Chassis.java
Code:
public void turnLeft() {Also, why is the robot called "failbot"? |
Re: Code Review - Pneumatic Gear Shifting
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! |
| All times are GMT -5. The time now is 09:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi