PDA+JAVA+GPS+LEGO NXT Building Robots with Java brains book

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

PDA+JAVA+GPS+LEGO NXT Building Robots with Java brains book

Postby marcin.kasinski » Sat Jul 14, 2007 9:10 am

Hi I have strange problem with my very simple application.

I bought book "LEGO NXT Building Robots with Java brains".
There is GPS chapter.

According to this chapter I tried to run simple application on PDA.

This application use gpsylon GPS lib.

Problem is that when I use code below I got error:

Message is quite simple but problem is that this class exist in jar file.


I use Mysaifu JVM.

CLASSPATH is set correctly.
I don't know what to do with it.


Code: Select all
0
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/dinopolis/gpstool/gpsinput/GPSGeneralDataProcessor
   at GPSTest.main(GPSTest.java)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:355)
   at java.lang.VMMainThread$1.run(VMMainThread.java)
   at java.lang.VMThread.run(VMThread.java:120)
JVM exit.




Application code :

Code: Select all
import org.dinopolis.gpstool.gpsinput.*;
import org.dinopolis.gpstool.gpsinput.nmea.*;
import java.util.*;
import java.beans.*;




public class GPSTest {

    public static void main(String[] args) {
        System.out.println("0");
       
        GPSDataProcessor nmeaReader = new GPSNmeaDataProcessor();
        System.out.println("1");

        Hashtable settings = new Hashtable();

        System.out.println("2");
settings.put(GPSSerialDevice.PORT_NAME_KEY,"COM1");

settings.put(GPSSerialDevice.PORT_SPEED_KEY,new Integer(4800));

GPSDevice myGPS = new GPSSerialDevice();
System.out.println("3");
       
       
        try{
            myGPS.init(settings);
            nmeaReader.setGPSDevice(myGPS);
            nmeaReader.open();
        }
        catch(GPSException e)
        {
            System.out.println("Error "+e);
        }
       
        PropertyChangeListener gps_listener = new PropertyChangeListener()
        {
           
            public void propertyChange(PropertyChangeEvent e) {
            Object obj = e.getNewValue();
            String propertyType=e.getPropertyName();
           
            if(propertyType.equals(GPSDataProcessor.LOCATION)) {
                GPSPosition pos =(GPSPosition)obj;
                System.out.println("Latitude :"+pos.getLatitude());
                System.out.println("Longitude :"+pos.getLongitude());

            }
               
               
            }
        };
        nmeaReader.addGPSDataChangeListener(GPSDataProcessor.LOCATION, gps_listener);
    }//main
}
marcin.kasinski
New User
 
Posts: 20
Joined: Sat Jul 14, 2007 9:04 am

Postby juliac » Sat Jul 14, 2007 2:57 pm

Are you following this

http://www.tegmento.org/gpsylon/#installation

You need to make sure you run the scripts to for the native support for serial support. It looks like it is failing on that part.
Ships are safe inside the harbor.
juliac
New User
 
Posts: 12
Joined: Sat Jul 14, 2007 4:07 am

Postby marcin.kasinski » Sat Jul 14, 2007 3:05 pm

juliac wrote:Are you following this

http://www.tegmento.org/gpsylon/#installation

You need to make sure you run the scripts to for the native support for serial support. It looks like it is failing on that part.


I think instalattion is OK,

There is another example Serial.java which show native raw GPS data , and it works fine.

I do not need raw data. I don't want to write API to parse it.
That's why I would like to use API which shows just needed localisation data.
marcin.kasinski
New User
 
Posts: 20
Joined: Sat Jul 14, 2007 9:04 am

I tried your example here and it runs

Postby juliac » Sat Jul 14, 2007 4:02 pm

I'm using OS X

And I compiled your code with

Code: Select all
javac -cp gpsylon-0.5.3.jar GPSTest.java


And then I ran it with

Code: Select all
java -cp gpsylon-0.5.3.jar:. GPSTest


and got the following output

Code: Select all
0
1
2
3
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Error org.dinopolis.gpstool.gpsinput.GPSException: port 'COM1' not available.


I can hook up a GPS later later today, but the fact that it didn't error out on creating the object shows that it at least runs.

I would suggest taking this to the gpsylon people and asking them for more help.
Ships are safe inside the harbor.
juliac
New User
 
Posts: 12
Joined: Sat Jul 14, 2007 4:07 am

Re: I tried your example here and it runs

Postby marcin.kasinski » Sat Jul 14, 2007 4:24 pm

Thanks,

I have similar output on Win (workstation). It works.

Problem is that it doesn't work on my PDA (Windows Mobile 2003)
marcin.kasinski
New User
 
Posts: 20
Joined: Sat Jul 14, 2007 9:04 am

Postby juliac » Sat Jul 14, 2007 5:27 pm

I'd like to continue to help, but I can't find the RXTX library for my PDA.

Sorry.
Ships are safe inside the harbor.
juliac
New User
 
Posts: 12
Joined: Sat Jul 14, 2007 4:07 am

Postby marcin.kasinski » Sat Jul 14, 2007 5:50 pm

juliac wrote:I'd like to continue to help, but I can't find the RXTX library for my PDA.

Sorry.


Thanks.

With PDA you have to use Java Communication API, not RXTX.

http://www.cs.uml.edu/~fredm/courses/91 ... etup.shtml

All needed resources I placed here:

http://itzone.com.pl/tmp/

Standard gpsylon lib is prepared for WIN workstartion (it uses RXTX).
To use it with PDA you have to recompile it.

Recompiled code is placed here:

http://itzone.com.pl/tmp/gpsinput-0.5.3PDA.jar
marcin.kasinski
New User
 
Posts: 20
Joined: Sat Jul 14, 2007 9:04 am

Postby juliac » Sat Jul 14, 2007 6:02 pm

You've deviated way beyond what I'm prepared to do as an innocent bystander, sorry. Once again, I'm going to refer you to the original site for the libraries your using. You are recompiling their code with yet other libraries than they used.

None of this even uses stuff in leJOS (yet).
Ships are safe inside the harbor.
juliac
New User
 
Posts: 12
Joined: Sat Jul 14, 2007 4:07 am

Postby marcin.kasinski » Sat Jul 14, 2007 6:18 pm

juliac wrote:You've deviated way beyond what I'm prepared to do as an innocent bystander, sorry. Once again, I'm going to refer you to the original site for the libraries your using. You are recompiling their code with yet other libraries than they used.

None of this even uses stuff in leJOS (yet).


Thanks

I found detailed description how to of use gpsylon on PDA on "LEGO NXT Building Robots with Java Brains" book by Brian Bagnall.

He wrote that if you are trying to use this lib with PDA you will need to change this lib and replace RXTX by JAVA Communication API.

Then he put detailed description what you have to change (a few imports in one class).
marcin.kasinski
New User
 
Posts: 20
Joined: Sat Jul 14, 2007 9:04 am

Postby juliac » Sat Jul 14, 2007 6:33 pm

Maybe someone else can help then. I've been unable to get a copy of the book. The local book stores don't have a copy, I've been looking for months. And inter-library loan told me it was too new to request.

Good luck with your project.
Ships are safe inside the harbor.
juliac
New User
 
Posts: 12
Joined: Sat Jul 14, 2007 4:07 am


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 5 guests

more stuff