6.7 Limitations, Bookkeeping and Workarounds
As we foresee or hear of common stumbling blocks with ROS2 in URscript, we will add guides on how to handle or mitigate them.
6.7.1 Publisher, and subscriber lifetime
When created, each publisher and subscriber will live as long as the program, unless it is closed with the .close() method. Subsequent use of the publisher or subscriber will result in a runtime exception. Creating handles continuously in a program will leak resources, and is discouraged.
6.7.2 Blocking aspect of subscribers
Creating a subscriber or publisher, as well as calling any method on them comes with a minimum of 2 ms delay. Doing any such operation in between moves might affect their ability to blend, and the robot motion could appear to be stuttering. If ROS2 functionality is needed between moves, reading/publishing in a separate thread and communicating with that thread via global variables is recommended.