How do I change RViz Display attributes at runtime?

asked 2019-12-09 17:09:38 -0500

iomh gravatar image

My coworker has made a custom Display Plugin that turns PointCloud2 messages into a custom message type which is displayed in RViz. This Display has an attribute called "Maximum Z-Value" and "Minimum Z-Value" that I would like to change on the fly using RQT buttons with RViz embedded in RQT. I have tried writing a subscriber in the constructor of the Display Plugin, but I have nowhere to ros::spin() since I cannot do this in the constructor, and the constructor is called by RViz's own code.

My question is this: Is there anywhere that I can ros::spin() (and/or ros::init()) in order to achieve this? Is there an easier solution?

Thanks

edit retag flag offensive close merge delete