Go to Post I love the dedication of Robotics kids. :) - Danielle H [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 14-01-2015, 19:28
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Creating a custom library for robot code in Eclipse

I am trying to make a library of various classes my team has made during the off season which we think will be useful in the future. Rather than having to copy the classes into each new project (potentially causing the versions in older code to become outdated), we would like to create a library on our github that we could put into every robot project we make. So far I have been able to create a .jar file that can be imported into a normal java project, but when I try to put it into a FRC project it does not allow me to use the contained classes. Is there any way that I could make this work?
Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2015, 13:02
Oromus's Avatar
Oromus Oromus is offline
Lead Programmer, Community Liason
AKA: Ryan
FRC #1902 (Exploding Bacon)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Florida
Posts: 82
Oromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to behold
Re: Creating a custom library for robot code in Eclipse

Can you post an image of what you're seeing when you add the .jar to the FRC project? Also, I will bring up the fact that you're not allowed to use or reuse code made before the build season without making it publicly available to whoever wants it.

"Software and mechanical/electrical designs created before Kickoff are only permitted if the source files (complete information
sufficient to produce the design) are available publicly prior to Kickoff." - Rule 13, Section 4 - The Robot, page 34 of the Game Manual.

Last edited by Oromus : 21-01-2015 at 13:04. Reason: Changes :)
Reply With Quote
  #3   Spotlight this post!  
Unread 21-01-2015, 13:13
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Creating a custom library for robot code in Eclipse

This is possible to do. As part of beta testing last year, we built a library for controlling swerve drive (not completely finished and not ready for prime time yet), included it in a robot project, and pushed everything to the roboRIO.

Build the library as a jar, and include it as a dependency in the eclipse project. That'll make eclipse happy so you don't get a bunch of errors.

The key for getting it to the roboRIO is the config file that's used to build everything. I can copy in an example tonight from our build space... Basically, the file contains a list of jars (among other things) to include (wpilib.jar, etc), and you need to include your custom jar in the list. Pretty simple once you know how to do it, and if you update the jar it'll automatically be included the next time you deploy.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #4   Spotlight this post!  
Unread 21-01-2015, 19:29
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Creating a custom library for robot code in Eclipse

As promised... when you create your Java project, you should see a build.properties file. Open that up, and you'll see something similar to:
Quote:
# Project specific information
package=org.usfirst.frc.team2177.robot
robot.class=${package}.Robot
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world
To get the jar's copying to the roboRIO correctly, add a line for the classpath and include all jars (including wpilib and networktables!):

Quote:
# Project specific information
package=org.usfirst.frc.team2177.robot
robot.class=${package}.Robot
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world
classpath=../WPILib.jar:../NetworkTables.jar:../minnesota_swerve.jar
Please note that the classpath needs the correct path to each jar file - in this example, we had copied out the WPILib and NetworkTables jars to someplace a little easier for us to reference than the default location. The relative path is from the project folder. I've bolded the custom jar we added.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
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:37.

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