sardana-org / sardana

Moved to GitLab: https://gitlab.com/sardana-org/sardana
39 stars 52 forks source link

hand motor dial_limits to hardware controller #1344

Open dschick opened 4 years ago

dschick commented 4 years ago

Hi all,

I was wondering, if it is possible to write and read the motor dial_limits, which are set via the set_lm macro, towards/from the underlying hardware controller?

In my case the controller hardware supports software limits, so I would like to have this consistent from hardware <-> Tango <-> Sardana

Best

Daniel

reszelaz commented 4 years ago

Hi Daniel,

It is currently not possible, however your ideas is very interesting. We also were thinking about it in the past and it was even identified on the short-tem/mid-term roadmap in the ICALEPCS2019 paper:

Next we will focus on exposing to the user an enriched unified interface of certain capabilities of the laboratory equipment regardless of the underneath implementation (hardware or software). Examples of those capabilities are regions-of-interest for 1D and 2D experimental channels, or limits enforcement and backlash correction for moveables.

Related to this, I think that the step_per_unit is a similar example of such a capability. I know some motion controllers which implements this kind of conversion.

dschick commented 4 years ago

I was just wondering if there is a particular reason why the step_per_unit, velocity and acceleration are available as axis attributes and the limits and the backlash are not.

At least the limits would help to keep them constistent adnd might prevent some bad crashes

dschick commented 3 years ago

comming back to this here: Wouldn't it be possible to add a set_lim method to the controller class and link it to the set_lm macro?

BTW. would it be mor convinient to change or add the aliases set_dial_lim and set_user_lim ? It is a bit inconsistent with the set_pos and set_user_pos macros.

dschick commented 3 years ago

I just browsed the code I think I found the right code pieces.

Regarding the design, I would propose to add a dial_limit_lower and dial_limit_upper as additional attributes to the poolmotor. The user can add the required logic in the controller's get/set_axis_par methods.

The set_lm macro would propagte the lower and upper limits then not only to the dial_object but also to the motor attributes dial_limit_lower and dial_limit_upper.

What do you think about that? If you agree I would create a PR. In addition one could think also about the backlash

Best

Daniel