/Custom_Qt5_Rviz2

Workaround to implement RenderPanel of Rviz2 to custom Qt5 Application

Primary LanguageC++Apache License 2.0Apache-2.0

Custom_Qt5_Rviz2

UPDATE: The proper way of doing this is done in this repository from @mjeronimo.

In this repository there is an example of how to implement the RenderPanel of rviz2. This is a workaround and it's not the best solution but it's the only way I found that work. The two repositories are for distribution ros2 foxy. For this to work, I made a small changes to the rviz source code, these can be found on my fork. This example tries to be a ROS2 version of this tutorial.

Screenshot of MyViz working

Compile & run

To compile the project:

cd $HOME
# Download
mkdir myviz_ws && cd myviz_ws
git clone https://github.com/MartiBolet/rviz
git clone https://github.com/MartiBolet/Custom_Qt5_Rviz2
cd rviz
git checkout -b develop_integration_with_qt origin/develop_integration_with_qt
# Build
cd $HOME/myviz_ws
colcon build
# Install
source ./install/setup.bash

TIP when testing: After compiling rviz for the first time, you can add COLCON_IGNORE files inside the individual rviz packages. This will allow you to not recompile all when you make a small change.

Run:

ros2 run myviz myviz

Error libGL error: failed to create drawable

If there is an error like libGL error: failed to create drawable and the RenderPanel doesn't show anything, try to:

export LIBGL_ALWAYS_SOFTWARE=1

From this answer and this tutorial

Contributors:

Co-workers: @albertarla, @iggyrrieta. All contributions are welcome and open to discussion.

License

Apache License 2.0