Open canismarko opened 1 month ago
This event_type
kwarg is new to me. The docstring that describes it does not help me much.
@gfabbris -- Why is event_type="setpoint"
needed? What does this do?
The line of code in question: https://github.com/BCDA-APS/apstools/blame/11a97074a737cf63fb3a8462ecc209cd7d646e24/apstools/devices/positioner_soft_done.py#L141
is responsible for ensuring that the soft target of the positioner is updated when the setpoint changes. Why not drop the additional kwarg?
See: https://github.com/bluesky/ophyd/blob/5df3f5694f5c4c0ac049f0e601512f220e85744b/ophyd/signal.py#L1690
Will add check if "setpoint"
is one of the device's .event_types
before subscribing. This solves the problem.
I'm on travel, so will take a look at this later this later this week. But the event_type = "setpoint"
is needed so that the target is changed when you change the setpoint in Bluesky, but will not change during a ramp when the setpoint is changed in EPICS. If I remember correctly, if you use no event_type
it will default to the value
which is triggered when the readback changes (so will change when EPICS changes the value).
Good advice. Will keep the subscription but checking if "setpoint"
is a supported event type. If it is, then use that kwarg.
BTW: This is tested by test_put_and_stop()
which tests interrupted moves.
All tests pass. Ready for review.
In apstools v 1.7.0, a new subscription was added that uses the event_type="setpoint". In a real device, this works fine, but for simulated devices this fails because "setpoint" is not a valid event type.
Not sure what the right solution is, in part because I don't really understand the different subscription event types in ophyd. Perhaps a try…except… block?