Go to Post You can learn just as much from building a small robot as you can from a large bot because all of the key concepts are the same. - Greg Needel [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 04-01-2012, 15:43
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
custom libraries

I'm the lead programmer for my team and I found myself copying a lot of last year's code and having to copy code for multiple projects, and I thought, why not make a library? But in trying to make one I ran into several problems:
1. Why the heck does a java FRC project only download WPILibJ to the robot and not any standard Java packages?
2. Why does FRC code have to be in JDK 1.4, which doesn't have a lot of nice features?
3. Even if I dealt with these other downsides, how to I create a separate library in NetBeans that I can include in an FRC project and build and download to the cRIO?

We can live without creating a library, but it would make future coding and updating a heck of a lot easier, and copying code for each project is just bad programming practice. Even if there isn't a way that FRC intended for people to make libraries, is there a way to "hack" the cRIO and download compiled code via FTP, which would have all the libraries and everything.
Any help is appreciated.
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");


Reply With Quote
  #2   Spotlight this post!  
Unread 04-01-2012, 16:58
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: custom libraries

1. I assume the standard Java libraries are already on the cRio with the Squawk VM.

2. Because Squawk VM is based on Java ME; Java ME is a restricted version of Java 1.3

3. Just like how you would do for any project. Just create a new package and write all your library code in there and import that package in a future project. The WPILibJ is essentially one of these.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-01-2012, 17:06
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: custom libraries

Quote:
Originally Posted by davidthefat View Post
3. Just like how you would do for any project. Just create a new package and write all your library code in there and import that package in a future project. The WPILibJ is essentially one of these.
How do you import a package from another project and add it to an FRC project's build path? I tried the project settings but I didn't see anything.
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");


Reply With Quote
  #4   Spotlight this post!  
Unread 04-01-2012, 17:13
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: custom libraries

Just right click it and copy paste it. That's what I do anyway. Probably it is proper to compile it as a jar and put in the necessary paths in the project settings, but that is too much hassle.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-01-2012, 17:53
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: custom libraries

Quote:
Originally Posted by davidthefat View Post
Just right click it and copy paste it. That's what I do anyway. Probably it is proper to compile it as a jar and put in the necessary paths in the project settings, but that is too much hassle.
That was the whole point of this though: to eliminate the need to copy and paste. While it might be a hassle now, it would save a lot of time and effort down the road.
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");


Reply With Quote
  #6   Spotlight this post!  
Unread 05-01-2012, 02:17
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: custom libraries

Quote:
Originally Posted by dbeckwith View Post
That was the whole point of this though: to eliminate the need to copy and paste. While it might be a hassle now, it would save a lot of time and effort down the road.
You are going to have to copy and paste the libraries to individual computers anyway. What I meant by copy and paste is not the individual snippets of code, but the whole folder.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
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 12:45.

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