pymoveit2
pymoveit2 copied to clipboard
Initialize parameters before ROS2 callbacks
In general, it is best practice to initial all parameters before ROS interfaces that have callbacks. Because as soon as we initialize the ROS2 interfaces, they can theoretically be called, even if their necessary parameters are not yet initialized.
A real-world example I faced on a particularly slow computer:
-
__init__
created the joint state subscriber, but did not yet createself.__joint_names
- The first joint state message was received.
- The code crashed (because
self.__joint_names
) does not exist.
This PR should address issues like that.