0.9.0 resetTachoCount()

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

Moderators: 99jonathan, roger, imaqine

0.9.0 resetTachoCount()

Postby rcaballeron » Sun May 22, 2011 5:44 pm

Hi friends,

I've upgraded today my project to the new version and I've found a strange behaviour with the resetTachoCount method. With the previous release, the method just resets the internal counter to 0, but with the new release the method moves the motor forward with full power as many grades as value of the counter. Additionally, the counter isn't set to 0. Is it a bug?

BTW, I'm using EncoderMotor class from the pccomms projects.

Regards,

Roque
rcaballeron
New User
 
Posts: 8
Joined: Wed Jun 27, 2007 6:30 pm

Re: 0.9.0 resetTachoCount()

Postby gloomyandy » Sun May 22, 2011 6:44 pm

Can you post a short test program that shows the problem...

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

Re: 0.9.0 resetTachoCount()

Postby rcaballeron » Tue May 24, 2011 5:59 pm

Hi Andy,

Below you can find the small program. During the tests I found a bug that could be related with this strange behaviour.

If you run the program as it is, you'll observe the behaviour that I commented in my previous post. If you change the sentence
Code: Select all
motor.rotate(360, true);
by
Code: Select all
motor.rotate(360);
you will have the exception.

As I said, I don't know if this exception is the root of the misbehaviour.

Regards,

Roque

Code: Select all
import lejos.nxt.Motor;
import lejos.robotics.RegulatedMotor;

public class TestResetTacho {
   private RegulatedMotor motor;

   public TestResetTacho() {
      super();
      motor = Motor.A;
      motor.setSpeed(200);
   }
   
   public void run() throws InterruptedException {
      System.out.println("Rotate 360 grades");
      motor.rotate(360, true);
      //If you comment the previous line and uncomment the following one,
      //a NullPointerException is thrown in the class RemoteMotor, line 190
      //motor.rotate(360); 
      System.out.println("Tacho counter at t1: " + motor.getTachoCount());
      System.out.println("Wait for a while...");
      Thread.sleep(5000);
      System.out.println("Reset tacho counter");
      motor.resetTachoCount();
      System.out.println("Tacho counter at t2: " + motor.getTachoCount());      
   }

   /**
    * @param args
    */
   public static void main(String[] args) {
      TestResetTacho test = new TestResetTacho();
      try {
         test.run();
      } catch (Exception e) {
         e.printStackTrace();
      }

   }

}

rcaballeron
New User
 
Posts: 8
Joined: Wed Jun 27, 2007 6:30 pm

Re: 0.9.0 resetTachoCount()

Postby rcaballeron » Tue May 24, 2011 6:13 pm

Hi again,

I fixed the RemoteMotor bug with a simple "if (listener != null)", but the "resetTachoCount()" continues with its misbehaviour.

Regards,

Roque
rcaballeron
New User
 
Posts: 8
Joined: Wed Jun 27, 2007 6:30 pm

Re: 0.9.0 resetTachoCount()

Postby rcaballeron » Thu Jun 02, 2011 10:07 am

Hi there,

any feedback about the test or the possible "bug"?

Regards
rcaballeron
New User
 
Posts: 8
Joined: Wed Jun 27, 2007 6:30 pm

Re: 0.9.0 resetTachoCount()

Postby gloomyandy » Thu Jun 02, 2011 10:51 am

What happens if you run the same code on the NXT? Are you running the leJOS firmware on the NXT or the standard Lego firmware?

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

Re: 0.9.0 resetTachoCount()

Postby rcaballeron » Thu Jun 02, 2011 4:19 pm

Hi Andy,

No, I haven't yet run the code on the NXT. I had to rollback to version 0.8.5 in order to continue with my academic project.
On the other hand, I'm using the leJOS firmware.

Regards,

Roque
rcaballeron
New User
 
Posts: 8
Joined: Wed Jun 27, 2007 6:30 pm

Re: 0.9.0 resetTachoCount()

Postby gloomyandy » Thu Jun 02, 2011 4:37 pm

Did you roll the firmware back as well as the PC side when you switched back to 0.8.5?

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

Re: 0.9.0 resetTachoCount()

Postby rcaballeron » Tue Jun 07, 2011 2:26 pm

Yes, I did it. The most difficult part was to get the Eclipse plug-in 0.8.5. Fortunately, I found it on a previous Eclipse version.

Regards
rcaballeron
New User
 
Posts: 8
Joined: Wed Jun 27, 2007 6:30 pm

Re: 0.9.0 resetTachoCount()

Postby gloomyandy » Sun Jun 12, 2011 2:01 pm

Hi,
I've finally got around to running this test on the NXT and it all seems to work fine. I'm not sure why using a remote version of the motor should cause an problems...

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

Re: 0.9.0 resetTachoCount()

Postby Killerzwelch » Tue Jul 26, 2011 7:48 am

Hi there,

Just browsing in the forum. Have a look at my topic nullpointerexception in .rotate. Think thats The same issue. I was able to create a workaround.

Rgds
Dominik
Killerzwelch
New User
 
Posts: 11
Joined: Mon May 24, 2010 9:49 am

Re: 0.9.0 resetTachoCount()

Postby poohsen » Sun Jan 29, 2012 3:59 pm

hi all,

I got the 6270 rev of the snapshot (post 0.9.0) and I can confirm erratic behaviour in the resetTachoCount() method in the RemoteMotor class. It seems to reset the tacho count alright, but it will jerk forward and then backward once while doing it.

The funny behaviour happens only once, btw.
What I do to get it (pseudo-code):
Code: Select all
//try to reach limit
RemoteMotor.forward();
while(!TouchSensor.isPressed()){
  try {Thread.sleep(50);} catch (InterruptedException e) {}   
}
RemoteMotor.stop(false);
RemoteMotor.resetTachoCount(); // that's when it happens


the behaviour is exhibited often but not alway when executing the exact same code and the jerking movements will sometimes be more and sometimes less "violent".
can anybody else confirm?

c.
poohsen
New User
 
Posts: 20
Joined: Sun Nov 20, 2011 1:47 pm

Re: 0.9.0 resetTachoCount()

Postby gloomyandy » Sun Jan 29, 2012 5:22 pm

What firmware are you running on the NXT?

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

Re: 0.9.0 resetTachoCount()

Postby poohsen » Mon Jan 30, 2012 10:33 am

I flashed it with the 6270 rev of the snapshot. it already shows "0.9.1" as the version number when booting
poohsen
New User
 
Posts: 20
Joined: Sun Nov 20, 2011 1:47 pm

Re: 0.9.0 resetTachoCount()

Postby gloomyandy » Mon Jan 30, 2012 11:05 am

What happens if you run a similar program on the NXT does it also have this problem?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3964
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Next

Return to NXJ Software

Who is online

Users browsing this forum: gloomyandy and 7 guests

cron
more stuff