You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I am not sure about the first part - maybe setting any variable is a bad idea. As for refactoring - do you imagine a "big bang" kind of PR that does the changes and updates all users at the same time?
I am thinking about descriptor based solution. Something like
where the variant image = osgar.input() would just declare the name and handle its setting, while the @osgar.input("image") variant marks the method as a handler. Calling self.dropped.publish(1)' would do what self.bus.publish('dropped', 1)does now. For anyone having experience with pyqt it should be fairly familiar way of working. Therunand/orupdatewould have to be changed accordingly, most likely evolving into something likespinandspinOnce. Also the bus.registercall would be handled insideNode.init. But it is not all roses - I am not sure how to support dynamic outputs in this setup yet (like the once coming from config in Pull` case).
I am not ready to make full fledged proposal yet - I just wanted to let everyone know what I am thinking. In the mean time, I don't mind helping with some improvements to Node.
I was going to create "new" issue and I see it is here already for almost 3 years :) ... maybe it is time. We would like to do more changes (like removal of "application" so that all config files have to be complete and not "parametrized" by application). Finally cleanup to keep only the "core" utilities in osgar and drop/move unused bits ... but let's start with these 2 listed in the original message from 2020.
It is not obvious that
osgar.node:Node
automatically fills variables received byself.listen()
(for exampleself.scan
when it receivesscan
). I would propose to add new functionregister_variables('scan', 'pose3d')
, which would automatically defineself.scan
andself.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
Node
including external projects, so I would like agreement before I start it.The text was updated successfully, but these errors were encountered: