added standard header to .py files
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
############################################
|
# Shake&Tune: 3D printer analysis tools
|
||||||
###### INPUT SHAPER KLIPPAIN WORKFLOW ######
|
#
|
||||||
############################################
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
# Written by Frix_x#0161 #
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
# This module functions as a plugin within Klipper, aimed at enhancing printer diagnostics. It serves multiple purposes:
|
# File: __init__.py
|
||||||
# 1. Diagnosing and pinpointing vibration sources in the printer.
|
# Description: Functions as a plugin within Klipper to enhance printer diagnostics by:
|
||||||
# 2. Conducting standard axis input shaper tests on the XY axes to determine the optimal input shaper filter.
|
# 1. Diagnosing and pinpointing vibration sources in the printer.
|
||||||
# 3. Executing a specialized half-axis test for CoreXY printers to analyze and compare the frequency profiles of individual belts.
|
# 2. Conducting standard axis input shaper tests on the machine axes.
|
||||||
|
# 3. Executing a specialized half-axis test for CoreXY/CoreXZ printers to analyze
|
||||||
|
# and compare the frequency profiles of individual belts.
|
||||||
|
# 4. ...
|
||||||
|
|
||||||
|
|
||||||
from .shaketune import ShakeTune as ShakeTune
|
from .shaketune import ShakeTune as ShakeTune
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: __init__.py
|
||||||
|
# Description: Imports various commands function (to run and record the tests) for the Shake&Tune package.
|
||||||
|
|
||||||
|
|
||||||
from .axes_map_calibration import axes_map_calibration as axes_map_calibration
|
from .axes_map_calibration import axes_map_calibration as axes_map_calibration
|
||||||
from .axes_shaper_calibration import axes_shaper_calibration as axes_shaper_calibration
|
from .axes_shaper_calibration import axes_shaper_calibration as axes_shaper_calibration
|
||||||
from .compare_belts_responses import compare_belts_responses as compare_belts_responses
|
from .compare_belts_responses import compare_belts_responses as compare_belts_responses
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
# This file provides a custom and internal Shake&Tune Accelerometer helper that is
|
# Shake&Tune: 3D printer analysis tools
|
||||||
# an interface to Klipper's own accelerometer classes. It is used to start and
|
#
|
||||||
# stop accelerometer measurements and write the data to a file in a blocking manner.
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: accelerometer.py
|
||||||
|
# Description: Provides a custom and internal Shake&Tune Accelerometer helper that interfaces
|
||||||
|
# with Klipper's accelerometer classes. It includes functions to start and stop
|
||||||
|
# accelerometer measurements and write the data to a file in a blocking manner.
|
||||||
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: axes_map_calibration.py
|
||||||
|
# Description: Provides a command for calibrating the axes map of a 3D printer using an accelerometer.
|
||||||
|
# The script moves the printer head along specified axes, starts and stops measurements,
|
||||||
|
# and performs post-processing to analyze the collected data.
|
||||||
|
|
||||||
|
|
||||||
from ..helpers.console_output import ConsoleOutput
|
from ..helpers.console_output import ConsoleOutput
|
||||||
from ..shaketune_process import ShakeTuneProcess
|
from ..shaketune_process import ShakeTuneProcess
|
||||||
from .accelerometer import Accelerometer
|
from .accelerometer import Accelerometer
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: axes_shaper_calibration.py
|
||||||
|
# Description: Provides a command for calibrating the input shaper of a 3D printer's axes using an accelerometer.
|
||||||
|
# The script performs resonance tests along specified axes, starts and stops measurements,
|
||||||
|
# and generates graphs for each axis to analyze the collected data.
|
||||||
|
|
||||||
|
|
||||||
from ..helpers.common_func import AXIS_CONFIG
|
from ..helpers.common_func import AXIS_CONFIG
|
||||||
from ..helpers.console_output import ConsoleOutput
|
from ..helpers.console_output import ConsoleOutput
|
||||||
from ..helpers.resonance_test import vibrate_axis
|
from ..helpers.resonance_test import vibrate_axis
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: compare_belts_responses.py
|
||||||
|
# Description: Provides a command for comparing the frequency response of belts in CoreXY and CoreXZ kinematics 3D printers.
|
||||||
|
# The script performs resonance tests along specified axes, starts and stops measurements, and generates graphs
|
||||||
|
# for each axis to analyze the collected data.
|
||||||
|
|
||||||
|
|
||||||
from ..helpers.common_func import AXIS_CONFIG
|
from ..helpers.common_func import AXIS_CONFIG
|
||||||
from ..helpers.console_output import ConsoleOutput
|
from ..helpers.console_output import ConsoleOutput
|
||||||
from ..helpers.motors_config_parser import MotorsConfigParser
|
from ..helpers.motors_config_parser import MotorsConfigParser
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: vibrations_profile.py
|
||||||
|
# Description: Provides a command to measure the vibrations generated by the kinematics and motors of a 3D printers
|
||||||
|
# at different speeds and angles increments. The data is collected from the accelerometer and used
|
||||||
|
# to generate a comprehensive vibration analysis graph.
|
||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from ..helpers.console_output import ConsoleOutput
|
from ..helpers.console_output import ConsoleOutput
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: excitate_axis_at_freq.py
|
||||||
|
# Description: Provide a command to excites a specified axis at a given frequency for a duration
|
||||||
|
# and optionally creates a graph of the vibration data collected by the accelerometer.
|
||||||
|
|
||||||
|
|
||||||
from ..helpers.common_func import AXIS_CONFIG
|
from ..helpers.common_func import AXIS_CONFIG
|
||||||
from ..helpers.console_output import ConsoleOutput
|
from ..helpers.console_output import ConsoleOutput
|
||||||
from ..helpers.resonance_test import vibrate_axis_at_static_freq
|
from ..helpers.resonance_test import vibrate_axis_at_static_freq
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
# This file contains dummy gcode macros to inject them at Klipper startup
|
# Shake&Tune: 3D printer analysis tools
|
||||||
# by the Shake&Tune plugin in order to make them available in the UI.
|
#
|
||||||
# Indeed, system macros in Klipper are not available as buttons in Mainsail/Fluidd
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
# and this is a workaround to have a good and friendly UX when using Shake&Tune.
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: dummy_macros.cfg
|
||||||
|
# Description: Contains dummy gcode macros to inject at Klipper startup for
|
||||||
|
# availability in the UI, improving user experience with Shake&Tune.
|
||||||
|
|
||||||
|
|
||||||
[gcode_macro EXCITATE_AXIS_AT_FREQ]
|
[gcode_macro EXCITATE_AXIS_AT_FREQ]
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: __init__.py
|
||||||
|
# Description: Imports various graph creator classes for the Shake&Tune package.
|
||||||
|
|
||||||
|
|
||||||
from .axes_map_graph_creator import AxesMapGraphCreator as AxesMapGraphCreator
|
from .axes_map_graph_creator import AxesMapGraphCreator as AxesMapGraphCreator
|
||||||
from .belts_graph_creator import BeltsGraphCreator as BeltsGraphCreator
|
from .belts_graph_creator import BeltsGraphCreator as BeltsGraphCreator
|
||||||
from .graph_creator import GraphCreator as GraphCreator
|
from .graph_creator import GraphCreator as GraphCreator
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
######################################
|
# Shake&Tune: 3D printer analysis tools
|
||||||
###### AXE_MAP DETECTION SCRIPT ######
|
#
|
||||||
######################################
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
# Written by Frix_x#0161 #
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: axes_map_graph_creator.py
|
||||||
|
# Description: Implements the axes map detection script for Shake&Tune, including
|
||||||
|
# calibration tools and graph creation for 3D printer vibration analysis.
|
||||||
|
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
#################################################
|
# Shake&Tune: 3D printer analysis tools
|
||||||
######## CoreXY BELTS CALIBRATION SCRIPT ########
|
#
|
||||||
#################################################
|
# Copyright (C) 2022 - 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
# Written by Frix_x#0161 #
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: belts_graph_creator.py
|
||||||
|
# Description: Implements the CoreXY/CoreXZ belts calibration script for Shake&Tune,
|
||||||
|
# including computation and graphing functions for 3D printer belt paths analysis.
|
||||||
|
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: graph_creator.py
|
||||||
|
# Description: Abstract base class for creating various types of graphs in Shake&Tune,
|
||||||
|
# including methods for moving, preparing, saving, and cleaning up files.
|
||||||
|
# This class is inherited by the AxesMapGraphCreator, BeltsGraphCreator,
|
||||||
|
# ShaperGraphCreator, VibrationsGraphCreator, StaticGraphCreator
|
||||||
|
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import shutil
|
import shutil
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Derived from the calibrate_shaper.py official Klipper script
|
||||||
|
# Copyright (C) 2020 Dmitry Butyugin <dmbutyugin@google.com>
|
||||||
|
# Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net>
|
||||||
|
# Copyright (C) 2022 - 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: shaper_graph_creator.py
|
||||||
|
# Description: Implements the input shaper calibration script for Shake&Tune,
|
||||||
|
# including computation and graphing functions for 3D printer vibration analysis.
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
######## INPUT SHAPER CALIBRATION SCRIPT ########
|
######## INPUT SHAPER CALIBRATION SCRIPT ########
|
||||||
#################################################
|
#################################################
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: static_graph_creator.py
|
||||||
|
# Description: Implements a static frequency profile measurement script for Shake&Tune to diagnose mechanical
|
||||||
|
# issues, including computation and graphing functions for 3D printer vibration analysis.
|
||||||
|
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
##################################################
|
# Shake&Tune: 3D printer analysis tools
|
||||||
#### DIRECTIONAL VIBRATIONS PLOTTING SCRIPT ######
|
#
|
||||||
##################################################
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
# Written by Frix_x#0161 #
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: vibrations_graph_creator.py
|
||||||
|
# Description: Implements the directional vibrations plotting script for Shake&Tune,
|
||||||
|
# including computation and graphing functions for analyzing 3D printer vibration profiles.
|
||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import optparse
|
import optparse
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: __init__.py
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# Common functions for the Shake&Tune package
|
# Shake&Tune: 3D printer analysis tools
|
||||||
# Written by Frix_x#0161 #
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: common_func.py
|
||||||
|
# Description: Contains common functions and constants used across the Shake&Tune
|
||||||
|
# package for 3D printer vibration analysis and diagnostics.
|
||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: console_output.py
|
||||||
|
# Description: Defines the ConsoleOutput class for printing output to stdout or an alternative
|
||||||
|
# callback function, such as the Klipper console.
|
||||||
|
|
||||||
|
|
||||||
import io
|
import io
|
||||||
from typing import Callable, Optional
|
from typing import Callable, Optional
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
# Classes to retrieve a couple of motors infos and extract the relevant information
|
# Shake&Tune: 3D printer analysis tools
|
||||||
# from the Klipper configuration and the TMC registers
|
#
|
||||||
# Written by Frix_x#0161 #
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: motors_config_parser.py
|
||||||
|
# Description: Contains classes to retrieve motor information and extract relevant data
|
||||||
|
# from the Klipper configuration and TMC registers.
|
||||||
|
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
# The logic in this file was "extracted" from Klipper's orignal resonance_tester.py file
|
# Shake&Tune: 3D printer analysis tools
|
||||||
# Courtesy of Dmitry Butyugin <dmbutyugin@google.com> for the original implementation
|
#
|
||||||
|
# Adapted from Klipper's original resonance_tester.py file by Dmitry Butyugin <dmbutyugin@google.com>
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: resonance_test.py
|
||||||
|
# Description: Contains functions to test the resonance frequency of the printer and its components
|
||||||
|
# by vibrating the toolhead in specific axis directions. This derive a bit from Klipper's
|
||||||
|
# implementation as there are two main changes:
|
||||||
|
# 1. Original code doesn't use euclidean distance with projection for the coordinates calculation.
|
||||||
|
# The new approach implemented here ensures that the vector's total length remains constant (= L),
|
||||||
|
# regardless of the direction components. It's especially important when the direction vector
|
||||||
|
# involves combinations of movements along multiple axes like for the diagonal belt tests.
|
||||||
|
# 2. Original code doesn't allow Z axis movements that was added in order to test the Z axis resonance
|
||||||
|
# or CoreXZ belts frequency profiles as well.
|
||||||
|
|
||||||
# This derive a bit from Klipper's implementation as there are two main changes:
|
|
||||||
# 1. Original code doesn't use euclidean distance for the moves calculation with projection. The new approach implemented here
|
|
||||||
# ensures that the vector's total length remains constant (= L), regardless of the direction components. It's especially
|
|
||||||
# important when the direction vector involves combinations of movements along multiple axes like for the diagonal belt tests.
|
|
||||||
# 2. Original code doesn't allow Z axis movement that was added here for later use
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: shaketune.py
|
||||||
|
# Description: Main class implementation for Shake&Tune, handling Klipper initialization and
|
||||||
|
# loading of the plugin, and the registration of the tuning commands
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: shaketune_config.py
|
||||||
|
# Description: Defines the ShakeTuneConfig class for handling configuration settings
|
||||||
|
# and file paths related to Shake&Tune operations.
|
||||||
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from .helpers.console_output import ConsoleOutput
|
from .helpers.console_output import ConsoleOutput
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Shake&Tune: 3D printer analysis tools
|
||||||
|
#
|
||||||
|
# Copyright (C) 2024 Félix Boisselier <felix@fboisselier.fr> (Frix_x on Discord)
|
||||||
|
# Licensed under the GNU General Public License v3.0 (GPL-3.0)
|
||||||
|
#
|
||||||
|
# File: shaketune_process.py
|
||||||
|
# Description: Implements the ShakeTuneProcess class for managing the execution of
|
||||||
|
# vibration analysis processes in separate system processes.
|
||||||
|
|
||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
|
|||||||
Reference in New Issue
Block a user