ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Qt-Javascript hybrid applications

Hi all,

Not a project in itself, but just wanted to share some highlights from a recent adventure with Qt-Javascript hybrid application development for visualisations.

I’ve always been caught in a tug-of-war between robotics developers wanting something that they can contribute to and slot into their build environment and product teams demanding web applications for cloud services / mobile devices. Never really found a way to win that battle - one need or the other usually gets met, and quite often clumsily, but rarely both.

Until now. I recently got caught in the middle of such a tug-of-war again and given that it’s been a couple of years, decided to do some research and move myself past the prejudiced ‘javascript is evil’ stance I’ve always taken. What I found was a good reminder to keep looking at things with fresh eyes!

  • Javascript libraries aren’t all that hard to write
  • The javascript world is ludicrously well equipped with an abundance of data visualisation libraries
  • Qt5 has QWebEngineView which is now based on Chromium’s Webkit (great for obvious reasons)
  • QWebEngineView hides all the details of app hosting, file serving
  • Very easy to interact between the Qt application and the web app
  • The hybrid application can comfortably be part of a python setuptools package
  • Javascript libraries are easy to share and deploy via Qt resource (.qrc) bundles

So I did a spike test and built some javascript libraries and qt-js hybrid applications for visualising the runtime state of behaviour trees. The results? I now have a package that can comfortably sit inside the developer’s environment (pythonic or ROS2) and one that they are quite likely to contribute to with the very appealing benefit - all of the core functionality is in the javascript libraries and web application which can be very easily migrated to a polished cloud service or mobile device application by the web teams with the skills to do so.

  • py_trees_js - javascript libraries for rendering behaviour trees with a simple qt-js demo (parse the README for more details on how the qt-js integration works)
  • py_trees_ros_viewer - a qt-js hybrid viewer that uses the py_trees_js javascript libraries for visualising behaviour trees running in a ROS2 ecosystem

Hope this is as enlightening for others planning to do some gui development as it was for me. Happy to field questions here.

1 Like

This is quite interesting. Thanks for contributing!
Have you seen this: https://www.youtube.com/watch?v=lCGa7LkDNp0
This bot was based of webOS + ROS2 and supports full-screen web applications which behave and work like Native and can integrate with ROS2. Hence there is no need of extra layer of Qt.
Currently webOS OSE (Open Source Edition) is also supported as a Tier3 Development Platform for ROS2 development. See https://github.com/ros/meta-ros/wiki/OpenEmbedded-Build-Instructions