Motors out of sync + Eclipse upload issue

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

Moderators: 99jonathan, roger, imaqine

Motors out of sync + Eclipse upload issue

Postby Doolali » Fri Nov 18, 2011 3:16 am

Hello!
I'm new to leJos and what I've played with so far is great.

The first issue im having is with eclipse. It will upload my program when I run eclipse for the first time, after that it gives me the following error, which can only be sorted by restarting eclipse.

Code: Select all
// First attempt
Initializing LeJOS JDK at C:\Program Files\leJOS NXJ
program has been linked successfully
uploading ...
leJOS NXJ> Connected to NXT
leJOS NXJ> Upload successful in 1217 milliseconds
program has been uploaded
program has been linked successfully

// second attempt
uploading ...
leJOS NXJ> Failed to open Unknown 0016530CC773
leJOS NXJ> Failed to connect to any NXT
No NXT found - is it switched on and plugged in (for USB)?
uploading the program failed with exit status 1


The second issue I'm having is with the motors, I'm trying to get them to start and stop at the same time which they don't seem to like.

The code below will start both motors at the same time, when I press the button or wait for the thread sleep to finish, A will stop and C will continue for a little bit longer, I have also tried port B, and if I swap the stop order of A and C they do change which stops first.

Code: Select all
Motor.A.setSpeed(7200);
      Motor.C.setSpeed(7200);
      
      Motor.A.forward();
      Motor.C.forward();
      LCD.drawString("FORWARD", 0, 0);
      
      //Thread.sleep(1000);
      Button.waitForPress();
      
      Motor.A.stop();
      Motor.C.stop();
      LCD.drawString("STOP", 0, 1);


One last thing that I have no yet experimented with yet, but I tried using the leJOS colour sensor demonstration and all values were reading -1 and the sensor was not turned on. I tried each of the port 1-4 with no luck, am I missing something?

Any help is much appreciated! Thanks in advance.
Doolali
New User
 
Posts: 4
Joined: Fri Nov 18, 2011 2:56 am

Re: Motors out of sync + Eclipse upload issue

Postby kirkpthompson » Fri Nov 18, 2011 3:50 am

Search the forums on the Eclipse timeout issue. There is an update (or new version) that fixes this.

re: the motor issue: What motor class are you using?

Best,
-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Re: Motors out of sync + Eclipse upload issue

Postby gloomyandy » Fri Nov 18, 2011 9:40 am

Which color sensor do you have there are two different types. The Lego sensor which comes with the NXT 2.0 kit:
http://1.bp.blogspot.com/-YHhaZfguXrU/T ... Sensor.jpg
and the HiTecnic sensor:
http://ecx.images-amazon.com/images/I/2 ... AA300_.jpg

The test program you are running only supports the Lego Sensor...

Also which version of leJOS are you running?

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

Re: Motors out of sync + Eclipse upload issue

Postby Doolali » Fri Nov 18, 2011 12:23 pm

Motor problem corrected as follows

Code: Select all
DCMotor motor = null;
      motor = new NXTMotor(MotorPort.A);
      DCMotor motorB = null;
      motorB = new NXTMotor(MotorPort.B);
      
      motor.setPower(100);
      motorB.setPower(100);
      motorB.forward();
      motor.forward();
      Thread.sleep(2000);
      
      motor.stop();
      motorB.stop();


leJos version 0.9.0 rev 4498 on my NXT with the latest plugin for eclipse.

Fixed eclipse restart problem with test plugin - http://xen-sk1.us.to/ldt-tryout/

I have the NXT colour sensor that comes with the 2.0.
Edit: fixed colour sensor, was using the HT class.

No more problems for now! Thanks for the help!
Doolali
New User
 
Posts: 4
Joined: Fri Nov 18, 2011 2:56 am


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff