Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize parameters before ROS2 callbacks #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amalnanavati
Copy link
Contributor

@amalnanavati amalnanavati commented Aug 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant