Why the EV3 can't stop immediately

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

Moderators: roger, gloomyandy, skoehler

xwang78
New User
Posts: 13
Joined: Wed Feb 08, 2017 7:26 pm

Why the EV3 can't stop immediately

Postby xwang78 » Thu Mar 09, 2017 2:33 am

Hi all,

Recently I found the EV3 can't stop immediately when it received the "Motor.A.stop()". In addition, I only found one motor can't stop immediately, which will move another 90 deg, while the other one stopped immediately.

Then I tried another way to stop it - "Motor.A.setSpeed(0)". This time both motors can stop, but it still moved a little bit forward, with 3~5 centimeters. The acceleration was set as 3000 and the reference speed was set as 450 deg/sec.

It seems that other EV3 can stop immediately when received the stop command. But I still can't figure out where the problem is. Can someone give me some suggestions on this? Thanks a lot!

Best,
X.W

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

Re: Why the EV3 can't stop immediately

Postby gloomyandy » Thu Mar 09, 2017 8:27 am

Please do not post topics about using leJOS in the leJOS development section of the forum. That section is intended for discussions of new features and development of leJOS itself.

I think you need to post a short program that shows us exactly what it is you are trying to do, tell us what you expect the code to do and what actually happens. You should also spend some time browsing the forum as this kind of topic comes up a lot.

A couple of hints. Firstly the stop command without any parameters will wait for the motor to stop completely before returning which means that if you have more then one motor they will not stop at the same time. So you should consider using the alternate form that lets you control if the call will wait or not.
http://www.lejos.org/ev3/docs/lejos/har ... p-boolean-

You need to consider motor acceleration and how that impacts how quickly the motor will come to a halt. You have set a motor speed of 450 degrees per second with an acceleration of 3000 degrees/s/s so if the motor is running at full speed it will take....
t = v/a = 450/3000 = 0.15s
during this time the motor will rotate
s=vt/2 = 450*0.15/2 = 33.75 degrees
Which depending upon the wheel size you are using will give you some amount of forward motion. With a typical LEGO wheel with a diameter of 68.8mm that amount of rotation will give you...
s=2*pi*r * deg/360 = 68.8 * 3.142 * 33.75/360 = 20mm
Which seems to fit what you are seeing. If your wheels are larger then you will see more movement.

Note that no robot will stop instantly. Even if you increase the acceleration (which you can try) at some point the wheels will skid, or perhaps the robot will tip forwards.

If this work is part of some sort of school or college project perhaps you should talk to your teacher about these questions.
leJOS news https://lejosnews.wordpress.com/

xwang78
New User
Posts: 13
Joined: Wed Feb 08, 2017 7:26 pm

Re: Why the EV3 can't stop immediately

Postby xwang78 » Thu Mar 09, 2017 4:08 pm

Hi Andy,

Sorry about that. I will post the forum in the right section. Thanks for your reply!

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

Re: Why the EV3 can't stop immediately

Postby gloomyandy » Thu Mar 09, 2017 4:38 pm

It's ok I moved your post, so please continue to use this thread for your questions about stopping the EV3.
leJOS news https://lejosnews.wordpress.com/


Return to “EV3 Software”

Who is online

Users browsing this forum: jippiee and 1 guest