pymoveit2 icon indicating copy to clipboard operation
pymoveit2 copied to clipboard

Initialize parameters before ROS2 callbacks

Open amalnanavati opened this issue 6 months ago • 0 comments

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:

  1. __init__ created the joint state subscriber, but did not yet create self.__joint_names
  2. The first joint state message was received.
  3. The code crashed (because self.__joint_names) does not exist.

This PR should address issues like that.

amalnanavati avatar Aug 23 '24 01:08 amalnanavati