What is flt doing?

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

Moderators: roger, imaqine, 99jonathan

ruperty
Advanced Member
Posts: 161
Joined: Sun Oct 14, 2007 11:21 am

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

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

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

ruperty
Advanced Member
Posts: 161
Joined: Sun Oct 14, 2007 11:21 am

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

User avatar
Eric
Novice
Posts: 73
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK
Contact:

Re: What is flt doing?

Postby Eric » Wed Aug 12, 2015 5:30 pm

Can this patch be added to the core LCP code? It seems a shame that this is still broken. I'm not aware of any good way to distribute this fix with my project at the moment. The fix seems to be this, on line 304
Annoyingly, sourceforge does not provide any (obvious) means of submitting a patch. Time to move to github?

How does one go about rebuilding the menu screen?
Lego Mindstorms StackExchange proposal - Follow it here!    Technobotts - UK Robocup Junior Champions 2010 (Using LeJOS NXJ!)    NXTraordinary - My robotics blog

User avatar
Eric
Novice
Posts: 73
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK
Contact:

Re: What is flt doing?

Postby Eric » Wed Aug 12, 2015 10:42 pm

This line is somewhat suspect
Lego Mindstorms StackExchange proposal - Follow it here!    Technobotts - UK Robocup Junior Champions 2010 (Using LeJOS NXJ!)    NXTraordinary - My robotics blog


Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 2 guests