Robotics Stack Exchange is a question and answer site for professional robotic engineers, hobbyists, researchers and students. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using 2 identical DC motors and a castor wheel. The motors are connected to L293D motor driver and are controlled by RPi.

The robot is not going straight. It veers off to the right. I am running both the motors at 100% PWM.

What I tried to correct the error:

  1. I adjusted the PWM of the wheel going faster to 99%, but the robot just turns to the other side;
  2. I adjusted the weight on the robot and the problem still persists.

I once tried to run the motor without any load. Is that the cause of this, as I was later told that, running a DC motor without any load damages them?

If that is not the cause, then please tell me how to solve this problem without using any sensors for controlling it.

share|improve this question
    
In a differential drive configuration which I image is what you use, this is very likely to happen. A small difference between the two motor will cause the robot to rotate. – Demetris Jan 26 at 18:17
3  
Welcome to open loop control. You need sensors of your own (your eyes) to detect the problem yourself, how do you think will the robot be able to detect it without additional sensors? Closing the control loop with sensors is the way to go. – Bending Unit 22 Jan 26 at 18:37
1  
Stepper motors might work if you want to avoid sensors. – bdares Jan 27 at 7:54
    
@bdares - If there are no sensors, how does the robot know when to course correct? If one wheel hits an area of low friction (dust, for example) and slips, the robot turns and will never correct. – Chuck Jan 27 at 14:31
    
When you say no sensors, could this mean no external sensing or are you also excluding encoders on the wheels? because that is the typical solution to this problem. – JamesRyan Jan 27 at 14:59
up vote 26 down vote accepted

I'm posting this as an answer because it is the answer.

You can't.

As @BendingUnit22 mentions, you are attempting "open loop" control. Noise and variations will mean that your robot will never drive a perfectly straight line.

The motors could have different winding resistances (different drive currents/torque), the wheels could be different sizes, the wheels could have different traction characteristics, the caster bearing could be "stiff", the caster might not be perfectly straight when the vehicle starts, the floor might have varying surface friction characteristics (read: dust or carpet) - the list goes on and on.

The only way to account for the things outside your control (what I mention above + more) is to use feedback sensors.

You can try to get better open-loop performance by correcting the problems I listed, but there are even more and you simply can't control everything.

share|improve this answer
4  
Exactly! The issue lies in the statement "I am using 2 identical DC motors". They're never perfectly identical, and as @Chuck mentions, there's a whole host of other considerations. The only thing certain in robotics is that error and noise will come up. – Ryan Loggerythm Jan 26 at 20:27
1  
Using two wheels on the same axis should still yield much better results than just using two of the same motor, shouldn't it? – Jan Dvorak Jan 27 at 12:31
    
@JanDvorak - I'm not entirely sure what you mean when you say, "Two wheels on the same axis," but I believe it is understood/implied that the two wheels are on the same geometric axis. If you mean the same control axis (as in one motor) or axle (again implying one motor), then I would point out that it's not possible to perform differential drive steering with a locked axle. For one motor to control both wheels to different speeds requires a differential (and other equipment), and the differential effectively breaks the axle into two pieces and you're back at square one. – Chuck Jan 27 at 13:38
    
I did mean one axle, sorry. I did not know there was a requirement to be able to go not straight? – Jan Dvorak Jan 27 at 13:41
2  
@JanDvorak - I believe OP's robot is a micromouse-style vehicle. Even if it only had to go straight, and used one axle, all of the other sources of error still apply. If one wheel is 0.1% larger in diameter than the other then it will travel a path length that is 0.1% farther than the smaller tire per revolution. Say, for example, the nominal wheel size is 10cm and the wheel spacing is 10cm. The larger tire is 10.01cm and travels 0.0314cm farther per revolution. For the wheel base, the robot turn 0.12 degrees per wheel revolution. 0.01cm could easily be from dust on one tire. – Chuck Jan 27 at 13:48

Since the open-closed loop issue is already mentioned, I will give a comment to the "I once tried to run a dc-motor without a load".
Yes you might damage your motor with this but you can also damage or destroy your motor with a load. The destruction is coming from the current and the resulting temperature. If there is no smoke and some obvious smell coming from the motor it is most likely not damaged. From my experience I can tell that hobby-scale dc-motors will start to degrade at temperatures way over 100°C. And you will definetly notice such temperatures

EDIT:
I did think about this again and I might got an idea which your collegue might have been talking about. There are a special kind of AC-Motor. These are non-excited synchronous motors. Basically they are build for self destruction. If you power them up, they will start accelerating until they disassemble themselves. But if you place a heavy load on them, they can't reach this state, just because of the huge moment they have to apply to the load. So you can use them for reasonable purposes. Anyway you definetly do not of a motor like this in your application.

share|improve this answer
1  
I think too that, especially with hobby motors, by the time you heat it up enough to notice it's hot or smells funny you've probably already burnt the insulation off the windings. Like a lot of electric equipment, it either works fine or it's broken. There aren't a lot of in-between cases. – Chuck Jan 27 at 0:19
    
There was no such smoke or any visible damage. So maybe it is not damaged as I ran it for less than half a minute. – selfie side Jan 28 at 15:25

What you are describing is called open loop control, and to do this you need two motors which are exactly the same, two wheels exactly the same, the robot center of gravity to be in the center between the wheels, a perfect symmetrical electrical circuit, and finally a perfect uniform level surface to run on.

To accomplish this you typically order tens or hundreds of each part, and then perform significant testing to find two motors that are the closest match to each other in terms of power and speed vs voltage and PWM. Do the same for the wheels, the motor controllers and other parts.

This process is called binning - after these tests you sort them according to their capability or characteristics. It's considered much more expensive in both time and resources to do properly than changing to a closed loop model, and doesn't even account for poor ground conditions.

It is, however, one way to achieve your requirements without additional sensors.

share|improve this answer

Though it will never be perfect, there may be a simple way to get it to go more straight.

If at 100%-100% the car always turns left, and at 100%-99% the car always turns right, you should be able to improve on that by trying values in between.

Start with 100%-99.5% and continue with 100%-99.75% or 100%-99.25% depending on the outcome. This should soon converge to a situation where you will go straight 'on average'.

share|improve this answer

Well, if the problem does not lie in differences in hardware nor software for each wheel, then it is probably a problem with natural imperfections in either the way you built the robot or the way the motors were produced. The connections might not be solid or the RPI might not be outputting the same current. You probably want to be using speed controllers. Try that first.

If that doesn't work, your manufacturer probably didn't make identical motors and you'll probably just have to calibrate the motors. It might mean scaling the value of the stronger motor so 100% power to the strong motor matches the weak one.

share|improve this answer
2  
Using identical motor controllers will not solve the issue at hand. The issue lies at the core of robotics, which is "how do I correct the error?" – Ryan Loggerythm Jan 26 at 20:29
    
I've heard that DC motors can run slightly slower backwards as forwards. Also, any imbalance in the weight might cause some shifting to a side. Not to mention other things like friction etc. Doing anything "identical" won't work. Steppers might do a little better, but then you shouldn't drive too fast or anything... – Paul Feb 10 at 19:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.