Capstone Project Help Needed( Droid/bluetooth)

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

Moderators: 99jonathan, roger, imaqine

Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Mon Feb 27, 2012 7:44 pm

Heya guys, I'm pretty new to mindstorms, so choosing to work on it as a final year project might seem silly, but it seemed like a good idea at the time.

My project involves creating a bluetooth remote on Android for an NXT (or NXJ) robot. This is likely an easy task for you lot, but I've been pulling my hair out over it.

Getting the lejos plugin to work in eclipse on my 64bit windows 7 system was impossible, it just refused to install.
As a workaround I got a virtualbox with a legit windows xp 32 running on it, installed 32bit everything: eclipse, jdk, lejos etc.

I managed to get the first test helloworld program working, but thats about it. Now it won't load anymore programs. I've noticed that this is supposed to be fixed in the latest update for the plugin, however even with the update, the device still shows up as unknown.

Image

I've tried reading over all of the documentation and I'm struggling to make sense of the supposed sample programs, most don't feature any code, just some method headers, other samples aren't explained terribly well. Note, I'm not suggesting any of this is crappy, just not very easy to understand for novices like myself, for example I find the documentation on Android/Lejos utterly unintelligible.

I'd appreciate any suggestions on how to make some real progress or guidance for a better setup on my workstation, running it through virtualbox is far from ideal and yet wiping everything to install a 32bit setup doesn't seem possible for me atm.

EDIT: Realised this isn't a great post, so I'll try to summarise what I want from you, kind sirs:

