Skip to content

Children of ophyd-async devices that are not readable do not get included in devices #328

@canismarko

Description

@canismarko

Consider the following device in the queueserver startup:

from ophyd_async.epics.motor import Motor
from ophyd_async.core import init_devices, Device

class SimStage(Device):
    def __init__(self, prefix: str, name = ""):
        self.vertical = Motor(f"{prefix}m2")
        self.horizontal = Motor(f"{prefix}m3")
        super().__init__(name=name)

with init_devices():
    sim_stage = SimStage("25idc:simMotor:", name="asim_stage")

The following should be valid to put on the queue since sim_stage.vertical satisfies bluesky.protocols.Movable.

{
    "name": "mv", 
    "args": ["sim_stage.vertical", -20]
}

However, sim_stage does not appear in the resulting existing devices and plans file, because the parent device sim_stagedoes not satisfying either of bluesky.protocols.Readable or bluesky.protocols.Flyable:

If I add protocols.HasName to the list of checks in is_device(), then the sim_stage shows up in the list of devices:

  sim_stage:
    classname: SimStage
    is_flyable: false
    is_movable: false
    is_readable: false
    module: __main__

Then together with #327, the original plan should work.

In practice, most of my parent devices are actually Readable, so maybe this isn't worth fixing, but maybe this should at least be documented somewhere? Or a warning issued if registering a non-readable device?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions