What is flt doing?

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

Moderators: 99jonathan, roger, imaqine

What is flt doing?

Postby ruperty » Fri Nov 29, 2013 2:00 pm

I have a motor that is lifting a weight. At the end of my code (PCAPI) I am calling flt,

Code: Select all
motor.setSpeed(10);
motor.forward();
... time passes
motor.flt();


and I had expected the motor to lose power and return to its starting position, due to gravity.

However, the motor stays in its rotated position even after the program has finished. When I turn the NXT off then the motor falls back to the floor.

So, what is flt doing if not turning off power? And how can that be done, programmatically?

Incidentally, when the program has finished, but the NXT is still on, there is a just perceptible high-pitched whine, what is that?
Regards,
Rupert
www.perceptualrobots.com
ruperty
Active User
 
Posts: 94
Joined: Sun Oct 14, 2007 11:21 am

Re: What is flt doing?

Postby gloomyandy » Fri Nov 29, 2013 2:47 pm

Hi,
Are you using the leJOS firmware on the NXT?
If so then when trying to understand things like this remember that you have the source code for all of the system available to you. So in this case you need to look at the following files...

The first is the remote motor code:
https://sourceforge.net/p/lejos/code/HE ... .java#l298

The second is the LCP handler on the NXT:
https://sourceforge.net/p/lejos/code/HE ... .java#l285

As you can see from the above code, there is no special handling for the flt case. So If you are using a remote motor flt is the same same as stop, which will maintain the motor position. Which is what you are seeing.

Now you could fix this by modifying he LCP code to differentiate between the two cases (the RemoteMotor code already does this). If you make thes echanges you will need to rebuild the leJOS menu and re-flash your NXT. An alternative may be to use the Lego firmware, as it may handle this case differently, but I'm not sure about that...

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

Re: What is flt doing?

Postby ruperty » Tue Dec 03, 2013 9:35 am

Thanks. Yes I am using the lejos firmware. I didn't really follow that code, but I notice that flt works with the NXT API so I can workaround the issue with the PC API, which I use for testing.
Regards,
Rupert
www.perceptualrobots.com
ruperty
Active User
 
Posts: 94
Joined: Sun Oct 14, 2007 11:21 am


Return to NXJ Software

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

more stuff