Bluetooth Mavericks Sadness

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

Moderators: 99jonathan, roger, imaqine

Bluetooth Mavericks Sadness

Postby zippy » Sun May 11, 2014 2:03 am

Hello All,
I am somewhat new to the world of Lejos programming with NXT, and I'm having a great time.
My current project requires me to establish a bluetooth connection with the NXT brick so that I can send commands down to it (a remote control program running on the computer talks to a program running on the brick -- fun!).
I'm having NO LUCK getting a happy bluetooth connection.
I'm running this on an iMac running Mavericks.

2 issues:

* We downloaded and ran the install for the latest version of the Fantom drivers from NI. (from Nov 2013. 631 KB). We do manage to pair with the brick from the Mac, but we lose the connection in a minute or two, despite the fact that the brick remains on. And to make it reconnect, we have to remove the device from the bluetooth list and connect again.

* When calling the .connectTo() method of NXTConnector, we see this in the eclipse console: "Native library bluecove not available". I did download the bluecove jar and add it to my project's build path, but that didn't solve the problem. I read a couple of posts about 32 and 64 bit and java's library path, but I couldn't make any headway with them.

IS THERE HOPE?
Any help much appreciated.

Thanks,
-Tom
zippy
New User
 
Posts: 5
Joined: Sun May 11, 2014 1:50 am

Re: Bluetooth Mavericks Sadness

Postby wiscu » Sun May 25, 2014 9:36 am

Hey Tom

I have had the same problem and it can be "solved". I couldn't find anyway to make the bluecove work, so what I did was the following:
PC --> (USB) --> NXT --> (Bluetooth) --> NXT.
The NXT in the middle receive information from the PC (Mac 10.9.2) and send it directly to the second NXT. You can of cause also send in the other direction.
The NXT in the middle can be initialized so it automatically look/wait for an USB/Bluetooth connection (also if it is lost). You should therefore be able to turn it on and then have it running, upload new programs to the other devises without have to deal with it. For me it was running quite smoothly.

I guess this isn't the solution you exactly was hoping for. But if this approach in anyway seems tempting, feel free to ask further questions. I do also have some (free) code to handle the different communication on both sides.

/Rasmus
wiscu
New User
 
Posts: 9
Joined: Mon Nov 12, 2012 4:09 pm

Re: Bluetooth Mavericks Sadness

Postby skoehler » Mon May 26, 2014 10:22 am

Bluecove is dead, it seems. There is a fork I believe, but I never evaluated its status. So far, OS X and Linux are affected and it is not or will not be possible to use bluetooth on these operating systems.
I'm sorry, but at the moment we can't shoulder maintaining our own bluecove fork or something similar.
skoehler
leJOS Team Member
 
Posts: 1431
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth Mavericks Sadness

Postby zippy » Tue May 27, 2014 1:26 pm

Hello skoehler,
Thanks for the information on bluecove.
Bummer!
Looks like our little project is dead in its tracks.
So, if I understand correctly, there is no hope of communicating wirelessly to the NXT brick from within a LeJOS project when using OSX Mavericks.
I appreciate the post.
-td
zippy
New User
 
Posts: 5
Joined: Sun May 11, 2014 1:50 am

Re: Bluetooth Mavericks Sadness

Postby skoehler » Tue May 27, 2014 1:31 pm

zippy wrote:So, if I understand correctly, there is no hope of communicating wirelessly to the NXT brick from within a LeJOS project when using OSX Mavericks.

People have posted hacks (mostly for Mountain Lion) which basically overwrite parts of your OS X installation with parts from OS X Lion. I cannot recommend doing that!
The fork of bluecove which might or might not work, does not seems to release any binaries and thus needs to be compiled from scratch. I don't have an OS X machine to build and test it. Also, I currently don't have the time. I think, the fork is hosted at https://github.com/empeeoh/bluecove-osx
skoehler
leJOS Team Member
 
Posts: 1431
Joined: Thu Oct 30, 2008 4:54 pm

Re: Bluetooth Mavericks Sadness

Postby zippy » Tue May 27, 2014 1:34 pm

Rasmus,

Thanks for the reply.
When I first read it, I thought, "no way". But now I see that there is some hope. Quite an interesting idea.

I would love to see the code you have for making this "relaying" NXT brick work in your system.

Thanks,
-td
zippy
New User
 
Posts: 5
Joined: Sun May 11, 2014 1:50 am

Re: Bluetooth Mavericks Sadness

Postby zippy » Tue May 27, 2014 1:37 pm

skoehler wrote:the fork is hosted at https://github.com/empeeoh/bluecove-osx


Brilliant. Thanks.
I may give building that a shot, but with my basic Bluetooth connectivity to the NXT being so flaky, I'm thinking Bluetooth from PC to NXT is a bust.

-td
zippy
New User
 
Posts: 5
Joined: Sun May 11, 2014 1:50 am

Re: Bluetooth Mavericks Sadness

Postby wiscu » Fri May 30, 2014 12:36 am

Hey

Well it is for sure a hack and not that pretty, but it was the only quick workaround I found.

Okay so here is how I did. Again we have: PC --> (USB) --> NXT(relay) --> (Bluetooth) --> NXT(end).
Here is a github link to the "general" code: https://github.com/rlunding/Lejos/tree/master/NXTCommunication.
There are four classes: BTCom.java, NXTRelay, USBComNXT, and USBComPC. You will need all of them.

Code for PC:
You have to include USBComPC.java. The PC will try to connect to whatever NXT that is connected via USB.
You will need this piece of code or something similar to create the connection and get input/output.
Code: Select all
USBComPC usb = USBComPC.getInstance();
usb.connect();
String input = "";
while(usb.isConnected()){
      input = usb.receiveString();
     System.out.println("Input: " + input);
     usb.sendString(output);
}


Code for NXT(relay):
See Github for NXTRelay.java... BTCom.java and USBComNXT.java is also needed.
Both the usb and bluetooth connection will we be set as slaves so the NXT wait for someone to connect.
You should therefore be able to turn off the NXT(end) (connection is lost) and then turn it back on
an automatically get connected. This will come in handy when you upload new programs.

Code for NXT(end):
You have to include BTCom.java. One important thing, when you connect with a name: BTCom.connect("name"); the NXT will connect as 'master'
it is therefore important that the slave (which just call BTCom.connect(); without any argument) is ready and waiting for a connection.
Code: Select all
String NXTName = "NXTRelay"; //name of the other NXT
BTCom.connect(NXTname);
   while (true) {
      while (BTCom.getIsConnected()) {
         BTCom.sendData(output());
                        String input = BTCom.recieveData();
      }
   }


I hope you can use this or maybe just parts of it. Should you have any further questions or find bugs please send me a message. I haven't tested the PC<-->NXT that much (2 projects), but the BTCom have been used in several projects (around 10) with success. One thing you should notice if you plan to send in both directions: it is then important that you don't send or receive from both ends at the same time (might be obviously). One have to send while the other wait for receiving something.

/Rasmus
wiscu
New User
 
Posts: 9
Joined: Mon Nov 12, 2012 4:09 pm

Re: Bluetooth Mavericks Sadness

Postby zippy » Fri May 30, 2014 5:01 pm

Tremendous. Thanks wiscu / Rasmus
I think I can get my hands on a friend's NXT to try this out. Will report back if I get something going... along with github links to the project.
Just need to find some time...
Thanks,
-td
zippy
New User
 
Posts: 5
Joined: Sun May 11, 2014 1:50 am


Return to NXJ Software

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot] and 4 guests

more stuff