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.
It is not obvious that
osgar.node:Nodeautomatically fills variables received byself.listen()(for exampleself.scanwhen it receivesscan). I would propose to add new functionregister_variables('scan', 'pose3d'), which would automatically defineself.scanandself.pose3d, and initialize them toNone.Open question is what to do with
self.time, i.e. does it have to be also specified in callregister_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 toI am using this construct in almost every class.
Note, that this refactoring influences ALL usages of
Nodeincluding external projects, so I would like agreement before I start it.