Robot not performing the same every time

Hello,

I have bought an Arduino UNO R3, a Tamiya Twin motor GearBox Set http://www.pololu.com/catalog/product/61 , a L298N dual Full Bridge Driver http://www.robofun.ro/docs/L298N.pdf , 2 LiPo 3,7V 1400mA batteries , a tamiya track and wheel set http://www.pololu.com/catalog/product/106 , finally resulting in this robot . After this, I wanted my robot to turn 90 degrees so I figured out the speed and delay time to turn one motor, and let the other one stationary. Unfortunately, after I figured out these values and my robot turned 90 degrees, the next time that I ran the exact same program, it turned more or less, variating every time. Could you please help me? :slight_smile:

Unfortunately, after I figured out these values and my robot turned 90 degrees, the next time that I ran the exact same program, it turned more or less, variating every time. Could you please help me?

As you've seen, time and PWM values alone are not enough. You need some feedback that your robot is going the right direction, or has turned the right amount.

Most of us are too busy to take the mind reading class... :stuck_out_tongue:

Maybe if you posted your code it could help. Just make sure to use the "insert code" tag so the code scrolls in the window... the code tag is the "#" tag -- third from the right... second row of "tags".

Also as someone mentioned -- feedback systems or "closed loop" systems can be better in this circumstances -- as opposed to "fire and forget" type code.

Welcome to the forum.

I had this same exact problem with that kit. I found that sometimes the wheels (that guide the treads) can come un-aligned causing strain on one of the motors. That strain can cause the tread to go slower. Try to lube the gear box (if you saved the little lube that comes with the kit) or see if your wheels are aligned.

Hope that helps.

PaulS:
As you've seen, time and PWM values alone are not enough. You need some feedback that your robot is going the right direction, or has turned the right amount.

What does this feedback consist of?

What does this feedback consist of?

A number of things. Encoders on the axles, so you count the actual number of turns is one way. Some kind of optical tracking, like a mouse, might be possible. A compass can measure actual orientation, with respect to magnetic north. Turn until the new direction is the desired heading.

Get creative.

On a shaft, somewhere in the gear train, depends on how many pulses you want to have to deal with, mount a cam and use an optocoupler to send pulses to the Arduino, Attach a magnet and use a hall effect device to send pulses to the Arduino.

And there are other ways, use your imagination.

What you are seeing is the effect of friction and other loads on the drive that cause the motor to slow down and not deliver the same results every time. Other possibilities would be to use stepper motors, you would then be controlling the speed and number of turns directly to the motor, instead of getting feedback from the motor as to how much it has moved.

The other option is bigger motors. More Torque and the variation would be less.

The other option is bigger motors. More Torque and the variation would be less.

Slippage between the track and the support would not be, though. So, I really don't think that bigger motors is the answer.

Amirra:
Unfortunately, after I figured out these values and my robot turned 90 degrees, the next time that I ran the exact same program, it turned more or less, variating every time.

How much does it vary by, and how much variation are you willing to tolerate?

Varies by around 20 degrees or so,and am willing to tolerate let's say a maximum of 5

I guess the problem is simply slip somewhere between the motors/tracks/floor. In that case you could reduce the slip considerably by ramping the motor power up and down gradually to give time for the vehicle to accelerate and decelerate, instead of turning the power on and off abruptly.

If you want to solve the problem more comprehensively you could use and gyro and/or compass to tell which way it's pointing but that involves more hardware and software - it's up to you to decide whether that's worth doing.

Even if your software were perfect, this is not a trivial problem to solve, and many
people have spent a lot of time working on it.

First off, with a toy, you cannot expect to have very good precision or repeatability.
The following guys used the best motors and encoders available, and spent a lot
of time trying to get Garcia to track the same forwards and backwards, and
around corners.

Even if you have the highest resolution encoders in the world, you will have
problems with wheel slippage in general, as well as when going between different
types surfaces [eg carpets to linoleum], and where the wheels/tracks are on
different sorts of surfaces [eg dirt versus concrete, grass, ice, on and on].

You might do a google search on "robot navigation wheel slippage", and you'll find
a lot of info.

You're working with the real world here, and it's not very accommodating.
Encoders are the next step, but as indicated, your results will vary as soon
as your robot moves to a different location and surface.