OCCRA
Go to Post When was the last time you heard of someone on their death bed talking about a great movie they saw? I think it far more likely to hear of their accomplishments, something they did to make things better. Well that's what FIRST is all about. - DougHogg [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-23-2018, 03:11 PM
RaphaelMetz RaphaelMetz is offline
Registered User
FRC #1389 (The Body Electric)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2016
Location: Maryland
Posts: 59
RaphaelMetz is an unknown quantity at this point
Inlcude a file with paths as depedencies in GradleRio

Hey all!
This year we're using GradleRio to build both our framework and robot code. We also want to load paths into pathfinder from a file on the rio. Is there a way for us to include our path files as dependencies in gradle so that we don't have to put them on the rio by ftp? Thanks!

Here's our build file https://github.com/team1389/New-Lift...r/build.gradle
Reply With Quote
  #2   Spotlight this post!  
Unread 01-23-2018, 04:13 PM
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP/Shuffleboard/WPILib. 2084 alum
FRC #2084
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2010
Location: MA
Posts: 346
SamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud ofSamCarlberg has much to be proud of
Re: Inlcude a file with paths as depedencies in GradleRio

You can add the files to your resources directory ("src/main/java/com/team1389") to include them in the JAR. Since pathfinder doesn't seem to be able to read URLs, you'll have to extract them to a file, then pass that file as a parameter to pathfinder.

Code:
public static Trajectory readTrajectory(String trajectoryName) {
  try {
    Path extractionPath = Files.createTempFile("trajectory", ".csv");
    Files.copy(Robot.class.getResourceAsStream("/com/team1389/" + trajectoryName + ".csv"), extractionPath);
    return Pathfinder.readFromCsv(extractionPath.toFile());
  } catch (IOException e) {
    // Handle it how you want
  } 
}
__________________
WPILib developer
GRIP, RobotBuilder, Shuffleboard
Reply With Quote
  #3   Spotlight this post!  
Unread 01-23-2018, 05:51 PM
Jaci's Avatar
Jaci Jaci is offline
http://imjac.in/ta/name
AKA: Jaci R Brunning
FRC #5333 (Can't C#) #5663 (Ground Control) | (OpenRIO, FRC West Aus)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Perth, Western Australia
Posts: 598
Jaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond repute
Re: Inlcude a file with paths as depedencies in GradleRio

You can also choose to send your paths over directly if you don't want them in your .jar file, like so, but replacing `project(":common")` with `project`. This will place them in /home/lvuser/paths

https://github.com/CurtinFRC/2018-Po...gradle#L15-L19
__________________
Jacinta R Brunning

Curtin FRC (5333+5663) : Head Mentor
WPILib : Developer

Website | Github
jaci.brunning@gmail.com
Reply With Quote
  #4   Spotlight this post!  
Unread 01-25-2018, 06:18 PM
RaphaelMetz RaphaelMetz is offline
Registered User
FRC #1389 (The Body Electric)
Team Role: Programmer
 
Join Date: Nov 2015
Rookie Year: 2016
Location: Maryland
Posts: 59
RaphaelMetz is an unknown quantity at this point
Re: Inlcude a file with paths as depedencies in GradleRio

Quote:
Originally Posted by Jaci View Post
You can also choose to send your paths over directly if you don't want them in your .jar file, like so, but replacing `project(":common")` with `project`. This will place them in /home/lvuser/paths

https://github.com/CurtinFRC/2018-Po...gradle#L15-L19
That was the perfect solution, thank you!
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 10:22 AM.

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


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