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

cache tf_prefix #201

Open
wants to merge 2 commits into
base: noetic-devel
Choose a base branch
from

Conversation

peroxyacyl
Copy link

On every joint_state callback, the node searches tf_prefix parameter, and it loads an unignorable impact on roscore processes.

This patch caches the result of the first search of tf_prefix. A downside is that we cannot update tf_prefix dynamically anymore (anyone does?).

ref. #200

@@ -87,7 +87,8 @@ class JointStateListener {
MimicMap mimic_;
bool use_tf_static_;
bool ignore_timestamp_;

std::string tf_prefix_;
bool tf_prefix_cached_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these members changes the size of the class, and that breaks ABI. This will have to be stored somewhere else so we can release it into Noetic.

One solution I've seen is to create a static global map in the .cpp file where the key is the this pointer, and the value is the things we want to store per class instance.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your quick review!
I've put a minimal thread-safe map and stored (this, tf_prefix) in the callback. The entry is deleted in the destructor.

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

Successfully merging this pull request may close these issues.

3 participants