mainsail-crew / mainsail

Mainsail is the popular web interface for managing and controlling 3D printers with Klipper.
https://docs.mainsail.xyz
GNU General Public License v3.0
1.66k stars 348 forks source link

Weird acceleration values by running SHAPER_CALIBRATE (FlyAdxl345 by Mellow) #1882

Closed Surax98 closed 3 months ago

Surax98 commented 3 months ago

Mainsail Version:

v2.11.2

Browser:

Edge

Device:

Desktop PC

Operating System:

Windows

What happened?

The SHAPER_CALIBRATE post-processing phase returns very weird data

What did you expect to happen instead?

Getting correct acceleration values

How to reproduce this bug?

Run SHAPER_CALIBRATE using a Flying ADXL345 by Mellow

Additional information:

The following is what I get by running the X axis calibration by SHAPER_CALIBRATE and waiting for the output:

Recommended shaper_type_x =  zv, shaper_freq_x = 54.2 Hz
To avoid too much smoothing with '3hump_ei', suggested max_accel <= 0 mm/sec^2
Fitted shaper '3hump_ei' frequency = 48.0Hz (vibrations = 11.3%, smoothing ~= 0.497)
To avoid too much smoothing with '2hump_ei', suggested max_accel <= 0 mm/sec^2
Fitted shaper '2hump_ei' frequency = 41.0 Hz (vibrations = 12.3%, smoothing ~= 0.456)
To avoid too much smoothing with 'ei', suggested max_accel <= 0 mm/sec^2
Fitted shaper 'ei' frequency = 50.4 Hz (vibrations = 22.2%, smoothing ~= 0.221)
To avoid too much smoothing with 'mzv', suggested max_accel <= 0 mm/sec^2
Fitted shaper 'mzv' frequency = 33.0 Hz (vibrations = 18.3%, smoothing ~= 0.297)
To avoid too much smoothing with 'zv', suggested max_accel <= 2400 mm/sec^2
Fitted shaper 'zv' frequency = 54.2 Hz (vibrations = 34.8%, smoothing ~= 0.142)

This is instead the output by using the same collected CSV data, but manually executing the klipper calibrate script:

 ~/klipper/scripts/calibrate_shaper.py /tmp/calibration_data_x_20240514_135758.csv -o /tmp/shaper_calibrate_x.png
Fitted shaper 'zv' frequency = 55.4 Hz (vibrations = 35.7%, smoothing ~= 0.057)
To avoid too much smoothing with 'zv', suggested max_accel <= 12000 mm/sec^2
Fitted shaper 'mzv' frequency = 33.2 Hz (vibrations = 18.5%, smoothing ~= 0.185)
To avoid too much smoothing with 'mzv', suggested max_accel <= 3200 mm/sec^2
Fitted shaper 'ei' frequency = 50.4 Hz (vibrations = 22.2%, smoothing ~= 0.127)
To avoid too much smoothing with 'ei', suggested max_accel <= 4700 mm/sec^2
Fitted shaper '2hump_ei' frequency = 43.2 Hz (vibrations = 13.3%, smoothing ~= 0.289)
To avoid too much smoothing with '2hump_ei', suggested max_accel <= 2000 mm/sec^2
Fitted shaper '3hump_ei' frequency = 51.0 Hz (vibrations = 12.4%, smoothing ~= 0.315)
To avoid too much smoothing with '3hump_ei', suggested max_accel <= 1800 mm/sec^2
Recommended shaper is zv @ 55.4 Hz

It is pretty obvious that there is something strange going on, either by Mainsail side or Moonraker side (if that's the case, I will open the issue on Moonraker's GitHub page).

dosubot[bot] commented 3 months ago

The discrepancy in acceleration values between the SHAPER_CALIBRATE process in Mainsail and the manual execution of the Klipper calibration script could be due to several factors, including differences in how data is processed or settings within Mainsail or Moonraker. To address this issue:

  1. Verify Mainsail and Moonraker configurations: Ensure all related settings are correctly configured, particularly those involving the ADXL345 accelerometer. Incorrect configurations can impact the results of the calibration process.

  2. Experiment with different setups: If feasible, try using a different accelerometer or running the calibration on a different system or browser. This can help identify if the issue is related to specific hardware or software environments.

  3. Analyze the CSV data: Compare the CSV data from both calibration processes. Differences in the data used for calibration could explain the variance in recommended shaper frequencies and max acceleration values.

If these steps do not clarify the cause of the discrepancy, providing more details about your setup, including the specific configurations of Mainsail, Moonraker, and the ADXL345, could help in diagnosing the issue further.

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

meteyou commented 3 months ago

@Surax98 mainsail is only a webgui. All gcodes will be executed by Klipper itself.

Surax98 commented 3 months ago

@Surax98 mainsail is only a webgui. All gcodes will be executed by Klipper itself.

Yeah, that was my thought but i can't find any other explanation on why the webgui returns some values while the python scripts other ones. Maybe Moonraker loses some values for whatever reason? Should I open a issue on theri GH?

meteyou commented 3 months ago

No. Moonraker only pass the data