Skip to content

Children of ohphyd-async devices are not resolved properly in plans #327

Description

@canismarko

Consider the following plan:

{
    "name": "mv", 
    "args": ["sim_motor_2.user_setpoint", -20]
}

If sim_motor_2 is a device created during the startup script with the following:

from ophyd_async.epics.motor import Motor

with init_devices():
    sim_motor_2 = Motor("25idc:simMotor:m2", name="sim_motor_2")

then I would expect this description to result in:

RE(mv(sim_motor_2.user_setpoint, -20))

However I get the following exception: AttributeError: 'str' object has no attribute 'parent'

In the existing plans and devices YAML file I see:

  sim_motor_2:
    classname: Motor
    is_flyable: true
    is_movable: true
    is_readable: true
    module: ophyd_async.epics.motor

However, there are no components. An equivalent device using ophyd produces the following:

  sim_motor_2:
    classname: EpicsMotor
    components:
      acceleration:
        classname: EpicsSignal
        is_flyable: false
        is_movable: true
        is_readable: true
        module: ophyd.signal
      ...

Best I can tell, this causes _is_object_name_in_list(v) to fail and the device does not get resolved from it's name "sim_motor_2.user_setpoint" to the actual device to be moved.

Looking ahead, the following line should call _get_nspace_object. I'm not sure if this will work either, since this function relies on the device having component_names, which ophyd-async devices don't have.

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