creating Publishers or Subscribers in the bodies of callbacks
following a comment in this question it seems that triggering to publish a topic inside callback of a subscriber may cause issues such as TCP/IP connection. Although I'm not sure if the comment in the above question means making a publisher insider a call back or triggering to publish inside a callback.
I have an application that has two topics which make a loop by triggering publishment in their subscriber callbacks. I have tried to control the frquency by rospy.sleep to 1 kHz, but my question is if there are other things I can do to make sure this process stays stable with no issues. And my other question is if this is in general a bad idea for having a setup like above, and what can go wrong in general.
yes. Don't use Python for systems with determinism requirements.
There is a big difference between publishing to a topic in a callback as you state in the question and creating a publisher in a callback as you state in the question title. As noted on a different post of yours, posting code is encouraged. As it stands right now, I don't even know what your question is.
@billy it is a large code base, I can't put any fraction of it here that would make sense, and for this I tried to make my questions as general as possible dependent only on ros itself. The question is if in any ros application triggering a publisher to publish in a callback may cause any issue, and if there's a something one can do about it.