Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   navX MXP Import Issue (http://www.chiefdelphi.com/forums/showthread.php?t=142167)

ejscribner 19-01-2016 21:15

navX MXP Import Issue
 
I'm working on setting up the navX on Java with our roboRIO. I've followed the steps listed in this tutorial http://www.pdocs.kauailabs.com/navx-...ibraries/java/ and I'm still getting an error with the import. Here's what the error is saying:
Code:

Buildfile: C:\Users\Developer\Documents\GitHub\DeltaBot\build.xml
Trying to override old definition of task classloader
clean:
  [delete] Deleting directory C:\Users\Developer\Documents\GitHub\DeltaBot\build
compile:
    [mkdir] Created dir: C:\Users\Developer\Documents\GitHub\DeltaBot\build
    [echo] [athena-compile] Compiling src with classpath=C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar to build
    [javac] Compiling 1 source file to C:\Users\Developer\Documents\GitHub\DeltaBot\build
    [javac] C:\Users\Developer\Documents\GitHub\DeltaBot\src\org\usfirst\frc\team2972\robot\Robot.java:22: error: package com.kauailabs.navx.frc does not exist
    [javac] import com.kauailabs.navx.frc.AHRS;
    [javac]                              ^
    [javac] C:\Users\Developer\Documents\GitHub\DeltaBot\src\org\usfirst\frc\team2972\robot\Robot.java:33: error: cannot find symbol
    [javac]    AHRS ahrs;
    [javac]    ^
    [javac]  symbol:  class AHRS
    [javac]  location: class Robot
    [javac] C:\Users\Developer\Documents\GitHub\DeltaBot\src\org\usfirst\frc\team2972\robot\Robot.java:54: error: cannot find symbol
    [javac]                    ahrs = new AHRS(SPI.Port.kMXP); 
    [javac]                              ^
    [javac]  symbol:  class AHRS
    [javac]  location: class Robot
    [javac] C:\Users\Developer\Documents\GitHub\DeltaBot\src\org\usfirst\frc\team2972\robot\Robot.java:169: error: package AHRS does not exist
    [javac]                  AHRS.BoardYawAxis yaw_axis = ahrs.getBoardYawAxis();
    [javac]                      ^
    [javac] 4 errors

BUILD FAILED
C:\Users\Developer\wpilib\java\current\ant\build.xml:69: Compile failed; see the compiler error output for details.

Total time: 3 seconds

And my import line looks like this:
Code:

import com.kauailabs.navx.frc.AHRS;
Any ideas as to what may be causing this error?

slibert 19-01-2016 21:21

Re: navX MXP Import Issue
 
I believe a step or two in the java library configuration instructions was missed, specifically these one:

1) Add a Java Build Variable for the navX-MXP Java Library. To set the build variable, from the Eclipse menu select Window->Preferences->Java->Build Path->Classpath Variables, then click on the “New…” button. Then, in the “New Variable Entry” dialog, set the name to “navx-mxp” and set the Path to <HomeDirectory>\navx-mxp\java\lib\navx_frc.jar. Hit OK to save this change.

and...

2) Ensure that your project’s library paths include the navx-mxp variable, as well as WPI library path variables (networktables and wpilib). If any are missing, you can add them by clicking on the “Add Variable…” button.

If either the "navx-mxp" build variable is not present in the Eclipse Java ClassPath Variables settings - or if your project's library paths do not include this "navx-mxp" variable, the error message you have reported is the very likely result.

ejscribner 19-01-2016 21:31

Re: navX MXP Import Issue
 
Quote:

Originally Posted by slibert (Post 1526933)
I believe a step or two in the java library configuration instructions was missed, specifically these one:

1) Add a Java Build Variable for the navX-MXP Java Library. To set the build variable, from the Eclipse menu select Window->Preferences->Java->Build Path->Classpath Variables, then click on the “New…” button. Then, in the “New Variable Entry” dialog, set the name to “navx-mxp” and set the Path to <HomeDirectory>\navx-mxp\java\lib\navx_frc.jar. Hit OK to save this change.

and...

2) Ensure that your project’s library paths include the navx-mxp variable, as well as WPI library path variables (networktables and wpilib). If any are missing, you can add them by clicking on the “Add Variable…” button.

If either the "navx-mxp" build variable is not present in the Eclipse Java ClassPath Variables settings - or if your project's library paths do not include this "navx-mxp" variable, the error message you have reported is the very likely result.

Thanks for your response! I've followed those steps and its still throwing that error. My thought is that there might be an issue with the classpath in the usage of slashes. Does it matter if they are forward or backslashes? It only seems to let me input forward slashes when I'm adding the classpath (it changes backslashes to forward slashes when I save it) but the error output seems all squirly with half forward and half backslashes as follows:

Code:

    [echo] [athena-compile] Compiling src with classpath=C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar to build
Do you think this may be a factor in the error?

slibert 19-01-2016 22:24

Re: navX MXP Import Issue
 
I don't believe the forward slashes is where the problem lies.

The navx-mxp.jar file should be in the classpath. However, I don't see it listed in the classpath in your latest message (although I do see the WPI library .jar and I do see Networktables.jar). So I think the problem is that when eclipse builds your project, it can't find navx-mxp.jar. And that is confirmed by the complaint that it can't locate the AHRS class, which is contained within the navx-mxp.jar library.

Joe Ross 19-01-2016 22:37

Re: navX MXP Import Issue
 
Please post the build.properties of the project

fovea1959 20-01-2016 12:20

Re: navX MXP Import Issue
 
since the navx jar is not showing up in the classpath, it looks like the build.properties is not set up correctly.

Quote:

[echo] [athena-compile] Compiling src with classpath=C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar to build

Joey1939 20-01-2016 12:34

Re: navX MXP Import Issue
 
I believe the issue is that WPILib doesn't know where to find the navx jar file. You must configure the build.properties as shown here.

ejscribner 20-01-2016 17:10

Re: navX MXP Import Issue
 
The build.properties seems to be setup correctly according to the FRC tutorial on adding 3rd party libraries:
Code:

# Project specific information
package=org.usfirst.frc.team2972.robot
robot.class=${package}.Robot
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world
userLibs=${user.home}/navx-mxp/java/lib/navx_frc.jar

Is there another issue that could potentially be affecting the classpath?

slibert 20-01-2016 18:25

Re: navX MXP Import Issue
 
Quote:

Originally Posted by ejscribner (Post 1527435)
The build.properties seems to be setup correctly according to the FRC tutorial on adding 3rd party libraries:
Code:

# Project specific information
package=org.usfirst.frc.team2972.robot
robot.class=${package}.Robot
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world
userLibs=${user.home}/navx-mxp/java/lib/navx_frc.jar

Is there another issue that could potentially be affecting the classpath?

Are you sure you have installed the latest, released version of the WPI Libraries (installed by updating to the latest WPI plugins in eclipse)? The 2015 WPI library, and the 2016 betas, did not include the userLibs parameter. But the 2016 release version does. So I'd recommend you check your versions.

ejscribner 20-01-2016 18:59

Re: navX MXP Import Issue
 
I checked Eclipse and found that someone had turned off automatic updates, and so I did have an older version of the WPI Libraries, however after updating I am still confronted with the same error messages. Is it possible Eclipse did not update to the true current version?

Joe Ross 20-01-2016 20:58

Re: navX MXP Import Issue
 
Quote:

Originally Posted by ejscribner (Post 1527484)
I checked Eclipse and found that someone had turned off automatic updates, and so I did have an older version of the WPI Libraries, however after updating I am still confronted with the same error messages. Is it possible Eclipse did not update to the true current version?

Does it match the version listed here: http://wpilib.screenstepslive.com/s/...ware-revisions

ejscribner 21-01-2016 17:58

Re: navX MXP Import Issue
 
Our Java plugin version is (0.1.0.201601151923) which is listed as the latest version, but the kickoff version seems to be more recent (0.1.0.201601072029). When press the update button in eclipse it says that no updates were found, but if ours is the ...23 version and there is a newer ...29 version, shouldn't it find that version and update or am I missing something? Is ...23 more recent than ...29?

Thad House 21-01-2016 18:16

Re: navX MXP Import Issue
 
Quote:

Originally Posted by ejscribner (Post 1527991)
Our Java plugin version is (0.1.0.201601151923) which is listed as the latest version, but the kickoff version seems to be more recent (0.1.0.201601072029). When press the update button in eclipse it says that no updates were found, but if ours is the ...23 version and there is a newer ...29 version, shouldn't it find that version and update or am I missing something? Is ...23 more recent than ...29?

The whole last number is a date string, so 201601072029 was built on January 7th, whereas 201601151923 was built on January 15th. So you do have the newest version.

ejscribner 21-01-2016 18:36

Re: navX MXP Import Issue
 
Okay so we know the eclipse plugins are up to date. My error message has changed slightly to reflect that it is finding some sort of navX library, or at least its looking for one, as you can see below:

Code:

    [echo] [athena-compile] Compiling src with classpath=C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar:C:\Users\Developer
    [echo] avx-mxpjavalib
    [echo] avx_frc.jar to build

So now its looking for something in C:\Users\Developer\avx-mxpjavalib or \avx_frc.jar so I can clearly see that something is misspelled due to the "avx" instead of "navx" but I cant seem to find where it is misspelled. Where do I edit the filepath for this so that it is correct?

slibert 21-01-2016 18:47

Re: navX MXP Import Issue
 
Quote:

Originally Posted by ejscribner (Post 1528010)
Okay so we know the eclipse plugins are up to date. My error message has changed slightly to reflect that it is finding some sort of navX library, or at least its looking for one, as you can see below:

Code:

    [echo] [athena-compile] Compiling src with classpath=C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar:C:\Users\Developer
    [echo] avx-mxpjavalib
    [echo] avx_frc.jar to build

So now its looking for something in C:\Users\Developer\avx-mxpjavalib or \avx_frc.jar so I can clearly see that something is misspelled due to the "avx" instead of "navx" but I cant seem to find where it is misspelled. Where do I edit the filepath for this so that it is correct?

OK, we're making progress - now that you've got the correct WPI library version, the build is attempting to link to the navx library. But it appears that the path is wrong:

Here's what you entered in your build.properties:

userLibs=${user.home}/navx-mxp/java/lib/navx_frc.jar

But it appears that when eclipse is building, each time the "/n" characters are encountered, those characters are being treated as a new-line character.

It's interesting to note that the \n sequence (where \ is an 'escape' character) translates to an ascii new-line character, which is what eclipse appear to be outputting.

This is likely a system-specific configuration issue, and I'm going to recommend trying it on another system - or else identifying what it is in your system that is interpreting "/n" in file system paths as a new line character. I've see this kind of thing happen sometimes if a package like Cygwin is installed, although I can't remember the details off of the top of my head.


All times are GMT -5. The time now is 03:18.

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