Go to Post note to self: MUST try harder to be funnier... - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-05-2013, 10:04
sirchadwick sirchadwick is offline
Registered User
AKA: Chad Schmidt
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Nov 2012
Rookie Year: 2005
Location: Chicago
Posts: 5
sirchadwick is on a distinguished road
Team 111 Wildstang 2013 Robot Code (Java)

Similar to Team 254, we also decided to switch to Java from C++ this year. Java is easier to teach, many students already had some instruction in school, and the students can grasp the concepts faster. Also the students and mentors could work on both Windows or Mac computers.

After the initial heartburn from Squawk's and Java ME's limitations, we feel the change was a success and will continue using Java in future years. I would recommend it for any team thinking about making the switch. However, they should understand how limited this version of Java really is. We lost about 2 weeks just trying to get basic functionality to compile and run because the compile/run time error messages are very cryptic. It took examining the WPI libraries design patterns and their use of this "Java" to understand how to recreate "simple" things like an unsynchronized List or a way to do a type-safe "enum".

Without further ado..........

https://github.com/wildstang111/2013_robot_software

The repository contains two Netbeans projects; crioTarget and WsSimulation. The crioTarget is what is run on the robot. The WsSimulation links against the crioTarget and replaces many of WPI classes with its own stub or simulation implementation.

The robot framework was designed using the Subject/Observer object oriented design pattern and inputs and outputs can notify any registered object when they change. To keep things simple and synchronous, all updates occurred during the 20 ms periodic loop.

The simulation allows the software team to test all of its logic before loading it on the hardware. The simulation was originally based on the project frcjcss ( https://code.google.com/p/frcjcss/ ) released under GNU GPL v3. frcjcss stubbed out a lot of the classes from the WPI library like Victors, Solenoids, Relays, and Joysticks and got us quickly started in getting our cRio code running on the desktop. Our adapted version simulates a variety of hardware including the drive encoders, flywheel encoders, gyro, and limit switches to test proper control schemes. frcjcss had an onscreen joystick and we added support for a USB joystick for inputs. The USB joysticks are supported using the javahidapi project (https://code.google.com/p/javahidapi/) released under the BSD license. We used two different PS3/Xbox type controllers and aside from the Directional Pad (see known issues), all buttons and axises read as expected.

After the build season, it was determined that the SmartDashboard would work by linking in the desktop version of the Smartdashboard/Network table jars into the Simulation. SmartDashboard justs needs to be started with the command line parameter for the ip as localhost. This greatly impacts the entire UI and alot of the single UI windows can be removed.

Feel free to ask any questions or point out any issues. There is already a growing list of known issues.
  #2   Spotlight this post!  
Unread 09-05-2013, 10:41
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Team 111 Wildstang 2013 Robot Code (Java)

This is awesome. Thank you guys so much for sharing this. I'll be looking over it the next few days
__________________
All opinions are my own.
  #3   Spotlight this post!  
Unread 09-05-2013, 11:38
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: Team 111 Wildstang 2013 Robot Code (Java)

Thanks for releasing this to the community. My team just switched from LabVIEW to C++ this past year, and we're looking at Java for next year, so it's been very helpful to have access to full robot programs from teams like you guys and 254.
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

  #4   Spotlight this post!  
Unread 09-05-2013, 13:07
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Team 111 Wildstang 2013 Robot Code (Java)

I'm curious why every class name starts with Ws. I'd think that your programmers know it's wildstang's code.
__________________
All opinions are my own.
  #5   Spotlight this post!  
Unread 09-05-2013, 13:30
sirchadwick sirchadwick is offline
Registered User
AKA: Chad Schmidt
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Nov 2012
Rookie Year: 2005
Location: Chicago
Posts: 5
sirchadwick is on a distinguished road
Re: Team 111 Wildstang 2013 Robot Code (Java)

It started when we would want to "wrap" WPI code with additional functionality and want to easily see we were using the wrapped version. (ie WsTimer wraps Timer)

For all the other files, it doesn't make sense outside of habit and that code completion can be limited only to "Wildstang" results quickly by just typing the prefix + first letter and then Ctrl + Space.

It did get out of hand with prefixes though in some cases like typing WsAutonomousStep before every type of auto step got annoying and should have been shorter .
  #6   Spotlight this post!  
Unread 09-05-2013, 13:59
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Team 111 Wildstang 2013 Robot Code (Java)

Makes sense. I'm seeing a lot of weird naming conventions in the code. I assume that's just due to a different standard that was started on your team or just transferring to Java. This is what the standard for Java is.
__________________
All opinions are my own.
  #7   Spotlight this post!  
Unread 09-05-2013, 14:04
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Team 111 Wildstang 2013 Robot Code (Java)

Another quick question, it looks like you have a lot of "preferences" in your config file. How did you manage so many values in one file? We found ourselves using 2-3 files for different things and we didn't have nearly as many things to save.
__________________
All opinions are my own.
  #8   Spotlight this post!  
Unread 09-05-2013, 15:05
sirchadwick sirchadwick is offline
Registered User
AKA: Chad Schmidt
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Nov 2012
Rookie Year: 2005
Location: Chicago
Posts: 5
sirchadwick is on a distinguished road
Re: Team 111 Wildstang 2013 Robot Code (Java)

Our standard naming convention had evolved over the years from C++. Last year we were really strict about holding to it and even had a tool to reformat it to be more like the standard. This year.....not so much.

We had so many other issues with the transition to java that it was never even really considered. We definitely missed the mark there. There are some really weird things in there.

It could definitely be improved and I will look over the Java standard again.
  #9   Spotlight this post!  
Unread 09-05-2013, 15:15
sirchadwick sirchadwick is offline
Registered User
AKA: Chad Schmidt
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Nov 2012
Rookie Year: 2005
Location: Chicago
Posts: 5
sirchadwick is on a distinguished road
Re: Team 111 Wildstang 2013 Robot Code (Java)

We didn't really have any issues managing the one preference file. A lot of them were "tuned" during the first use and then never touched again.

What were the issues you guys were having with the one file? Simply sheer quantity from the user side or read/lookup time from the software side?

The auton parameters were the ones we were constantly changing. Originally the file was even worse when we had separate parameters for each program regardless if it was just a variant of 5 disc. Rather late in the season, we condensed them and were able to remove about 300 parameters, which had become unmanageable.
  #10   Spotlight this post!  
Unread 09-05-2013, 15:36
SteveGarward's Avatar
SteveGarward SteveGarward is offline
Red 5, standing by...
AKA: 7 years already
FRC #0111 (WildStang), FRC #3132 (Thunder Down Under)
Team Role: Mentor
 
Join Date: Dec 2009
Rookie Year: 2010
Location: Gurnee, IL
Posts: 173
SteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud ofSteveGarward has much to be proud of
Re: Team 111 Wildstang 2013 Robot Code (Java)

Quote:
Originally Posted by joelg236 View Post
Makes sense. I'm seeing a lot of weird naming conventions in the code. I assume that's just due to a different standard that was started on your team or just transferring to Java. This is what the standard for Java is.
There is a difference between a convention and a standard. Conventions say 'most people are doing it this way', whereas standards say 'you must do it this way'.

Most differences between our code and the Java conventions are likely because the code was at first ported from C++, and people were familiar with that. In any case, there is nothing wrong with having a team standard different from normal conventions. The important part is that everyone working with the code knows what the standard is and sticks to it.
__________________
FRC Team 111 - WildStang (Mentor, Drive Coach)
FTC Team 7458 - Full Force! (Mentor, Coach)
FRC Team 3132 - Australia's FIRST FRC Team! (Holy crazy first year, Batman!)

  #11   Spotlight this post!  
Unread 09-05-2013, 16:00
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Team 111 Wildstang 2013 Robot Code (Java)

Quote:
Originally Posted by sirchadwick View Post
What were the issues you guys were having with the one file? Simply sheer quantity from the user side or read/lookup time from the software side?
We had problems with both. Read time isn't crazy when using FileZilla (since local copies are saved), but upload time was a concern since we were constantly changing things in queue (and didn't want to mess up anything before a match).

