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

Expose MRES in the EpicsMotor #1141

Open
DominicOram opened this issue Aug 1, 2023 · 6 comments
Open

Expose MRES in the EpicsMotor #1141

DominicOram opened this issue Aug 1, 2023 · 6 comments

Comments

@DominicOram
Copy link
Contributor

DominicOram commented Aug 1, 2023

It is useful to get the MRES out of a motor to give you a tolerance to work out if the motor is at the position you want it to be.

@DominicOram DominicOram changed the title Exposue ACCL and MRES in the EpicsMotor Expose ACCL and MRES in the EpicsMotor Aug 1, 2023
@DominicOram DominicOram changed the title Expose ACCL and MRES in the EpicsMotor Expose MRES in the EpicsMotor Aug 1, 2023
@prjemian
Copy link
Contributor

prjemian commented Aug 1, 2023 via email

@DominicOram
Copy link
Contributor Author

Yh, that's the solution I currently have but I didn't really like it as I would probably end up using it so much in my codebase that EpicsMotorWithMRES becomes more of a standard than EpicsMotor. I actually think being able to ask a motor for its tolerance is quite a universal thing. To clarify, I would put this in as read-only, setting resolutions is definitely not something we should be doing.

@prjemian
Copy link
Contributor

prjemian commented Aug 1, 2023

Having bluesky/ophyd know the tolerance or step size of a motor is less universal than I originally imagined. Like <5% of an instrument's axes from the various instruments I see at the APS.

There are already lots of signals (EPICS PVs) connected for an EpicsMotor. What is one more, you might ask? One might also ask where does one draw the line at the "one more" question (such as for ACCL or VBAS)? I'm still thinking this is not in such broad use that it should be made for all.

So here's the evil example which I use with a soft IOC that simulates a working beamline. The default SREV of 200 is just too small for my examples and test cases, so I change it:

class MyEpicsMotor(EpicsMotor):
    steps_per_revolution = Component(EpicsSignal, ".SREV", kind="omitted")


m1 = MyEpicsMotor(f"{IOC}m1", name="m1", labels=("motor",))
m2 = MyEpicsMotor(f"{IOC}m2", name="m2", labels=("motor",))
m3 = MyEpicsMotor(f"{IOC}m3", name="m3", labels=("motor",))
m4 = MyEpicsMotor(f"{IOC}m4", name="m4", labels=("motor",))

m1.wait_for_connection()
m1.steps_per_revolution.put(2000)

@prjemian
Copy link
Contributor

prjemian commented Aug 1, 2023

The time-to-velocity is exactly the example for why MRES is needed. But you also need ACCL and VBAS to properly compute the time it takes to reach VELO, and to compute the time required for a move. Also need BDST, VBAS (maybe others) if end-of-move backlash correction is a concern (usually not for fly scans).

@DominicOram
Copy link
Contributor Author

So a lot of the PVs you mention are also needed for #1122. Some of them, such as ACCL are actually already there. To answer your question about where does one draw the line with another question; what is the overhead for adding more Signals? I'm not sure there is any significant overhead computationally or in code complexity?

@prjemian
Copy link
Contributor

prjemian commented Aug 1, 2023

I believe the only addition to latency is that it adds another EPICS PV search and connection and then ophyd Signal creation. All these seem inconsequential. Adding MRES does not change the probability of connection success since these fields are common to the EPICS motor record and should be connectable if the RBV and VAL fields connect. (Which might fail if someone is replicating the IOC without using EPICS base. Odd edge case, that one.)

FWIW, I'm not opposed to the addition, it's useful. Especially as EpicsSignalRO. If someone really wants to change the MRES from ophyd, that special case can subclass.

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

No branches or pull requests

2 participants