Robotics StackExchange | Archived questions

Is there any reasonable way to build a ROS GUI with PyQt on Raspberry Pi2/Melodic/Ubuntu 18.04 ?

I have spent the whole day trying to get to the bottom of this. I'd appreciate any ideas.

The goal

Build a simple GUI in python on a Raspberry Pi 2, that publishes ROS messages. The Pi has Lubuntu 18.04 and ROS Melodic installed from the repository. Since I'm familiar with Qt, I'd like to use that if possible.

I want to build and test the UI on my main desktop PC, because it is much faster. That also has Lubuntu 18.04 and ROS Melodic.

The issues

Which version of PyQT to use ? PyQt5 only seems to work with Python3. ROS for some unknown reason can integrate nodes written in pretty much any language except Python3.

PyQT4 supports Python2 and Python3, but it appears to require Qt4. I have Qt5 installed on my main PC and am extremely reluctant to risk messing that up by installing Qt4.

Does ROS already have some version of PyQt installed ? I do not want to mess up ROS either.

Asked by elpidiovaldez on 2020-12-23 16:35:07 UTC

Comments

Is ROS2 an option? You could then use QT5 with python3.

Asked by SmallJoeMan on 2020-12-23 17:52:54 UTC

@SmallJoeMan It is an option as long as it can talk to the rest of the system running ROS1. There is some sort of bridge. Seems like a steep learning curve, but then it also seems impossible to do this apparently simple thing using the tools with which I am familiar.

Asked by elpidiovaldez on 2020-12-23 21:18:09 UTC

In the past I've made a really simple gui with Tkinter.

Asked by SmallJoeMan on 2020-12-24 02:45:59 UTC

It probably isn't the most elegant option, but according to your specific need you could write your GUI with Python3 and PyQt5 and run the Python2 code from bash using the Popen method of the subprocess module. There are also other ways to call Python2 code from Python3, as suggested in this stack overflow question.

However, if you are not depending on any specific package that only runs on ROS Melodic you could try installing Ubuntu 20.04 and ROS Noetic, where you could use Python3 to write both your GUI and your ROS code

Asked by Pepis on 2020-12-27 18:07:11 UTC

I tried Lubuntu 20.04 on the Pi 2 (with the intention of using Python 3 based ROS Noetic). It was a non-starter - Lubuntu 20.04 is unusably slow on a Pi 2. It is a real shame that Lubuntu now needs much more resources.

Finally I abandoned Qt5 and am making some progress just using TKinter. All my problems stem from the Python 2/3 quagmire. I will be so glad when Python 2 is laid to rest !!

Asked by elpidiovaldez on 2021-01-01 13:24:33 UTC

Answers