What is the best way to store a one-time calculation that other nodes may need?
It seems like a waste to publish a message for data that will be constant. Would my node store it as a parameter?
Edit: Sorry about the vague description. I’m still in the learning phase. I’m not doing something specific yet. I’m imagining how to use these tools.
Maybe I can explain a little more about my context of understanding and where this question came from.
My understanding:
- When nodes publish topic messages they are transmitted (through network or shared memory) to all subscribers ASAP. The send & receive queues are only for managing processing bandwidth but otherwise messages are transient.
- Nodes may have differing lifetimes. Some may start after others and some may terminate before others.
So I’m imagining a scenario where Node_A is running and calculates something that will remain persistent for some time, call it Calibration_A. Later Node_B starts and needs the information called Calibration_A. In my current understanding, described as an example:
- If Node_A publishes Calibration_A as a topic, the message lives long enough to transmit to any current subscribers and then it’s gone.
- When Node_B starts later, it could subscribe to Calibration_A. However, it would only receive this the next time Node_A republishes this constant data.
Since Calibration_A remains constant, it seems like a waste of transmission resources to just keep sending it at regular intervals. I also learned that we have Parameters and Services. Parameters seem like they can persist data but from what I read they are more for configuration.
So from my example, what is the best mechanism to persist Calibration_A so other nodes can access it later?
Could you provide a little more information about what you are actually trying to do?
There is nothing "in ROS" (as vague as such a statement is) that requires for things to be continuously published, but right now you give us too little information to know what you are encountering.