Go to Post FIRST is the only high-school sport where everyone can become a pro - David Brinza [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-26-2012, 04:32 AM
shawn.schwartz's Avatar
shawn.schwartz shawn.schwartz is offline
Lead Systems Engineer
FRC #0004 (Team 4 ELEMENT)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2011
Location: Lake Balboa, CA
Posts: 27
shawn.schwartz is an unknown quantity at this point
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.
__________________
Shawn Schwartz
Programming/Head of Website & Media, Team 4 ELEMENT
team4element.com
"Innovation distinguishes between a leader and a follower." -Steve Jobs
Reply With Quote
  #2   Spotlight this post!  
Unread 07-27-2012, 11:09 AM
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,069
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
  #3   Spotlight this post!  
Unread 07-27-2012, 11:23 AM
Bryce Paputa's Avatar
Bryce Paputa Bryce Paputa is offline
FF TSL: Frog Farce
FRC #0503 (Frog Force)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Novi Michigan
Posts: 454
Bryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond reputeBryce Paputa has a reputation beyond repute
Re: Code Review - Pneumatic Gear Shifting

I agree with everything that Jared said. Also, in Chassis.java

Code:
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"?
Reply With Quote
  #4   Spotlight this post!  
Unread 07-28-2012, 12:33 AM
shawn.schwartz's Avatar
shawn.schwartz shawn.schwartz is offline
Lead Systems Engineer
FRC #0004 (Team 4 ELEMENT)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2011
Location: Lake Balboa, CA
Posts: 27
shawn.schwartz is an unknown quantity at this point
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!
__________________
Shawn Schwartz
Programming/Head of Website & Media, Team 4 ELEMENT
team4element.com
"Innovation distinguishes between a leader and a follower." -Steve Jobs
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:26 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi