project structure question concerning dynamic reconfigure and the parameter server
I have a system with many nodes, some written in C++, and some in Python. When devising the original "block diagram" for the system, I defined a parameter /operating_condition
that is basically like a system-wide global variable. It is just an integer value used to tell many of the nodes what the system is currently doing. Often in callbacks, I will poll the parameter server to get an updated value for this parameter, and then respond accordingly.
I later found that as the number of nodes went up, and hence, the number of calls to the parameter server, I started getting large delays randomly cropping up. I eventually read on this page that this was a bad idea, and I switched almost all of these calls to use getParamCached()
. That fixed the problem, but it is clearly not quite the right solution, more of just a temporary fix. As the project has evolved, I have been forced into writing more and more Python nodes, and there is no equivalent to getParamCached()
(see this page). Using the dynamic_reconfigure package doesn't seem quite right either.
What is the right solution? A topic subscription with a callback in each node? Write my own service handler that can handle requests from each node? Just don't use "global" variables?