Synchronizing motors

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

Moderators: roger, 99jonathan, imaqine

Synchronizing motors

Postby mescalinum » Fri Sep 21, 2012 10:50 am

I'm reading here about regulating two motors (the typical example being a differential drive wanting to drive in a straight line).

My intuition is that, with the speed regulation approach, the only guarantee is the total amount of rotation.
If for some reason one of the two motors is subject to a slowdown, the differential drive would travel in a "S" shape instead of a straight line.

What if one wants exactly motor synchronization at tachometer level (i.e. never have the motors tachometer differ more than 1 degree wrt starting position)?
Does he have to write its own motor regulator class? Or lejos already includes something like that?
mescalinum
New User
 
Posts: 14
Joined: Sat Jul 30, 2011 12:38 pm

Re: Synchronizing motors

Postby gloomyandy » Fri Sep 21, 2012 2:34 pm

To be honest I wouldn't bother. leJOS makes a pretty good job of this, and any disturbance that can throw off a motor by any meaningful amount will have a much bigger impact on the robot position than any problems caused by the motors not rotating the same amount. Build your robot and try it, if you see a problem that you think can be fixed by this form of synchronization then worry about it. I've spent a lot of timing doing this sort of thing and in the end I decided that the gain was not really worth having...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Synchronizing motors

Postby mescalinum » Fri Sep 21, 2012 4:28 pm

gloomyandy wrote:Build your robot and try it, if you see a problem that you think can be fixed by this form of synchronization then worry about it.


I did that some time ago, and using lejos.robotics.navigation.DifferentialPilot in dead-reckoning I had serious position and orientation errors.
With a compass sensor I could solve orientation errors, but the remaining error must be solved by synchronizing the tachometers.

Perhaps the way to go is to implement a CompassPilot (differential drive) that uses unregulated motors and implements low-level tachometer synchronization.

P.S. I'll post my DifferentialPilot drift results soon!
mescalinum
New User
 
Posts: 14
Joined: Sat Jul 30, 2011 12:38 pm

Re: Synchronizing motors

Postby gloomyandy » Fri Sep 21, 2012 4:58 pm

I would be interested to see the drift data. I assume this is with the pilot running on the NXT (and not on a PC). You may also want to check your actual robot construction and calibration. For simple straight running simply link the two wheels together mechanically, if the robot does not run in a straight line then synchronizing the motors will not help.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Synchronizing motors

Postby Aswin » Fri Sep 21, 2012 10:09 pm

mescalinum wrote:With a compass sensor I could solve orientation errors, but the remaining error must be solved by synchronizing the tachometers.



If the compass is your reference then you should synchronize against the compass not to the tachometers!
Also, currently the motors are also controlled against the tacho's. So your method can only be just as good as the current method.
My NXT blog: http://nxttime.wordpress.com/
Aswin
Active User
 
Posts: 122
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: Synchronizing motors

Postby gloomyandy » Sat Sep 22, 2012 12:15 pm

Using a compas to reduce errors can be pretty tricky. Although in theory a compass should help with this sort of thing, I've yet to see a robot that has used one to give better results than what can be obtained by a carefully calibrated one using the standard differential pilot. One of the problems is that the data from the compass is very noisy and things like metal objects and the robots own motors tend to throw it off. I'm not saying it can't be done, just that it may be harder than you think!

To give you an idea of the amount of error that can build up with a reasonably well calibrated robot, and one possible way to fix it take a look at the following:
http://www.youtube.com/watch?v=IMI63k5W ... ature=plcp
You may also find he following clip of interest it shows an experiment attempting to evaluate the leJOS motor driver (with no motor synchronization), against the standard Lego driver (with some form of synchronization)...
http://www.youtube.com/watch?v=NJ_6Qm_B ... ature=plcp

Good luck

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

Re: Synchronizing motors

Postby Aswin » Sat Sep 22, 2012 10:29 pm

gloomyandy wrote:Using a compas to reduce errors can be pretty tricky. Although in theory a compass should help with this sort of thing, I've yet to see a robot that has used one to give better results than what can be obtained by a carefully calibrated one using the standard differential pilot. One of the problems is that the data from the compass is very noisy and things like metal objects and the robots own motors tend to throw it off. I'm not saying it can't be done, just that it may be harder than you think!

Andy


I didn't mean you should do it. On the contrary. I meant that you have to synchronize the motors to the sensor/system you use as a reference. Magnetic north is not a good reference indoors.
My NXT blog: http://nxttime.wordpress.com/
Aswin
Active User
 
Posts: 122
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: Synchronizing motors

Postby gloomyandy » Sun Sep 23, 2012 2:10 pm

Hi Aswin, my comment about the compass was just a general one, not a response to your post, sorry for any confusion...

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

Re: Synchronizing motors

Postby mescalinum » Sun Sep 23, 2012 2:26 pm

@gloomyandy: Well, after calibrating the wheels, augmenting the robot weight, and moving the baricenter over the wheels, the robot travels and rotate almost in a straight way.
What I found to be very unreliable is the travelArc function, which was supposed to make the robot travel in an arc of a circle, instead the result was more like the arc of an ellipse :?

For what concerns compass noise VS dead reckoning error, as shown also in the video you linked, dead reckoning error accumulates over time (space).
A compass is an absolute reference (@Aswin: and you can also measure the level of magnetic interference, if any), although noisy, but noise can often be filtered.

It does not solve completely the localization problem, but should mitigate the dead-reckoning drift.

Maybe using compass + map + ultrasonic ranger...
mescalinum
New User
 
Posts: 14
Joined: Sat Jul 30, 2011 12:38 pm

Re: Synchronizing motors

Postby gloomyandy » Sun Sep 23, 2012 3:47 pm

With the steer arc code, the first thing I would check is what speeds are you trying to use? Try using a very slow speed, do you still see the same problems? You may also want to try lowering the acceleration setting, as it is easy to generate problems as the robot starts to move. Are you using the latest version of leJOS (there have been some changes made in the development branch to this part of the code). Most NXT robots tend to use the in place style of steering as this tends to provide more accurate results.

At the end of the day the NXT is not a high precision robotics system, for starters there is a huge amount of play in the motor gear systems that can easily accumulate several degrees of error each time you change direction.

As I said before good luck with using the compass sensor. Give it a go. I look forward to seeing your results...
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Synchronizing motors

Postby mescalinum » Sun Sep 23, 2012 4:29 pm

gloomyandy wrote:With the steer arc code, the first thing I would check is what speeds are you trying to use? Try using a very slow speed, do you still see the same problems? You may also want to try lowering the acceleration setting, as it is easy to generate problems as the robot starts to move.


Ah! Indeed, this was the problem. I played with acceleration, without realizing that acts at the motor regulator level, and not at the pilot level.

gloomyandy wrote:Are you using the latest version of leJOS (there have been some changes made in the development branch to this part of the code). Most NXT robots tend to use the in place style of steering as this tends to provide more accurate results.


I'm using latest release I think (0.9.1 rev 6345)
mescalinum
New User
 
Posts: 14
Joined: Sat Jul 30, 2011 12:38 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff