Icommand setup problems

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

Moderators: 99jonathan, roger, imaqine

Icommand setup problems

Postby treeface99 » Tue Jan 24, 2012 9:43 pm

Hi, I have spent AGES playing around with eclipse trying to set up Icommand. I have followed a couple of tutorials but am still experiencing problems. These are the errors that I am receiving:

Linking ...
js.tinyvm.TinyVMException: Class javax.bluetooth.UUID (file javax/bluetooth/UUID.class) not found in CLASSPATH C:\Program Files (x86)\leJOS NXJ\lib\nxt\classes.jar;C:\Users\Will\workspace\TEST\bin;C:\Users\Will\workspace\Sphinx4\bin\lib\sphinx4.jar;C:\Users\Will\Documents\cmp year 3\LEGO ROBOTS PROJECT\icommand-0.7\icommand-0.7\dist\icommand.jar;C:\Users\Will\Documents\cmp year 3\LEGO ROBOTS PROJECT\rxtx-2.1-7-bins-r2\RXTXcomm.jar
at js.tinyvm.ClassRecord.getClassRecord(ClassRecord.java:855)
at js.tinyvm.ClassRecord.storeReferredClasses(ClassRecord.java:394)
at js.tinyvm.Binary.processClasses(Binary.java:384)
at js.tinyvm.Binary.createFromClosureOf(Binary.java:312)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:98)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:49)
at lejos.pc.tools.NXJLink.start(NXJLink.java:134)
at lejos.pc.tools.NXJLink.run(NXJLink.java:101)
at lejos.pc.tools.NXJLink.start(NXJLink.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
at lejos.pc.tools.NXJLink.main(NXJLink.java:28)
Linking the file failed with exit status 1

It looks like a Bluetooth file is missing from somewhere (file javax/bluetooth/UUID.class) any idea what that file is or what package it comes with? (icommand or RXTX)

Any ideas?
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby treeface99 » Tue Jan 24, 2012 10:20 pm

i've done a search and cant find that file or anything close to it on my computer. :S
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby skoehler » Tue Jan 24, 2012 10:25 pm

I think iCommand is old and outdated and superseded by pccomms.

Second, you're trying to link/upload a program that uses iCommand in preparation for running it on the NXT. But iCommand is for Java programs that run on the PC only. It won't run on the NXT at all.
skoehler
leJOS Team Member
 
Posts: 1397
Joined: Thu Oct 30, 2008 4:54 pm

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 12:30 pm

Thanks for your responce. I'm at the stage in my lejos project where I need to change my code so that the majority of the code is running on the pc and only basic motor instructions are issued to the brick.

From reading bagnalls java brains book, icommand seems to be a simple option. Is this out of date? I can't seem to find a pccomms tutorial which shows me the basics of control via pc.

Could anyone direct me to a tutorial or example code?

Many thanks
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby gloomyandy » Wed Jan 25, 2012 1:02 pm

If you have installed leJOS you already have the sample code, it was installed as part of the standard install. Search your machine for a directory called pcsamples, or you can browse the source online here:
http://lejos.svn.sourceforge.net/viewvc ... pcsamples/
The PC API is basically a pretty large sub-set of the NXT API details are here:
http://lejos.sourceforge.net/nxt/pc/api/index.html
To compile and run a PC based leJOS application you can either use the Eclipse plug-in or the command line tools. Details of the command line tools here:
http://lejos.sourceforge.net/nxt/nxj/tu ... dRun.htm#6

With this interface only the very low level motor control and sensor reading takes place on the NXT, everything else runs on the PC. This can work but you may want to consider things like the reaction time required for some operations (so you could not balance a Segway doing things this way), and the volumes of data you may need to transmit, or even what should happen should your robot move out of range...

An alternative (which I would recommend), is re-factor your program into parts which run best on the NXT and parts which run best on the PC. So you may have code that reads the sensors and precess data from them, perhaps handles lower level motor control maybe even obstacle avoidance or other things that need a fast reaction. Your PC code may contain things like high level planning, presentation of data to the user, things that may need more memory or processor power than the NXT has. Then link the two parts together using your own custom designed protocol (this is not hard it may be as simple as sensing a few ints, or character strings), over say a Bluetooth link... This is how many real world robot system actually operate (think Mars rover etc.)...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3934
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 1:39 pm

Thanks andy,

I didnt explain my situation very well.. I have lejos installed and i have used eclipse to write a program that allows the robot to read modified playing cards using Legos colour sensor and play Blackjack. At the moment all code is uploaded to the Brick and is executed on the brick. I now am at the stage where I want to introduce voice control and eventually other features such as a graphical interface on the PC so i need to modify the code to run on the PC. All that needs to be sent to the robot is Motor control commands and all that will be returned to the PC will be an integer value (card value).

From reading other threads, there are a number of options. Some people have no nxj program running on the brick which apparently causes a slower reaction time and others have a file running the brick which reduces the lag. I am not worried about Lagg at this stage, i just want to implement the simplist method of sending motor commands and recieving simple ints back.

What would you suggest?

Thanks for your help
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby gloomyandy » Wed Jan 25, 2012 1:51 pm

If all you are doing is running the motors and reading the color sensor then you should be able to simply recompile your program on the PC using the PC API (note though that there is no LCD or button support in the PC libs so if you use the NXT screen or buttons in your code you will have to re-work that). Remember though that your program may not react as quickly when running on a PC so if you are using things like touch sensors to stop the motors at an end stop you may run into mechanical problems...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3934
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 2:13 pm

I am not sure what you mean, if i recompile my code on the PC, surely i still need to establish a bluetooth connection to send commands to the robot?

I noticed using icommand there is a simple open() and close() command that you place around the code to be executed on the brick. Is there not a simular way of doing it which is as simple as this?
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby gloomyandy » Wed Jan 25, 2012 2:48 pm

Nope it is all done for you by the leJOS library... If you need to connect to a particular NXT or if you want to force say Bluetooth or USB connections then you can do the connection yourself but if not then the leJOS library will locate an NXT and connect to it... Take a look at the pc sample code I pointed you at earlier. Some of them open a connection some of them don't...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3934
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 3:06 pm

Oh right i see, thanks for that.
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 6:45 pm

is there a way of converting from a Lejos NXT project to a lejos PC project?

when i run the my original program (which used to execute on the NXT) as a java application i get the following error

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/ClassLoader

So I have created a new lejos PC project (with the intention of copying the code over) and imported the required jar files and i cant seem to get it to recognise the NXT.

Native Library intelbth_x64 not available
Native Library bluecove_x64 not available
Failed to open connection to the NXT

any ideas? Thanks
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 8:14 pm

here is a screen shot of my class path, is there anything missing or wrong?

Image

the problem seems to be to do with the native library. I have tried setting the library path to a number of locations in the lejos nxj directory but still am receiving these errors:

Native Library intelbth_x64 not available
Native Library bluecove_x64 not available
Failed to open connection to the NXT

please help :S
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am

Re: Icommand setup problems

Postby skoehler » Wed Jan 25, 2012 8:26 pm

Install 32 Bit Java and 32Bit Eclipse. Configure Eclipse to use the 32Bit Java instead of the 64Bit one, or simply uninstall all 64Bit versions of Java.
skoehler
leJOS Team Member
 
Posts: 1397
Joined: Thu Oct 30, 2008 4:54 pm

Re: Icommand setup problems

Postby treeface99 » Wed Jan 25, 2012 9:44 pm

Thanks!. Turns out i had downloaded 32 bit java when i installed lejos however did not configure it. Thanks A lot
treeface99
Novice
 
Posts: 30
Joined: Thu Nov 24, 2011 10:07 am


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 4 guests

more stuff