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

Redefining the position of a motor with an absolute encoder #218

Open
kmpeters opened this issue Jun 13, 2024 · 9 comments
Open

Redefining the position of a motor with an absolute encoder #218

kmpeters opened this issue Jun 13, 2024 · 9 comments

Comments

@kmpeters
Copy link
Member

There are some situations where it is necessary to disallow redefining the position of an axis with an absolute encoder.

This can be done at the driver level for model-3 motor drivers:

epics-motor/motorAcsMotion@17a0aac

Should this be done at the motor record level instead?

@kmpeters
Copy link
Member Author

@MarkRivers & @tboegi, do you have thoughts on this?

@tboegi
Copy link
Contributor

tboegi commented Jun 13, 2024

@kmpeters
My thoughts:
The record itself does not know, if there is an absolute encoder - or not.
The driver may know it - if it can ask the controller, if there is an absolute encoder.

For the TwinCAT case, there is a definition of a "homing procedure".
And if it is 0, the motor can not be homed, because it has an absolute encoder.
At the same time, we make the FOFF switch invisible in the CSS screen.

So in short: I do it on the driver level as well:
https://github.com/EuropeanSpallationSource/m-epics-ethercatmc/blob/master/ethercatmcApp/src/ethercatmcAxis.cpp#L723--L734

@mp49
Copy link
Contributor

mp49 commented Jun 13, 2024

For the Galil controller, I think it just ignores 'set position' commands for the encoder if there is an absolute encoder. I suspect setting the motor position is still allowed, but the Galil driver will automatically sync the motor to the encoder after a move so if we do try to set motor position it will immediately be set back to match the encoder. So for homing these axes we just set OFF (and we set FOFF=1). However, if the driver didn't auto-sync, we'd need to be able to set the motor position via a motor record SET=1.

@kmpeters
Copy link
Member Author

One problem I see is that the motor record redefines the controller's position when the MRES is changed. This is welcome if the MRES is changing because the microstepping level of a stage is changing. It is NOT a welcome change if the EGU is being changed (from mm to um, for example). If the driver doesn't protect against setting the position and a user wants to work in different units, the redefining of the absolute encoder's position is very surprising.

@mp49
Copy link
Contributor

mp49 commented Jun 17, 2024

When changing units it does seem like it would be useful to not automatically set the controller position. Although that's not specific to absolute encoders, right?

How would it work? Provide a new field that enables/disables 'set position'? Then if you want to change units, first disable that new field, then change MRES, then enable the new field again?

I know some axes or controllers and/or sites have a policy where the controller is always correct, and never want to set position from EPICS. So being able to disable that from the motor record may be useful.

@tboegi
Copy link
Contributor

tboegi commented Jun 18, 2024

@mp49 and @kmpeters : Could someone be so kind and enlighten me and others,
when and why MRES is changed at runtime ?
Is it a user thing, we want micrometer instead of millimeter ?
Or is it commissioning ?

@kmpeters
Copy link
Member Author

Users at the APS have changed the MRES because they wanted to change the unit from millimeter to microns. We have also changed the MRES of motors when the number of mini/microsteps on a stepper motor driver are changed. I consider both of these to be normal reasons to change the MRES at runtime.

We have changed the MRES for XPS axes to increase the resolution, but this also requires changing the stepSize argument of XPSCreateAxis and restarting the IOC.

@tboegi
Copy link
Contributor

tboegi commented Jun 19, 2024

Thanks for sharing the "we need to change MRES" use cases, @kmpeters
Back to the controllers with absolute encoders. Does it make sense to "install"
a "soft motor" on top of the "hard motor" that allows MRES to be changed
e.g. from millimeter to micron ?
And then we can leave the "hard motor" alone,
not bothering it with any "load position" calls.
Especially as we can fiddle e.g. the limit switches through the new MINP field:
#211
Any thougths ?

@kmpeters
Copy link
Member Author

I would not want to add soft motors to a setup unless it was absolutely necessary and there was no other way to achieve the desired effect. Soft motors come with their own quirks and I would expect the addition of the soft motor to cause more problems than it solves.

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

3 participants