Motor Stall and Quick Stop

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

Moderators: 99jonathan, roger, imaqine

Motor Stall and Quick Stop

Postby foliot » Sun Mar 25, 2012 12:18 am

Using the differential pilot and the latest lejos, I am unable to get the quickStop method to work. The motors simply turn slowly and indefinitely, not stopping at all. Also, I played with the regulated motor setThreshold and isStalled methods, but I can't seem to get them working properly. Triggering a stall seems to make my motors spin slowly, too. Can somebody give me an example of proper usage of these methods? What I want is a robot that stops quickly upon hitting into something, judged either by touch sensors or motor stall.
foliot
New User
 
Posts: 17
Joined: Fri Mar 16, 2012 10:21 pm

Re: Motor Stall and Quick Stop

Postby gloomyandy » Sun Mar 25, 2012 9:27 am

When asking for help please tell us what version of leJOS the actual version number not just latest, also are you running the code on the PC or directly on the nxt.As to your question I suspect you will always have problems trying to detect a stall. The nxt motors are pretty powerful and tend to make the wheels spin rather than stall when you hit something. It is likely that any setting of the stall thresholds that allow the motor to start your robot moving will result in wheel spin and a loss in position info if you hit something. You may be able to make it work but it will require very careful tuning that is likely to be surface specific. A similar problem may exist trying to use a bumper. Unless your robot moves very slowly it is likely that no matter how quickly you stop the motors you will lose position accuracy. One possible way to avoid this may be to add some degree of flex to your bump detector so that after the touch is triggered you will have some movement rather than the robot being deflected.

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

Re: Motor Stall and Quick Stop

Postby foliot » Sun Mar 25, 2012 5:35 pm

I'm using 0.9.1 beta on the nxt. I understand the shortcomings of these methods at control, but holding the wheel with my hand to ensure it won't turn does not trigger a stall. Additionally, quick stop simply does not work for me. What exactly does quick stop do under the surface? Does it actually do anything significantly different than stop?
foliot
New User
 
Posts: 17
Joined: Fri Mar 16, 2012 10:21 pm

Re: Motor Stall and Quick Stop

Postby gloomyandy » Sun Mar 25, 2012 8:12 pm

How are you testing for a stall? It looks to me as if it may be difficult to correctly detect a stall condition with the current DifferentialPilot code. I will raise this with the other devs. Looking at the code it would seem that when a stall is detected then the current move operation is aborted (by calling stop, so there is probably no need for you to call quickStop in this case), so one way would to detect a stall might be to wait for a move to complete and then to check if the end position is what you would expect it to be.

If you want to understand how something works you can always take a look at the source code. This will have been installed on your system as part of the standard install, or you can browse the source on line. Here is the latest version of DifferentialPilot:
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
As you can see quickStop, changes the acceleration used and then calls stop...

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

Re: Motor Stall and Quick Stop

Postby chromus » Sun Mar 25, 2012 8:42 pm

I have the same problem using DifferentialPilot.quickStop(). I am using the released Lejos NXT 0.9.1. According to the 0.9.1 version of DifferentialPilot.java, the quickStop method does indeed perform as you described, but the _quickAcceleration variable is never initialized. I don't know how the Lejos NXT VM initializes that variable, but could that have something to do with the wheels continuing to spin when quickStop is called? The variable is also not initialized in the trunk version of DifferentialPilot.java.
chromus
New User
 
Posts: 1
Joined: Sun Mar 25, 2012 8:37 pm

Re: Motor Stall and Quick Stop

Postby foliot » Sun Mar 25, 2012 9:01 pm

chromus wrote:I have the same problem using DifferentialPilot.quickStop(). I am using the released Lejos NXT 0.9.1. According to the 0.9.1 version of DifferentialPilot.java, the quickStop method does indeed perform as you described, but the _quickAcceleration variable is never initialized. I don't know how the Lejos NXT VM initializes that variable, but could that have something to do with the wheels continuing to spin when quickStop is called? The variable is also not initialized in the trunk version of DifferentialPilot.java.


There's the problem. I changed my code to assign an acceleration of six times the max travel speed to the quick stop acceleration and it now works.
foliot
New User
 
Posts: 17
Joined: Fri Mar 16, 2012 10:21 pm

Re: Motor Stall and Quick Stop

Postby gloomyandy » Sun Mar 25, 2012 10:17 pm

Yes that looks like a bug. You can just create your own version of quickStop by setting the acceleration before calling stop....
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4241
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Motor Stall and Quick Stop

Postby foliot » Sun Mar 25, 2012 10:31 pm

Yea. I went ahead and fixed the source.
foliot
New User
 
Posts: 17
Joined: Fri Mar 16, 2012 10:21 pm

Re: Motor Stall and Quick Stop

Postby TechnoX » Wed Jun 06, 2012 4:51 pm

This is still unimplemented? :s
TechnoX
Novice
 
Posts: 52
Joined: Tue May 03, 2011 5:57 pm
Location: Sweden


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

more stuff