My project involves 4 DC motors with worm gear gearboxes which of course have backlash. The motors are used to articulate the joints of a robotic arm and are fitted with encoders to control their position (e.g I say move motor1 200 steps, it moves until its encoder has reported 200 steps).
I'd like to find a way to overcome the backlash because currently my robot arm seems to get a stacking error every time it changes direction as a result of it having to 'catch up' through the backlash.
I was hoping to remedy this through my code rather then a mechanical solution, to save cost. Are there many known ways to do this?
For each axis mark a starting position then move x steps away and then x steps back. Note the difference and guess at difference in steps between where you are and where you want to be. Then try moving x steps away and x+y steps back to see if you come back to the start point. Repeat this adjusting y until it starts and ends at the correct place. Repeat this for the other direction and axis.
You then have a backlash value for each axis that needs applying if the movement is reversing direction from it's last move.
I used the technique that @Riva mentions for the stepper motors on my small lathe and it works very precisely - as measured with a dial test indicator.