Issues under Mac OSX with 091beta

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

Moderators: imaqine, 99jonathan, roger

New User
Posts: 2
Joined: Tue Mar 13, 2012 11:46 pm

Issues under Mac OSX with 091beta

Postby legoz » Wed Mar 14, 2012 1:19 am

I am seeing strange behavior under Mac osX with the .0.91 beta code. The following program should drive the pilot forward 100cm and then backward 100cm. The behavior I see is a 90 degree rotation, 100cm of forward travel followed by -90 degrees rotation, 90 degrees rotation, 100cm of forward travel and finally -90 degrees rotation.

I am using the Mac's built in bluetooth capabilities.
I am running Java 1.6.0_29 and have the appropriate NXJ_HOME, etc variables set.

Running with the PC API from the command line via ant ( and build.xml copied from the samples/org.lejos.pcexample directory w/ main.class=StraightTest). I see the same behavior when trying through Eclipse via the Eclipse leJOS plugin and creating a leJOS PC project.

Running this code on my Window XP machine with 0.91beta results in the expected forward travel/backward travel behavior.

My next step is to downgrade to earlier version of leJOS on the Mac.

Has any one else seen this? Am I missing something here?


Code: Select all

import lejos.nxt.Motor;
import lejos.robotics.navigation.DifferentialPilot;

public class StraightTest {
   public static void main(String[] args) {
      DifferentialPilot pilot = new DifferentialPilot(5.6f, 12.1f, Motor.C, Motor.A);;;

leJOS Team Member
Posts: 1550
Joined: Thu Oct 30, 2008 4:54 pm

Re: Issues under Mac OSX with 091beta

Postby skoehler » Wed Mar 14, 2012 1:29 am

You're probably a victim of latency issues. For some reason, on OS X, the bluetooth performance is not that good. It seems to depend on the bluetooth hardware as well.
So what happens is, that the motor for the left motor arrives much earlier than the command for the right motor. So that's probably where things go bad.
Try to control the robot via USB just to see, whether the issue goes away. If that is the case, then the issue is definitely due to bluetooth latency.

You probably realize, why remote-controlling the NXT via LCP+Bluetooth is not a very bright idea (although people seem to do it a lot, not caring about the actual implementation and how synchronous the motors are started/stopped/etc. - usually, the latency is small enough so that people don't actually notice what's actually going on)

New User
Posts: 2
Joined: Tue Mar 13, 2012 11:46 pm

Re: Issues under Mac OSX with 091beta

Postby legoz » Wed Mar 14, 2012 11:53 pm

Looks like the built-in BT hardware is to blame here. I have switched to using a USB BT adapter and am seeing the expected behavior.

I agree with your assessment regarding the use of LCP+BT, but for prototyping this seemed the way to go. I figured I would have seen more complaints about this issue.

Thanks for your help.

Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 1 guest