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();
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 callingtrigger
in a while loop is pointless unless the markers are fed again. I circumvent this the following manner :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 :
Cheers.