Move individual z stepper

Hi,
I’m working on a script that will auto-adjust the tilt of the bed during printing.

I’m looking for a way to control each z-stepper motor independently and transparently during printing just like bed mesh or z_thermal_adjust
Currently I’m using FORCE_MOVE which validated the concept and resolved the main objective of the project, But it causes the toolhead to pause every time a FORCE_MOVE is called.

What will be the best route to go for implementing it?

How will you know that the adjustment is wrong during print?

The bed_mesh and z_thermal_adjust modules work by altering the incoming g-code commands. It has the effect of changing the Z position of moves to account for differences in bed height. It is possible to create a similar module if the goal is to adjust the nominal Z position of the toolhead.

There is also quad_gantry_level and z_tilt modules - they work by altering the individual z stepper motors of printers that have multiple z motors. Once these motors are adjusted, they remain at the same relative position through the remainder of the print. These modules effectively use something similar to FORCE_MOVE to alter the stepper positions.

If the goal is to alter the individual Z motors during a print, such that their relative positions also change during a print, then the only way to do that currently is to create a new Klipper kinematics. This is harder to implement as it requires both Python code and C code. The C kinematics code specifies a math formula that can convert a nominal cartesian XYZ coordinate into a stepper position. Once Klipper has this math formula it uses an “iterative solver” to generate appropriate step times for it. There is some details on this process at Code overview - Klipper documentation .

-Kevin

1 Like

Thanks for the reply
So just to be sure
1 . bed_mesh does move the each z steppers during print?
2 . Or it moves all of them together in a “bouncing motion” no matter how rough the bed mesh is?

3 . “nominal Z position” - it means that for every X,Y it alter the Z position in gcode (or add a z position)?

I might have an idea on how to avoid diving into a python plugin

I can tram the bed mesh itself either on-the-fly according to the ref_temp or prepare all the permutations before that.

Each one raises a potential problem that you might know the answer to:

on-the-fly - Is it possible to add / modify manual (points) bed meshes during printing?

permutations - How scalable is the config? does the number of bed meshes has any effect on performance? we are talking N^2 bed meshes, N is the number of temperatures, which is usually between 22C-60C, with 0.1 steps, i.e 78,400, lets round it to 100K, will it handle it?

@koconnor
I haven’t found a way to add new manual meshes, but the question of the max size of the config / max number of supported bed meshes is still relevant

I don’t know. It’s not something I’ve tried.

-Kevin