install input shaper software for klipper

Author: Sanket Sonavane

Publish Date: 2024-02-27

Last Updated: 2024-02-27

In a previous article we went through with detailed steps to install klipper moonraker mainsail fluidd on pi using kiauh script we will now extend on that for installing software needed for input shaping.

The official documentation is here Measuring Resonances - Klipper documentation but I would like to add further on it so am documenting the same here. There were some challenges faced while installing some dependencies and that is exactly what I wanted to talk about.

what is input shaping

"Input shaping is a command modification technique for reducing system vibration that has been implemented successfully on a number of mechanical systems. Input shaping was developed from linear systems theory, but it has been applied successfully to many nonlinear systems. Of the approaches used to shape commands for nonlinear systems, very few address the specific nonlinearities of the systems directly. This paper addresses a special subset of configuration-dependent nonlinearities. The effect of input shaping on these types of systems is analyzed and key motion command parameters are extracted. This analysis is utilized to design effective zero-vibration input shapers for the class of nonlinear systems."

source: Input shaping for a simple nonlinear system | IEEE Conference Publication | IEEE Xplore

"In control theory, input shaping is an open-loop control technique for reducing vibrations in computer-controlled machines. The method works by creating a command signal that cancels its own vibration. That is, a vibration excited by previous parts of the command signal is cancelled by vibration excited by latter parts of the command. Input shaping is implemented by convolving a sequence of impulses, known as an input shaper, with any arbitrary command. The shaped command that results from the convolution is then used to drive the system. If the impulses in the shaper are chosen correctly, then the shaped command will excite less residual vibration than the unshaped command. The amplitudes and time locations of the impulses are obtained from the system's natural frequencies and damping ratios. Shaping can be made very robust to errors in the system parameters."

source: Input shaping - Wikipedia

input shaper software install steps for klipper

NOTE: please ensure klipper is installed prior to this step

Measuring Resonances - Klipper documentation

we need to run the following install commands

sudo apt update
sudo apt install python3-numpy 
sudo apt install python3-matplotlib 
sudo apt install libatlas-base-dev 

sudo apt install libopenblas-base # if not installing then run the command below
sudo apt install libopenblas-dev

NOTE: here libopenblas-base was not available and the apt command errored out so ended up installing libopenblas-dev

you can search apt packages on internet using command

apt-cache search libopenblas

helpful apt commands

you can search installed packages using

apt list --installed python3*
apt list --installed libopen*

finished this with

~/klippy-env/bin/pip install -v numpy

this whole process took roughly 10 mins on my pi4 4gb model.

alternate solution install previous version of numpy

There was a suggested work around on voron discord source: voron design discord : klipper channel

Problem: A new version of numpy was released and is currently failing to install on RPi unless you have a full blown development environment set up.

Workaround: NumPy installation issues

  • A new version of the python numpy package was released on 2023-09-16 and is currently known to fail on install.
  • Most users will encounter this when setting up Input Shaper / Resonance Testing.
  • The error message you will typically see when running the command ~/klippy-env/bin/pip install -v numpy:

ERROR:

  • Problem encountered: No BLAS library detected!.
  • Install one, or use the allow-noblas build option. NOTE: this may be up to 100% slower for some linear algebra operations.

This is due to the unavailability of pre-compiled binaries for this package. Until these are available you can work around this problem by installing the previous version of numpy using the following command:

~/klippy-env/bin/pip install -v numpy==1.25.2

measuring resonances

Klipper has built-in support for the ADXL345, MPU-9250 and LIS2DW compatible accelerometers which can be used to measure resonance frequencies of the printer for different axes, and auto-tune input shapers to compensate for resonances.

please refer Measuring Resonances - Klipper documentation for understanding the wiring instructions for respective chips.