Go to Post Learning from the innovations of others is part of what makes FRC great, regardless of your own teams accomplishments or lack thereof. - hg273 [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 22-05-2016, 16:22
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Code Review: Semi-Novice

Quote:
Originally Posted by Lireal View Post
The major issue I see with your code is that you are using the sybsystems and RobotMap completely wrong. Your RobotMap should only really include numbers. All of your motor controllers, sensors, etc. should be a in your subsystems. Read through these examples and you will see how to do it: https://wpilib.screenstepslive.com/s.../13809/c/88893
RobotMap does not necessarily need to only have numbers. In fact, RobotBuilder puts all the motor controller definitions in RobotMap, and then includes references to them in each subsystem. I don't necessarily think this is the best way to do it, but I would definitely say that it is not "wrong" to put things other than numbers in RobotMap.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #2   Spotlight this post!  
Unread 22-05-2016, 19:45
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 348
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Code Review: Semi-Novice

This isn't really a code thing, but it's best practice in git to exclude anything binary (your bin, build, and dist) folders. You can use a .gitignore file to do this.

General
- You've got some redundant/unnecessary classes. Instead of things like IntakeIn and IntakeOut you could have a generic IntakeRoll that accepts an enum parameter for in or out.
- When using booleans in if blocks, you don't need an "== true"
So instead of
Code:
if(pSwitch.get() == true) { ... }
You'd do
Code:
if(pSwitch.get()) { ... }
And instead of
Code:
if(RobotMap.intakeOutSwitch.get() == false) { ... }
You'd do
Code:
if(!RobotMap.intakeOutSwitch.get()) { ... }
OI.java
- Using an array of joystick buttons might be neater

Robot.java
- What is pSwitch? A better variable name would help. Also the channel is hardcoded
- You store joystick buttons here. Those should be in OI

RobotMap.java
- You name some channel numbers "driveVictorX" and then create a Talon object with them
- Then you name your lift motor channel "liftTalon" and create a Victor from it
- Intake switches are hardcoded

Subsystems
- I agree with the design choice of having subsystems store hardware objects (instead of RobotMap), but it's really up to you.

Note that these are best practices/recommendations. It's difficult to write software well, and even our own code doesn't really meet these standards (especially as we piled on more and more mid-competition hacks)

Last edited by euhlmann : 22-05-2016 at 19:48.
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 22:43.

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