Comments (2)
My current work around is:
class XYZLimitsChecker(Device):
"""Checks that a position is within the XYZ limits of the motor.
To use set the x, y, z vector to the device and read check `within_limits`
"""
def __init__(self, prefix: str) -> None:
self.within_limits = False
axes = ["X", "Y", "Z"]
self.limit_signals = {
axis: (
epics_signal_r(float, f"{prefix}{axis}.LLM"),
epics_signal_r(float, f"{prefix}{axis}.HLM"),
)
for axis in axes
}
def children(self) -> Iterator[Tuple[str, Device]]:
for attr, signals in self.limit_signals.items():
yield attr + "low_lim", signals[0]
yield attr + "high_lim", signals[1]
return super().children()
async def _check_limits(self, position: np.ndarray):
check_within_limits = True
for i, axis_limits in enumerate(self.limit_signals.values()):
check_within_limits &= (
(await axis_limits[0].get_value())
< position[i]
< (await axis_limits[1].get_value())
)
self.within_limits = check_within_limits
def set(self, position: np.ndarray) -> AsyncStatus:
return AsyncStatus(wait_for(self._check_limits(position), None))
def my_plan():
yield from bps.set(limit_checker, [1, 2, 3])
if limit_checker.within_limits:
...
from ophyd-async.
Discussed offline and decided plan logic that gets limits from specific signals on the motor, then put the plan stub in ophyd-async next to the Motor class
from ophyd-async.
Related Issues (20)
- `AsyncStatus` takes an `Awaitable` according to type signature but rejects anything that isn't a coroutine HOT 3
- Pilatus arms too early
- Clearer documentation on how to use the reading context manager in a `StandardReadable`
- `set_mock_values` does not work with `observe_value` HOT 5
- epics_signal_rw fail to connect with typeerror when they are not set at epics HOT 1
- Pilatus arming logic does not fully wait for armed PV HOT 1
- Make `PilatusController` support Pilatus 3 deadtime HOT 1
- Allow SoftSignals metadata (units, limits etc.)
- Rename `DetectorControl.arm` to make the function of the returned status clearer
- Convert signal readings and `get_values` to pure python types
- Remove type conversion in `device_save_loader.py`
- Require units for signals and motors HOT 4
- `StandardReadable` breaks with nested hinted signals HOT 1
- Reading/configuration assert error message is the wrong way around
- Only support the formalized pvi structure from PandA HOT 1
- Drop old version of event model
- Make a PandA flyer that is implemented with a PCOMP block
- Make a motor record flyer
- Use the run and stage decorators for the plans in the tests
- Device names should be reported within all errors HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ophyd-async.