jitttery, slow reacting motors

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

Moderators: roger, gloomyandy, skoehler

jitttery, slow reacting motors

Postby codepitbull » Sun Feb 09, 2014 8:52 pm

Hello,
I am currently trying to get my ev3 (on rubber tracks) to do 90 degree turn. I use an Absolute IMU to measure the rotation, which works fine.
My problem is that it takes a long time for the motors to actually stop. When I issue the stop-command to the motors they will keep going, resulting at up to 70 degrees of additional turning.
I initialize the motors using the following block.
Code: Select all
        leftMotor = Motor.A;
        rightMotor = Motor.D;
        leftMotor.setSpeed(720);
        rightMotor.setSpeed(720);
        leftMotor.setAcceleration(800);
        rightMotor.setAcceleration(800);
        leftMotor.resetTachoCount();
        rightMotor.resetTachoCount();
        leftMotor.rotateTo(0);
        rightMotor.rotateTo(0);


I tried reducing the speed-value which gave me awful jitter (motors producing jump like movement). That gave me more accurate movement (stopping still takes up to 20 degrees).
But I can't use this slow speed to adjust the 20 degrees it turned too much, the jumping is too much for that. I am not asking for something that gives me 100% accuracy, but getting within 5 degree of what I was going for should be reasonable.

I guess this is related to viewtopic.php?f=18&t=4712&start=15

But is there any reliable way to operate the motors at a very slow speed?
codepitbull
New User
 
Posts: 4
Joined: Sun Feb 09, 2014 8:40 pm

Re: jitttery, slow reacting motors

Postby gloomyandy » Sun Feb 09, 2014 9:12 pm

if your motors are running at 720 degrees/s and you tell them to stop with an acceleration of 800 degrees/s/s then they will rotate by:
s = (v^2 - u^2)/2a (basic equations of motion)
s = (0 - 720*720)/2*-800
s=324
Which probably means that they have not actually reached full speed before you tell them to stop. So what you are seeing is pretty much as I would expect. If you want them to stop faster you need to use a higher acceleration. However that is probably not the best solution. You probably need to modify your code to take into account the time required to decelerate rather than simply waiting until the IMU has measured a 90 degree turn.

With the current code the motors should operate with jumping so long as you:
a) Allow time after the startup code the specifies rotateTo(0) for the jit to kick in (try a dekay of about 10 seconds before you use the motors again).
b) Do not have any cpu bound loops that operate while you are running the motors, this include loops that constantly poll a sensor (which is a bad thing in most circumstances).

The new motor driver will help with some of this but it will not fix the fundamental problem of the motors needing time to decelerate, and the issue that the sensor will always lag a little behind the actual robot position (think about it, how can it measure a rotation of 90 degrees until the turn is complete by which time it is too late to stop the turn).
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4184
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: jitttery, slow reacting motors

Postby codepitbull » Mon Feb 10, 2014 7:05 pm

Hey, thanks a lot for the suggestion with 10 seconds delay before using the motors.
Worked like a charm, I can do slow exact turns now :)
I was quite aware that I would have to do some prediction, but with the jittering motors any prediction is useless as the margin of error is simply too big.
Now everything works, including my Sensor collecting at 20ms intervals and Restlet.
Thanks again!!
codepitbull
New User
 
Posts: 4
Joined: Sun Feb 09, 2014 8:40 pm

Re: jitttery, slow reacting motors

Postby gloomyandy » Mon Feb 10, 2014 9:36 pm

Glad you have it working now. Yes the jitter is very bad until after the JIT has kicked in. Let us know how the project goes. Always good to see what people are doing.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4184
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: jitttery, slow reacting motors

Postby codepitbull » Tue Feb 11, 2014 8:32 pm

If you are in Berlin for BedCon you will be able to see it.
I am going to show a little distributed system with Vert.X, Raspberry Pi and my beloved EV3 :)
codepitbull
New User
 
Posts: 4
Joined: Sun Feb 09, 2014 8:40 pm

Re: jitttery, slow reacting motors

Postby Merowinger2k » Sat Feb 15, 2014 9:51 pm

hi,

could you post your updated program please? And/or explain where excatly you put the delay? I'm currently creating a simple line following program to get used to Lejos programming and I have basically the same problems. The bot is 5cm away from the line until the motors stop, I need the quickest possible reaction to the change in underground color and I have no clue what the best motor speed/acceleration combination is for this task.

Thanks in advance!
Merowinger2k
New User
 
Posts: 5
Joined: Tue Feb 11, 2014 8:36 pm

Re: jitttery, slow reacting motors

Postby gloomyandy » Sat Feb 15, 2014 10:11 pm

If you use the latest version of leJOS (0.6.0-alpha), you should no longer have issues with motor jitter. What version of leJOS are you using?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4184
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: jitttery, slow reacting motors

Postby codepitbull » Sun Feb 16, 2014 10:40 pm

I just added
Code: Select all
Thread.sleep(10000);

After the code block I initially posted.
Will try 0.6.0 next.
codepitbull
New User
 
Posts: 4
Joined: Sun Feb 09, 2014 8:40 pm


Return to EV3 Software

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest

more stuff