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

Save cached markers for later re-publish #85

Open
artivis opened this issue Jul 5, 2018 · 0 comments
Open

Save cached markers for later re-publish #85

artivis opened this issue Jul 5, 2018 · 0 comments

Comments

@artivis
Copy link

artivis commented Jul 5, 2018

Hi, first of thanks for the great tool !

While doing some debugging I was troubled by the fact that after disabling/re-enabling a marker (marker namespace) in Rviz, the marker would not show up again.

It seems that by design the trigger clears the cached markers. Thus calling trigger in a while loop is pointless unless the markers are fed again. I circumvent this the following manner :

bool RvizVisualTools::trigger(const bool keep_cache) // keep_cache is false by default
{
...
if (!keep_cache)
    markers_.markers.clear();  // remove all cached markers
  return result;
}

/* in main */
while (ros::ok())
{
    // Don't forget to trigger the publisher! And save the cache!
    visual_tools_->trigger(true);

    ros::spinOnce();
    rate.sleep();
}

I'd be happy to open a PR, just wanted to check first with you if that was an appropriate design.
Maybe you'd prefer more explicit functions calls like :

visual_tools_->keepCache(true);

// Don't forget to trigger the publisher!
visual_tools_->trigger();

// with helpers
bool cache_keeped = visual_tools_->isKeepingCache();
visual_tools_->clearCache();

Cheers.

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

No branches or pull requests

1 participant