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

Implementing Motor controller IOC, is there a hook for a home action? #831

Open
toqduj opened this issue Dec 1, 2023 · 1 comment
Open

Comments

@toqduj
Copy link

toqduj commented Dec 1, 2023

Hey everyone,

Quick question. In fake_motor_record.py there is the following hook for when a value is written, which I can use to kick off an actual motor movement:

    async def value_write_hook(fields, value):
        nonlocal have_new_position
        # This happens when a user puts to `motor.VAL`
        print("New position requested!", value)
        have_new_position = True

Is there a similar hook available for a homing request? (HOMF or HOMR, if I understand this correctly https://epics.anl.gov/bcda/synApps/motor/motorRecord.html ).

Bit of background: I wrote a python class for communicating with Trinamics boards, with low- and high-level motion commands, and now want to expose the axis parameters through a fake-motor EPICS class. Repo is here: https://github.com/BAMresearch/Trinamic_TMCM6214_TMCL_IOC

@toqduj
Copy link
Author

toqduj commented Dec 5, 2023

For those curious as to how it's going:

The IOC is starting to perform quite well, ready for testing with our machine's SPEC interface next week. It reads the configuration from a YAML file, homes on initialisation, and then it's ready.

Moves implement backlash too, and internally pint is used for unit handling. Using the hook, there is no delay to the start of the move, and you can also send a new position while it's still moving. most of it is asynchronous.

There's a few small things still to be done (mostly to take action when an EPICS parameter is adjusted for velocity/acceleration, homing action and zeroing), but it's not bad.

I'm just curious as to why the instance doesn't report actual position except for such properties as the RRBV, the bare instance reports only the preset .VAL positions. So if you're tracking this parameter, it seems like it instantly moved from initial to final position. The fake_motor_record example updated the .VAL field during its fake move, but this doesn't work as it then thinks it's continually getting new target positions.

Input still very welcome.

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

1 participant