OCCRA
Go to Post FIRST is like riding a bike. At first it may seem hard and confusing, but after a few tries you get the hang of it and its smooth sailing from then on out. - Tom Bottiglieri [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 05-16-2018, 03:52 PM
mjbergman92's Avatar
mjbergman92 mjbergman92 is offline
Registered User
AKA: Malachi
FRC #3534 (House of Cards)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2016
Location: Michigan
Posts: 21
mjbergman92 is an unknown quantity at this point
Help! Pathfinder one my computer

So I am currently working on a very simple graphing of jaci's pathfinder trajectories. Here is the deal. I keep getting the "Exception in thread "main" java.lang.UnsatisfiedLinkError: no pathfinderjava in java.library.path" exception. I have the .jar file and the .so file because I am not running GradleRIO. I don't know if the problem is the fact that it is not the robot and the native libraries only work on the robot. I'm so confused and I have dived to deep into this. I just want to have my code work. This is it if you need it.

Code:
package Main;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.event.ChartChangeEvent;
import org.jfree.chart.event.ChartChangeListener;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.RectangleInsets;

public class GraphTrajectory {

	static double prevTime;
	static double originalTime = System.currentTimeMillis();
	static boolean run = true;
	static boolean disabled = false;
	
	public static void main(String args[]) {
		
		final TrajectorySetup trajectorySetup = new TrajectorySetup();
		trajectorySetup.setup();
		
		//create and configure the window
		JFrame window = new JFrame();
		window.setTitle("Trajectory GUI");
		window.setSize(1200,1000);
		window.isResizable();
		window.setLayout(new BorderLayout());
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		
		final JButton button = new JButton("Load");
		window.add(button,BorderLayout.NORTH);
		
		//create xy line graph
		final XYSeries leftSeries = new XYSeries("Left To Right Movement");
		final XYSeries rightSeries = new XYSeries("Forward to Backward Movement");
		XYSeriesCollection dataset = new XYSeriesCollection(leftSeries);
		dataset.addSeries(rightSeries);
		JFreeChart chart = ChartFactory.createXYLineChart("X", "Y", "Percent Input", dataset);
		window.add(new ChartPanel(chart),BorderLayout.CENTER);
		
		
		
		button.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				if(button.getText().equals("Load")) {
					
					button.setText("End");
					run = true;
					disabled = false;
					Thread thread = new Thread() {
						@Override public void run() {
							while(run) {
								if(System.currentTimeMillis() - prevTime >= 0.020) {
									try {
										leftSeries.add(trajectorySetup.leftXTrajectory(), trajectorySetup.leftYTrajectory());
										rightSeries.add(trajectorySetup.rightXTrajectory(), trajectorySetup.rightYTrajectory());
										prevTime = System.currentTimeMillis();
									}catch(Exception e) {}
								}
							}
						}
					};
				thread.start();
				}else if(button.getText().equals("End")){
					Thread starterThread = new Thread() {
						@Override public void run() {
							button.setText("Load");
							run = false;
							disabled = true;
						}
					};
					starterThread.start();
				}
			}
			
		});
		
		
		
		
		
		
		//show the window
		window.setVisible(true);
		button.doClick();
		
	}
}
Code:
package Main;

import jaci.pathfinder.Pathfinder;
import jaci.pathfinder.Trajectory;
import jaci.pathfinder.Waypoint;
import jaci.pathfinder.Trajectory.FitMethod;
import jaci.pathfinder.modifiers.TankModifier;

public class TrajectorySetup {
	
	double wheelBase_width = 30;
	Trajectory left, right;
	Trajectory.Segment segLeft, segRight;
	
	public TrajectorySetup() {
		
	}
	
	public void setup() {
		Waypoint[] points = new Waypoint[] {
				new Waypoint(0,0,90),
				new Waypoint(0,55,90)
		};
		Trajectory.Config config = new Trajectory.Config(FitMethod.HERMITE_CUBIC, 10000, 0.020, 4, 1, 0.5);
		Trajectory trajectory = Pathfinder.generate(points, config);
		TankModifier modifier = new TankModifier(trajectory);
		modifier.modify(wheelBase_width);
		left = modifier.getLeftTrajectory();
		right = modifier.getRightTrajectory();
	}
	
	public double leftXTrajectory() {
		for (int i = 0; i < left.length(); i++) {
			   segLeft = left.get(i);    
			}
			return segLeft.x;
	}
	
	public double leftYTrajectory() {
		for (int i = 0; i < left.length(); i++) {
			   segLeft = left.get(i);    
			}
			return segLeft.y;
	}
	