1: Help getting eclipse/virtualboxed windows to see the NXT so I can upload programs to it. (it worked once before, but the updated plugin isn't fixing it)
2: Help getting started in developing a simple app that will allow the robot to move (I think I have some of this, but cannot test it due to the above)
3: Help understand Bluetooth and communication to/from an Android smartphone. (I can develop simple Android apps, but bluetooth is new to me, the Mindriod stuff I've read is boggling)

so again, thank you for your time and good day.
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Mon Feb 27, 2012 8:15 pm

Sylvan wrote:Heya guys, I'm pretty new to mindstorms, so choosing to work on it as a final year project might seem silly, but it seemed like a good idea at the time.

My project involves creating a bluetooth remote on Android for an NXT (or NXJ) robot. This is likely an easy task for you lot, but I've been pulling my hair out over it.

Getting the lejos plugin to work in eclipse on my 64bit windows 7 system was impossible, it just refused to install.
As a workaround I got a virtualbox with a legit windows xp 32 running on it, installed 32bit everything: eclipse, jdk, lejos etc.


Install 32Bit Eclipse, a 32Bit JDK, and leJOS 0.9.1 on Windows 7 64 Bit. It will work without a hassle.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Mon Feb 27, 2012 9:06 pm

I tried that, I think I'd need to uninstall the 64 bit ones too.

Also, there would be problems with USB and bluetooth since the apparantly don't work on 64bit systems, and they're kind of essential for getting the programs onto the brick.
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby gloomyandy » Mon Feb 27, 2012 9:18 pm

There is no problem with Bluetooth or USB on 64bit Windows 7. Just make sure you have the latest Lego Fantom driver installed and that you follow Sven instructions to install the 32bit versions of the Java tools. I run all of these on 64bit Windows on several different PCs with no problems...

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

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Mon Feb 27, 2012 9:22 pm

skoehler wrote:
doyajii1 wrote:Now, I'm asking...again, did anybody got it to run the
nxj command to upload the program and run the program
in windows 7 64 bit?


The Lego drivers don't support 64 bit software and Bluecove (or bluetooth driver) doesn't support 64Bit either. So both USB and Bluetooth are unusable if you use a 64Bit JRE/JDK. Please install a 32Bit JDK. LeJOS should run just fine using the 32Bit JDK, but you may have to adjust the batch scripts to actually use java.exe from the 32Bit JDK.


also

ljh131 wrote:there's another problem.

if you have both 32bit/64bit java, there's no way forcing windows to use 32bit java.

when eclipse run with 64bit java (by default), lejos eclipse plugin also use 64bit java instead of 32bit. so we get errors - 'Failed to load USB comms driver: Cannot load USB driver'

of course, we can manually run nxjupload.bat to upload nxj file through 32bit cmd(syswow64), but it makes me hard.


so I need to uninstall all jave components and reinstall 32 and hope for the best? If what I quoted from another thread is correct it seems a bit contradictory and more in-line with what I have experienced. And what of the problem with finding the nxt brick in Virtualbox?
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Mon Feb 27, 2012 9:28 pm

Sylvan wrote:
ljh131 wrote:there's another problem.

if you have both 32bit/64bit java, there's no way forcing windows to use 32bit java.

when eclipse run with 64bit java (by default), lejos eclipse plugin also use 64bit java instead of 32bit. so we get errors - 'Failed to load USB comms driver: Cannot load USB driver'

of course, we can manually run nxjupload.bat to upload nxj file through 32bit cmd(syswow64), but it makes me hard.



has something changed or am I interpreting this incorrectly?


If you download 64Bit Eclipse, it will run with 64Bit Java. If your download 32 Bit Eclipse, it will run with 32 Bit Eclipse. So when ljh131 says, that eclipse uses 64 Bit Java by default, he's simply wrong.
Also, make sure to never add 64Bit JDKs to the "Installed JREs" in the java preferences in Eclipse, or simply remove the 64Bit ones and add only the 32Bit ones if the 64Bit ones made it to the list of Installed JREs by accident. Also the 0.9.1 installer sets the LEJOS_NXT_JAVA_HOME variable to a 32Bit JDK. That forces the command line tools to use a 32 Bit JDK as well. LEJOS_NXT_JAVA_HOME is not used by the Eclipse plug-in though.

So yes, you can have a 64Bit JDK installed in parallel.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Tue Feb 28, 2012 2:04 pm

New problem, I don't think I've gotten this far on the native x64 system

Image

Image



Running the lejos installer toward the end I get this error. It installed some batch files and an uninstaller, which also throws the same error, so whatever is there, just sits there.

I have 32bit eclipse and installed the plugin (is the plugin just for the nxt flasher?)
I pointed the installer to 32bit jdk 7u3

Have I missed anything?

EDIT: I tried running some of the test apps, and everything seems normal except the nxt bot doesn't run the program. There is no error code.

so yea, I've tried ignoring the problems above with the lejos installer, the eclipse environment seems to be functioning ok, I've made sure that NXJ_HOME points to the correct install directory, and it is using 32bit JRE, and the only one in the list is the 32bit one.

Flashed the brick with the firmware installer again

Running helloWorld programs or any of the sample stuff dones't throw any errors, but nothing happens on the nxt. I've also tried using java 6U30 but no change.
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Tue Feb 28, 2012 3:37 pm

Somethings wrong with the registry. Please execute regedit.exe and show me a screenshot of the registry after navigating to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.
On my system, the entry for Path under that regitry key is of type REG_EXPAND_SZ.

The error message "Access Denied" indicates, that an entry for Path exists and cannot be modifed or that an entry for Path cannot be added - EVEN though the installer runs with administrator priviledges. Right click on HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and select "Priviledges" and tell me, who's got priviledges to modify. On my system, the create/owner has special right, SYSTEM account and Administrators group has full access, and Users have read-only access.
Also, did the installer properly create an entry for LEJOS_NXT_JAVA_HOME under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment?

That all doesn't matter for you, if you're using the Eclipse plug-in. But in order to make the command line tools work, having leJOS' bin directory in Path would be nice. Also LEJOS_NXT_JAVA_HOME would be required.

Do you have any fancy software running, which might mess with registry access?
Did the installer actually continue past the errors?

Update: screenshot of my registry: you can see LEJOS_NXT_JAVA_HOME and Path:
Image
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Tue Feb 28, 2012 3:40 pm

Sylvan wrote:Running helloWorld programs or any of the sample stuff dones't throw any errors, but nothing happens on the nxt. I've also tried using java 6U30 but no change.


Please follow http://lejos.sourceforge.net/nxt/nxj/tu ... clipse.htm
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Tue Feb 28, 2012 3:54 pm

http://i.imgur.com/kjv6n.jpg

As you can see there is no LEJOS_NXT_JAVA_HOME, just NXJ_HOME which may be there from the time I tried to do this manually.

Also, the permissions are exactly as you say.

This is the current value for Path
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Perl64\site\bin;C:\Perl64\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Samsung\Samsung PC Studio 3\;C:\Program Files (x86)\Windows Live\Shared;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;%JAVA32_HOME%\bin;%NXJ_HOME%\bin;C:\PROGRA~2\IVIFOU~1\VISA\WinNT\Bin

I also followed that thing you linked already, theres no change with the bot running the programs, rather the lack of.
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Tue Feb 28, 2012 4:01 pm

Sylvan wrote:http://i.imgur.com/kjv6n.jpg

As you can see there is no LEJOS_NXT_JAVA_HOME, just NXJ_HOME which may be there from the time I tried to do this manually.


Did the installer continue after the errors?
Also, the installer never reported an error about setting LEJOS_NXT_JAVA_HOME?

Sylvan wrote:I also followed that thing you linked already, theres no change with the bot running the programs, rather the lack of.


Open the leJOS plug-in preferences, and look wether "Run after upload" is enabled. Also take a look at the Run configurations and check that either "use defauls" or "run after upload" is enabled.
You using Run As -> leJOS NXT Program to upload the program, right? Does the NXT play the melody to indicate a successfull upload of the program?
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Tue Feb 28, 2012 4:24 pm

skoehler wrote:
Did the installer continue after the errors?
Also, the installer never reported an error about setting LEJOS_NXT_JAVA_HOME?


Yea it allowed me to ignore it and after the red error, I just clicked finish and that was it.

skoehler wrote:
Sylvan wrote:I also followed that thing you linked already, theres no change with the bot running the programs, rather the lack of.


Open the leJOS plug-in preferences, and look wether "Run after upload" is enabled. Also take a look at the Run configurations and check that either "use defauls" or "run after upload" is enabled.
You using Run As -> leJOS NXT Program to upload the program, right? Does the NXT play the melody to indicate a successfull upload of the program?




I was about to say that everything in the run config and lejos preferences was as it should be, in terms of "run after upload" being checked, and it was, However I tried launching it from the Run Configuration window and it worked, played the melody and display "Hello World" as it should.

Just tested again, running it from the run configuration window uploads and launches the program, but selecting run as NXT_PROGRAM doesn't. Strange
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Tue Feb 28, 2012 4:35 pm

I will try to fix both issues. The one might be an actual issue with the plugin. Are there two run configuration for the same class? There might also be a non-leJOS Java run configuration for the same class. Does the issue go away if you delete all run configurations related to the class?

I will have to talk to the Inno Setup people about the installer issues. I've got no clue what is happening. Would you be willing to test a new installer? If so, please send me your e-mail via PM.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby Sylvan » Tue Feb 28, 2012 5:03 pm

Tried deleting run configurations, there was only the one Lejos config, and ran as Lejos NXT...

I think it isn't automatically creating a run config, when I open the run configs window its shows none for Lejos, even after attempting to 'run as' like I said above. Again, making one manually allows it to run. (By manually I mean opening run config and double clicking Lejos).

Edit: I'm trying to do some more testing to confirm that the IDE is working and setup correctly, I'll eventually get to the Mindroid stuff I think, but for now I just want to run some of the sample programs like the TestMotor one, which seems fine except "Port.S1" cannot be resolved, could this be another bug?
Sylvan
New User
 
Posts: 12
Joined: Mon Feb 27, 2012 7:30 pm

Re: Capstone Project Help Needed( Droid/bluetooth)

Postby skoehler » Wed Feb 29, 2012 12:10 am

Sylvan wrote:Just tested again, running it from the run configuration window uploads and launches the program, but selecting run as NXT_PROGRAM doesn't. Strange


I can't reproduce this. I'm using Eclipse 3.7.2 with the most recent plug-in. When I select Run As -> LeJOS NXT Program, it creates a new configuration and the program is uploaded and runs immediately (leJOS preferences are set accordingly). Still provide as much precise info on how to reproduce this. Are there messages in the eclipse error log, maybe?

Still working on the installer issue.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Next

Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff