I would like to implement backlash compensation and looking for guidance on where to start.
I have been looking at the Klippy code for moves, but think this would be best in the mcu code. Essentially anytime a direction of a stepper motor is changed, it would first move by the amount of backlash compensation.
Can anyone offer me guidance of where in the code should I start?
Hi. I think the best option is to implement it in chelpers, maybe itersolve.c? Having it inside kinematics code will be even better, but that will require writing the same code for every kinematics. Then have bool variable of current backlash positions, then add/subtract constant defined in printer.cfg. Also there will be an issue with rapid movement, maybe you’ll need to check how pressure advance is implemented.
I hope I helped, and here’s a good manual of klipper’s workflow:
I am very interested in this because I also have a delta printer with backlash like positioning errors. Problem is that in a delta, you can’t just say that there is backlash in the X, Y, or Z Cartesian axis, because if the backlash is in the A, B, or C tower axis it affects all of the Cartesian axis. The compensation would have to be in the delta kinematics code.
However, on my printer I am seeing what appears to be backlash from a move as small as 1mm in X or Y, showing up also as an error in Z position during a bed level probe. You would think that the probe operation which runs all three towers together up and down would clear out any backlash, but not so. So the symptoms would indicate backlash in the towers, but the mechanical operations indicate it is something different. Perhaps the belts are shifting in some weird way but only with differential motion between the towers. That would make it harder to fix in software.
Have you been able to isolate exactly in the mechanics of your delta where the backlash is?
I also couldn’t figure it out. I printed a test cube (should’ve printed triangle) with alternating wall directions to see the backlash, and to my surprise the front facing plane was excellent at the middle, and worse at the sides. I checked toolhead as well as all 3 towers with a dial measure and everything seemed fine. Tested without motor dampeners, retightened belts a few times, greased linear rails… still the same. I think it may be correlated with force, so it’s not a backlash, rather something proportional to speed or force (looking at my results). Here’s the top layer made with my printer (underextruded, but clearly visible backlash):
I said the code can be written outside the kinematics because I think that every kinematics other than “bed slinger” can be estimated as XYZ coordinates backlash. I assume most of people have the same hardware on all delta towers or corexy sides, so as long as they don’t need micrometer precition, it will be fine.
Yes. this is exactly what my bottom layer looks like because every other stripe is running in the opposite direction. I changed to a concentric pattern (giant number of walls), and the problem went away, because every stripe was running in the same direction as the one next to it. For leveling the bed, I make 4 probes, moving the head out and back 1mm in the 4 different directions to average out the “backlash” effect on the Z position. It made a big difference in the first layer. I had to create a custom gcode to “print” to get the data and edited it into a mesh format. Too bad I can not get the built-in bed level to do this automatically with the parameters that are available. I just wish I understood the source of the problem so it could be fixed correctly.