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.
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
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
Co-workers: @albertarla, @iggyrrieta. All contributions are welcome and open to discussion.
Apache License 2.0