-
Notifications
You must be signed in to change notification settings - Fork 12
Description
It is not obvious that osgar.node:Node automatically fills variables received by self.listen() (for example self.scan when it receives scan). I would propose to add new function register_variables('scan', 'pose3d'), which would automatically define self.scan and self.pose3d, and initialize them to None.
Open question is what to do with self.time, i.e. does it have to be also specified in call register_variables()?
What to do with variables, which are not listed? I would recommend to ignore and not set them.
The second proposed change is to modify Node.update() and extend it to
handler = getattr(self, "on_" + channel, None)
if handler is not None:
handler(getattr(self, channel))
I am using this construct in almost every class.
Note, that this refactoring influences ALL usages of Node including external projects, so I would like agreement before I start it.