I just noticed that the function XSensDriver.spin_once, that does the parsing, populating and publishing at a potentially high frequency, redefines all the required helper functions locally at every loop iteration.
I would expect to receive a (significant?) speed-up, if these functions were converted to ordinary member functions or free functions and thus were only defined once for the runtime of the node.
It should be possible to rewrite the handler dispatching code here in a straight-forward way using getattr(). I can try to provide a PR, if I find the time.
I just noticed that the function
XSensDriver.spin_once
, that does the parsing, populating and publishing at a potentially high frequency, redefines all the required helper functions locally at every loop iteration.I would expect to receive a (significant?) speed-up, if these functions were converted to ordinary member functions or free functions and thus were only defined once for the runtime of the node.
It should be possible to rewrite the handler dispatching code here in a straight-forward way using
getattr()
. I can try to provide a PR, if I find the time.