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

FIX: patch over positioner limits = (None, None) issue #567

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

klauer
Copy link
Contributor

@klauer klauer commented Aug 9, 2023

Description

  • obj.limits can be (None, None) in some (perhaps?) disconnected/misconfigured devices.
  • These limits may not have an associated component, and may be derived directly from the control layer (i.e., EPICS CA PV low/high limits)
  • This PR detects the presence of None and currently hides the limits

For discussion: on connection, it's possible those limits could go to an actual not-None value. In that scenario, this PR would have already hidden the limit widgets and they would not be displayed later.

Motivation and Context

Aims to close #565

How Has This Been Tested?

With the "all device screenshot test" mentioned in side channels

Where Has This Been Documented?

Issue and PR text

@klauer
Copy link
Contributor Author

klauer commented Aug 9, 2023

Any thoughts on what we should do here, @tangkong @ZLLentz ?

@ZLLentz
Copy link
Member

ZLLentz commented Aug 9, 2023

I'm doing a short investigation to understand why and in which cases this would be explicitly (None, None) instead of just None or (0, 0)

@ZLLentz
Copy link
Member

ZLLentz commented Aug 9, 2023

OK, I see it now- we hit (None, None) if all the PVs in a PVPositioner are disconnected, or if at least there was no limits arg passed and the setpoint is disconnected. In a vanilla EpicsMotor we raise a DisconnectedError instead, in our EpicsMotorInterface class this ends up being (0, 0) because we do some post-normalization.

@ZLLentz
Copy link
Member

ZLLentz commented Aug 9, 2023

One more important piece of context information: this is also just a fallback for when we don't have signals that directly report the low and high limit values.

if low_limit < high_limit:
if low_limit is None or high_limit is None:
# TODO: a better fix? need to wait for connection?
...
Copy link
Member

Choose a reason for hiding this comment

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

It might be possible to have one more fallback that is subscribing to the setpoint PV's metadata callback- but other than that, there's not that much more we can do if we want to rely on an attribute instead of a signal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right. What gave me pause mostly was the fact that we hide the limit widgets in this scenario - perhaps we just say "well, show the widgets at least so they can be set"

... In typing the above, though, I think there's no method for setting .limits with these widgets (in the fallback scenario you accurately described in this comment) - right? Or am I missing it?

Copy link
Member

Choose a reason for hiding this comment

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

Right, these widgets are read-only. I think they are just the little text tags that go under the limit switch indicators.

typhos/positioner.py Outdated Show resolved Hide resolved
@klauer klauer changed the title WIP: patch over issue 565 FIX: patch over positioner limits = (None, None) issue Aug 14, 2023
@klauer klauer marked this pull request as ready for review August 14, 2023 17:24
Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

This looks right to me, pending pre-release notes.

I wonder if there are similar portions of typhos that have issues with unfilled/un-initialized signals/values. I suppose we'll find them as we go

@klauer klauer merged commit 1fb9d4f into pcdshub:master Aug 14, 2023
7 of 9 checks passed
@klauer klauer deleted the fix_positioner_limits_attr branch August 14, 2023 20:29
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.

Positioner widget uncaught type error in _link_limits_by_limits_attr (fee_m2h)
3 participants