Wednesday, July 22, 2009
GCode scripts, software anti-backlash and simulations
It's been a while since my last posts.
There has been a lot of talk on repeatable positioning. I've created a gcode processor in php. Find download information and documentation here. You should not even consider it beta, but It Works for MeTM. I will try to maintain and improve it.
It allows you to rewrite 3D Gcode from tools like Skeinforge and use them with the 5D firmware. I've added a number of other neat features, one of the cooler ones is backlash compensation. I was having trouble increasing the quality of my prints any further, I've tried everything with the hardware, but there still is some play on the Y axis. Eventually I mitigated the problem in software. The picture below shows the effects:
|From 3D printing!|
On the left, you see a chess pawn printed without backlash compensation. On the right, this "software" setting was turned on. This is a very effective way to reduce backlash, which in hardware becomes disproportionately harder when you need to go further. You hit constraints like exceeding a healthy belt tension, running the motors with too much power, etc.
This play is not there on my X axis, because that one doesn't use microstepping and has more resonance/vibrations. Vibration can actually be a good thing (no, I didn't mean it like that ). My theory is that this vibration causes the XY-carriage to settle closer to where it's supposed to be, instead of lagging a bit behind when it was supposed to move.
Now, my script adds an amount of movement that you can configure per axis. It was actually easier than I thought, so it's definitely something to add to the Java host and to skeinforge as well. You need to set up 4 variables, backlash_X_forward, backlash_X_reverse, backlash_Y_forward, backlash_Y_reverse. The compensation simply needs to know the direction in which it was moving, and add the backlash (right?). The static friction seems to be symmetrical, but the length of the belt (that stretches slightly) connecting the pulley to the Y axis, is asymmetrical.
I've made a simulation of the RepRap's Y (or X) belt drive in Phun, which really is Phun...
You can find more information on the simulation (including downloads) here.
The GCode post-processor can also do simple find- and replace's on Gcode lines, which I currently use to speed up the raft making (of which the base layer is slow in Skeinforge, with a reason I now learned). It can perform actions on X, Y or Z variables based on criteria (e.g. Z-position / height of the current layer). All of the features can be turned on or off in a configuration file or in the top section of the php script, but again, please accept that it's unstable and use it for inspiration for a more robust solution.