Skip to content

WIP Abstract classes clarifications - for discussion at code camp

Created by: rhfogh

This WIP changes AbstractActuator, AbstractMotor, and HardwareObjectMixin. I have made the consequential changes in a number of other classes, to show how this would work, but if we agreed on this we would have to extend it to many other classes. The PR is applied on top of PR #495.

Currently it it is not always clear (certainly to me) which function and which class a certain behaviour belongs in. These changes should make the resulting code more uniform and so easier to maintain, which could be important, since we are now about to make a major refactoring. This is to some extent going back on changes I insisted on earlier, for which I apologise.

The general idea is that:

  • The internal attribtues should be managed only in AbstractActuator and HardwareObjectMicxin, where they are defined.
  • Subclasses should have sole responsibility for implementing get_value and _set_value,
  • Internal attributes are modified only by caliling the update_something functions, and it is the responsibility of the subclasses to call those when needed.

Specifically the changes are:

  • Make the following attribute '__double_underscore:

    • HardwareObjectMixin.__ready_event
    • HardwareObjectMixin.__state
    • HardwareObjectMixin.__specific_state
    • AbstractActuator.__nominal_value
    • AbstractActuator.__nominal_limits
  • Remove the call to self.update_value() from AbstractActuator.set_value()

  • Add AbstractActuator.get_nominal_value

  • Replace direct access to internal attributes with function calls

Merge request reports