	public double rightXTrajectory() {
		for (int i = 0; i < right.length(); i++) {
			   segRight = right.get(i);    
			}
			return segRight.x;
	}
	
	public double rightYTrajectory() {
		for (int i = 0; i < right.length(); i++) {
			   segRight = right.get(i);    
			}
			return segRight.y;
	}

}
I have referenced Pathfinder and my other two jar that I need to run the graph, which those two run fine and I don't have any problems with them. I just can not run anything on my computer with the pathfinder.
Reply With Quote
  #2   Spotlight this post!  
Unread 05-20-2018, 11:35 AM
Endoman123 Endoman123 is offline
Registered User
FRC #1089
 
Join Date: Jan 2017
Location: East Windsor, New Jersey
Posts: 3
Endoman123 is an unknown quantity at this point
Re: Help! Pathfinder one my computer

You've answered your own question I believe: the reason that you're getting the UnsatisfiedLinkError is because the native library file isn't found on the robot. If you push that file to the robot in the same directory that you push the robot code JAR (i.e.: /home/lvuser/) you should be good.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-20-2018, 11:39 AM
Endoman123 Endoman123 is offline
Registered User
FRC #1089
 
Join Date: Jan 2017
Location: East Windsor, New Jersey
Posts: 3
Endoman123 is an unknown quantity at this point
Re: Help! Pathfinder one my computer

Whoops, read your question wrong, but you still got your question right; the native library I believe is built for Linux Athena which is the OS for the RIO. You need to build the natives for your specific OS.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-21-2018, 01:23 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: Help! Pathfinder one my computer

The 1.5 release on GitHub appears to have a JAR file with JNI builds for the big 3 operating systems.
__________________
WPILib developer
GRIP, RobotBuilder, Shuffleboard
Reply With Quote
  #5   Spotlight this post!  
Unread 05-23-2018, 09:13 AM
mjbergman92's Avatar
mjbergman92 mjbergman92 is offline
Registered User
AKA: Malachi
FRC #3534 (House of Cards)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2016
Location: Michigan
Posts: 21
mjbergman92 is an unknown quantity at this point
Re: Help! Pathfinder one my computer

The problem was the fact that I had not yet done cd /User/.../Pathfinder-Core/
then ./gradlew build. Then I just linked the jar file in my project in eclipse to the native libraries under the /build/.../shared/ folders in both Pathfinder-Core and Pathfinder-java. Then I was good. I hope the helps others. You can message me with any questions you may have. I will try to answer them.
Reply With Quote
  #6   Spotlight this post!  
Unread 05-23-2018, 09:19 AM
mjbergman92's Avatar
mjbergman92 mjbergman92 is offline
Registered User
AKA: Malachi
FRC #3534 (House of Cards)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2016
Location: Michigan
Posts: 21
mjbergman92 is an unknown quantity at this point
Re: Help! Pathfinder one my computer

Im going to try to embed my youtube video here. If it doesn't work, oh well

Reply With Quote
  #7   Spotlight this post!  
Unread 05-23-2018, 09:21 AM
mjbergman92's Avatar
mjbergman92 mjbergman92 is offline
Registered User
AKA: Malachi
FRC #3534 (House of Cards)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2016
Location: Michigan
Posts: 21
mjbergman92 is an unknown quantity at this point
Re: Help! Pathfinder one my computer

Whatever. The link to my video is https://www.youtube.com/embed/ySsRsQlooWY
Reply With Quote
  #8   Spotlight this post!  
Unread 06-08-2018, 09:22 PM
cpapplefamily's Avatar
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 707
cpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to beholdcpapplefamily is a splendid one to behold
Re: Help! Pathfinder one my computer

I have just started to look at pathfinding and Motion Profiling and all this GREAT Drive control stuff. I want to deliver this to the team and help students understand as well. There are currently two threads talking about this and this one seemd to touch on the step I'm currently hung on.

On the Github page for installing the files I don't understand what I'm to do here:
Code:
Building / Installing on your Architecture
If you want to use Pathfinder on your system, you will have to build the library for your platform. You can do this with the following:

./gradlew build
The native libraries will be located under ./Pathfinder-Core/build/libs/pathfinder/ (shared and static libs, platform=any64) and ./Pathfinder-Java/build/libs/pathfinderjava/shared/any64. If you're using native shared (or java), you must put these somewhere on your system load path (e.g. Mac/Linux = /usr/local, Windows = Somwhere on PATH)
Feels like this is what I'm to do:
Quote:
Originally Posted by mjbergman92
The problem was the fact that I had not yet done cd /User/.../Pathfinder-Core/
then ./gradlew build.
__________________
It makes sense in my mind.



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 02:42 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