That coupled with it taking very long just to find a property (Ctrl-F with the classmate is slow).

Quote:
Originally Posted by SteveGarward View Post
...
Yeah, sorry if the terminology wasn't exactly accurate. I was mostly curious why you went with a different standard than is convention. Most classes just stick with what is convention, so I'd assume your students were used to that.
__________________
All opinions are my own.
  #12   Spotlight this post!  
Unread 09-05-2013, 16:06
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Team 111 Wildstang 2013 Robot Code (Java)

Quote:
Originally Posted by sirchadwick View Post
It took examining the WPI libraries design patterns and their use of this "Java" to understand how to recreate "simple" things like an unsynchronized List or a way to do a type-safe "enum".
There is an unsynchronized List class in edu.wpi.first.wpilibj.networktables2.util.List.
__________________
All opinions are my own.
  #13   Spotlight this post!  
Unread 09-05-2013, 16:32
sirchadwick sirchadwick is offline
Registered User
AKA: Chad Schmidt
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Nov 2012
Rookie Year: 2005
Location: Chicago
Posts: 5
sirchadwick is on a distinguished road
Re: Team 111 Wildstang 2013 Robot Code (Java)

Quote:
Originally Posted by joelg236 View Post
There is an unsynchronized List class in edu.wpi.first.wpilibj.networktables2.util.List.
Exactly. Fortunately we didn't end up having to "create" it after we looked through the NetworkTable source for what they did and saw that they already created one. That's what we used once we found it. Finding it was the trick.
  #14   Spotlight this post!  
Unread 09-05-2013, 17:05
apples000's Avatar
apples000 apples000 is offline
Registered User
no team
 
Join Date: Mar 2012
Rookie Year: 2012
Location: United States
Posts: 222
apples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant futureapples000 has a brilliant future
Re: Team 111 Wildstang 2013 Robot Code (Java)

Just a quick question, when you use the I2C communication in WsLED, are you communicating directly to an addressable LED strip, or are you communicating to something like an arduino/basic stamp, then to the LED strip?
  #15   Spotlight this post!  
Unread 09-05-2013, 17:10
nathanwalters nathanwalters is offline
Registered User
FRC #0111 (WildStang)
Team Role: Alumni
 
Join Date: Dec 2011
Rookie Year: 2011
Location: United States
Posts: 75
nathanwalters has much to be proud ofnathanwalters has much to be proud ofnathanwalters has much to be proud ofnathanwalters has much to be proud ofnathanwalters has much to be proud ofnathanwalters has much to be proud ofnathanwalters has much to be proud ofnathanwalters has much to be proud of
Re: Team 111 Wildstang 2013 Robot Code (Java)

Quote:
Originally Posted by joelg236 View Post
We had problems with both. Read time isn't crazy when using FileZilla (since local copies are saved), but upload time was a concern since we were constantly changing things in queue (and didn't want to mess up anything before a match).
I'm curious as to what issues you had with upload time. Using FTP from the command prompt was very fast for me. The transfer itself took only about half a second; I could do the entire process in about 9 seconds flat. Your file must have been very big if upload time was a concern
Closed Thread


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 03:24.

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