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

Add dummy stepper motor delay in default configuration #681

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

alexdewar
Copy link
Collaborator

Description

It turns out that while the DummyStepperMotor has the facility to add a delay between starting and stopping a movement, we're not actually using this facility anywhere, for some reason, which is a bit of an oversight. The parameter wasn't changeable via the frontend either. Let's fix this, as it's useful for testing things like @dc2917's work on #680.

@alexdewar alexdewar requested review from dalonsoa and dc2917 November 1, 2024 11:26
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.97%. Comparing base (d92801b) to head (c82b792).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
finesse/hardware/plugins/stepper_motor/dummy.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #681      +/-   ##
==========================================
- Coverage   84.99%   84.97%   -0.03%     
==========================================
  Files          69       69              
  Lines        3459     3461       +2     
==========================================
+ Hits         2940     2941       +1     
- Misses        519      520       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dc2917 dc2917 left a comment

Choose a reason for hiding this comment

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

Ahh, this makes way more sense. I did see the dummy stepper motor device has a timer that makes use of move_duration, and the init docstring says "This class uses a simple timer to notify when the move is complete after a fixed amount of time." - I just assumed it was faster than I could click 😅

@alexdewar alexdewar mentioned this pull request Nov 1, 2024
12 tasks
Copy link
Contributor

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +36 to +37
if move_duration < 0.0:
raise ValueError("move_duration cannot be negative")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd restrict to a positive number, as it should not be possible to have this duration as zero.

Suggested change
if move_duration < 0.0:
raise ValueError("move_duration cannot be negative")
if move_duration <= 0.0:
raise ValueError("move_duration needs to be strictly positive")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is a bit weird, but it does sort of make sense to have it as an option for e.g. unit tests. We don't want to be waiting unnecessarily there. Instantaneous movement shouldn't actually break anything.

@@ -3,6 +3,8 @@ name: "Dummy devices + FTSW500 spectrometer"
devices:
stepper_motor:
class_name: stepper_motor.dummy.DummyStepperMotor
params:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need steps per rotation, here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we miss it out, the default will be used instead, which should be fine.

@alexdewar alexdewar merged commit 44c5e99 into main Nov 1, 2024
8 checks passed
@alexdewar alexdewar deleted the add-dummy-stepper-motor-delay branch November 1, 2024 11:46
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.

3 participants