Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to fix Klipper TTC errors #168

Merged
merged 11 commits into from
Oct 20, 2024
Merged

Trying to fix Klipper TTC errors #168

merged 11 commits into from
Oct 20, 2024

Conversation

Frix-x
Copy link
Owner

@Frix-x Frix-x commented Oct 20, 2024

This PR adds:

  • .stdata files to store accelerometer measurements (more will be added later)
  • a chunking mechanism of the .stdata files when multiple accelerometer measurements done in sequence
  • some bit and tweaks to how the accelerometer files are written to disk and data retrieved from Klipper internal objects

Summary by Sourcery

Add support for .stdata files to store accelerometer measurements and implement a chunking mechanism to handle multiple measurements efficiently. Update documentation to reflect these changes and provide guidance on new configuration options.

New Features:

  • Introduce .stdata files to store accelerometer measurements, allowing for more efficient data handling and storage.

Enhancements:

  • Implement a chunking mechanism for .stdata files to manage multiple accelerometer measurements taken in sequence, improving data processing efficiency.

Documentation:

  • Update README.md to include new configuration options and explanations for .stdata files, chunking mechanism, and other settings.

Copy link

sourcery-ai bot commented Oct 20, 2024

Reviewer's Guide by Sourcery

This pull request introduces significant changes to the Shake&Tune project, primarily focusing on improving data handling, storage, and processing of accelerometer measurements. The changes include a new .stdata file format for storing measurements, a chunking mechanism for handling multiple measurements, and various optimizations in how accelerometer data is written to disk and retrieved from Klipper internal objects.

Sequence diagram for accelerometer data recording

sequenceDiagram
    participant User
    participant Accelerometer
    participant MeasurementsManager
    participant Klipper

    User->>Accelerometer: start_recording(measurements_manager, name, append_time)
    Accelerometer->>MeasurementsManager: add_measurement(name)
    User->>Accelerometer: stop_recording()
    Accelerometer->>Klipper: finish_measurements()
    Klipper-->>Accelerometer: samples
    Accelerometer->>MeasurementsManager: append_samples_to_last_measurement(samples)
    User->>Accelerometer: wait_for_samples(timeout)
    Accelerometer-->>User: samples_ready
Loading

ER diagram for .stdata file format

erDiagram
    MEASUREMENT {
        string name
        SamplesList samples
    }

    SAMPLES_LIST {
        float time
        float accel_x
        float accel_y
        float accel_z
    }

    MEASUREMENT ||--o{ SAMPLES_LIST : contains
Loading

File-Level Changes

Change Details Files
Introduced a new .stdata file format and MeasurementsManager class for handling accelerometer data
  • Created a new MeasurementsManager class to manage accelerometer measurements
  • Implemented methods to save and load measurements in a compressed .stdata format
  • Added chunking mechanism to handle multiple measurements efficiently
  • Replaced CSV file handling with the new .stdata format
shaketune/helpers/accelerometer.py
shaketune/graph_creators/vibrations_graph_creator.py
shaketune/graph_creators/axes_map_graph_creator.py
shaketune/graph_creators/belts_graph_creator.py
shaketune/graph_creators/shaper_graph_creator.py
shaketune/graph_creators/static_graph_creator.py
Refactored Accelerometer class and measurement handling
  • Created a new Accelerometer class with improved measurement recording capabilities
  • Implemented asynchronous data retrieval from Klipper's accelerometer
  • Added methods to start and stop recordings, and wait for samples
shaketune/helpers/accelerometer.py
shaketune/commands/axes_map_calibration.py
shaketune/commands/create_vibrations_profile.py
shaketune/commands/axes_shaper_calibration.py
shaketune/commands/compare_belts_responses.py
shaketune/commands/excitate_axis_at_freq.py
Updated graph creation process to use the new measurement handling system
  • Modified graph creator classes to accept MeasurementsManager instead of CSV files
  • Updated methods to process data from .stdata format instead of CSV
  • Removed old CSV file handling and cleanup methods
shaketune/graph_creators/graph_creator.py
shaketune/graph_creators/vibrations_graph_creator.py
shaketune/graph_creators/axes_map_graph_creator.py
shaketune/graph_creators/belts_graph_creator.py
shaketune/graph_creators/shaper_graph_creator.py
shaketune/graph_creators/static_graph_creator.py
Modified ShakeTuneProcess and related configurations
  • Updated ShakeTuneProcess to work with the new MeasurementsManager
  • Added new configuration options for chunk size and keeping raw data
  • Increased default timeout and number of results to keep
shaketune/shaketune_process.py
shaketune/shaketune.py
shaketune/shaketune_config.py
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Frix-x - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 4 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟡 Documentation: 2 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

shaketune/helpers/accelerometer.py Show resolved Hide resolved
shaketune/helpers/accelerometer.py Show resolved Hide resolved
README.md Show resolved Hide resolved
shaketune/helpers/accelerometer.py Outdated Show resolved Hide resolved
shaketune/helpers/accelerometer.py Show resolved Hide resolved
@Frix-x Frix-x merged commit 337779e into develop Oct 20, 2024
3 checks passed
@Frix-x Frix-x deleted the ttc-fix branch October 20, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant