ALBA-Synchrotron / sardana-tango

Repository for Sardana Tango plugins (TangoAttributeCtrls, etc)
GNU General Public License v3.0
0 stars 3 forks source link

State of TangoAttrMotorCtrl #9

Open dschick opened 3 years ago

dschick commented 3 years ago

Hi,

we are heavily using this great sardana-tango driver in our lab but noticed an issue with the TangoAttrMotorCtrl when determining the state of the motor.

As written in the StateOne() method initially the quality of the attribute is checked. In our self-written tango DS we only change the State of the tango DS from 'DevState.ONtoDevState.MOVING`. I hoped that the attribute quality is adapted automatically, but it does not.

So as fallback, the TangoAttrMotorCtrl then checks the current position and the set position with the corresponding threshold value. This of course requires a bit of overhead, as our tango DS does report the State already by itself.

I was wondering what would be the best way to adapt the TangoAttrMotorCtrl or our Tango DS? As I understand it, I would need to change the attribute.qualitiy() by myself in the TangoDS? I would like to avoid that and instead ask then for the State of the TangoDS in the TangoAttrMotorCtrl.

My idea would be the following sequence:

  1. ask for the attribute.quality
  2. check if a threshold is set:
    1. if the threshold is zero (or better negative) it is neglected
    2. if the threshold is >(=) 0 the current and set positions are compared
  3. the State of the TangoDS will be directly used

let me know what you think of this.

Best

Daniel

guifrecuni commented 3 years ago

Hi, making this "general-purpose controller" more generic makes sense to me ;-D I guess with just few properties you can make the controller fit your needs and may help somebody else in the future

dschick commented 3 years ago

just made a PR #10 works as expected for me. One would need to agree on how the handle the encoder threshold