Render RViz window to texture

asked 2018-05-04 01:15:49 -0500

rohan.smith gravatar image

I'm trying to embed a visualisation of a robot into a custom program. To this end, I am using a structure similar to the librviz tutorial at the ROS wiki here. I've managed to get it rendering appropriately on its own in a separate window, however I want to embed it into our Qt QML based program. I can get a viewport embedded and rendering, however the QML frame is not updated since the QML scenegraph doesn't know it's been updated.

I've got an Ogre::RenderTargetListener that tells me it's rendering, and I can save the rendered frame to a file from within the listener's postRenderTargetUpdate() call, however I would like to instead save the rendered frame to memory so it can then be displayed via a QQuickPaintedItem's custom paint() function. The Ogre::RenderTarget base class has copyContentsToMemory() which takes an Ogre::PixelBox which stores the size of an image and a pointer to where to place it, but trying to fill it out with the values of the render target causes an Ogre::InvalidParametersException due to no depth parameter returned from the render target's getMetrics() function. If there's no width or height, then it does not throw this exception, but it also doesn't do anything except return immediately.

edit retag flag offensive close merge delete


Not an answer, but I thought you might be interested in QtQuick support for RViz to build fancy HMIs on ROS Discourse.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-04 03:05:29 -0500 )edit

See #q142351 - if not a full solution then maybe some of the rviz_camera_stream code can be repurposed.

lucasw gravatar image lucasw  ( 2018-05-04 12:01:32 -0500 )edit