Robotics StackExchange | Archived questions

Creating a Custom Display Icon for RVIZ Panels

Hello, I have been trying to add a custom icon to further customize a RViz panel that I am working on. I want to replace the default class icon (this one:https://github.com/ros2/rviz/blob/humble/rviz_common/icons/default_class_icon.png) that appears on the top of the panel, but I cannot seem to get it to appear in RViz.

Here is the code that I was able to find online. I have tried it in both my panel and widget classes and I have had no success.

                std::string icon_path = "/home/ubuntu/projects/test_ws/src/testing_project/test_package/icons/test_image.png";
            setWindowIcon(QIcon(icon_path.c_str()));

(the directory path is hardcoded for testing, and will be changed later) I also have the icons folder included in the share folder from CMake.

I am still pretty new to creating QT GUIs for RViz, so any help would be greatly appreciated! Edit: I am running ros 2 Foxy on Ubuntu 20.04 (on an arm machine)

Asked by SS on 2023-08-04 08:57:39 UTC

Comments

Answers