Use Jupyter as a user interface for robotics algorithms

I develop a project called the PyRI Open Source Teach Pendant. It is a Python based robotics programming tool, using Robot Raconteur and ROS to communicate with automation hardware. The project description can be found here on GitHub: GitHub - pyri-project/pyri-core: Python Restricted Industrial (PyRI) Open Source Teach Pendant Core Package

I work with research organizations, and I am frequently asked to integrate an algorithm into the teach pendant. These algorithms are typically written as Python or MATLAB scripts. These scripts take input data, process the data, and generate results and plots. They may also activate hardware at certain steps to collect data, such as during an optimization.

I think Jupyter would be an interesting solution for these algorithms, rather than developing a custom user interface for each algorithm. The interface will either be in a panel in a web browser, or in visual studio code, which are both supported by Jupyter. Everything will always be run locally either on the same machine or over a LAN connection.

My question to the Jupyter community is how would this integration best be accomplished? Can I create workbooks that present an interface that won’t intimidate users with less programming experience? Can the code be hidden so it appears like a normal interface to users?

how would this integration best be accomplished

My go-to for problems like this is using the Jupyter Widget ecosystem. Under the hood, these implement a observer/observable pattern, and can be implemented either with controls that shared synced state with the browser, or kept entirely server side.

The advantage here is it’s generally possible to build up a decent UI without any doing any JS/TS programming… but the option is there if something very bespoke is needed.

Can I create workbooks that present an interface that won’t intimidate users with less programming experience

I’ve used importnb for this, treating one or more notebooks as the “guts” of an application, which each export a few named components and “the app”, which can then be displayed with more focus on the “so what” and the narrative.

Sometimes, these “toy” apps grow up, and get moved to a proper importable module.

Can the code be hidden so it appears like a normal interface to users?

See the above, but yes, individual code inputs/outputs can be collapsed. For even more control, there are tools like panel, voila which can provide more standalone experiences, without the ability to drop down into how things actually work.

2 Likes

Thanks @bollwyvl for the great info!

2 Likes