Map hobby servo to motion axis?

Would it be possible to map a motion axis? This would be useful for the Z axis on a pen plotter, drag knife, Pick-and-place head, etc. or the “C axis” for rotating a pick-and-place nozzle.

This feature is already supported by at least two other firmwares:

FluidNC: Axes | Wiki.js

FluidNC creates a virtual stepper motor for the axis. You give it parameters for speed, acceleration, etc like normal motors. The servo range will be mapped to the max_travel of the axis

Smoothieware: GitHub - Smoothieware/Smoothieware at feature/slaveswitch

If you want a bit of extra convenience, by being able to talk to your hobby servo as if it was a Z axis ( which means you will also be able to use it in places like homing or probing the way you typically use a Z axis, if this is something you need ), then you can use this special branch of Smoothie that implements this feature:

I realize that you can’t guarantee the coordination of an RC servo and other stepper-controled axes, but for most/all of the applications above the Z/C axis does not need to be moved in a coordinated way. Dropping the pen of a plotter is done while XY are stationary.

It is possible to control a servo in Klipper (see the [servo] config section in the documentation).

Klipper doesn’t currently support mapping an axis to a servo.

It might be possible to implement that with some convoluted g-code macros, but I suspect doing it that way would be challenging.

-Kevin