Universal Robots Forum

Draw polygons and point clouds in Swing UI

I would like to visualize data from a lidar sensor and some polygons derived from this data. I found some posts saying that canvas elements are implemented in URCaps since June '18, but I couldn’t find any documentation or example code.

Is there a way for visualizing such data and regularly update it, or do I need to prepare an image in a python daemon and reload this regularly in java swing?

The java you are referring to that was implemented in june of last year was support for JavaSwing elements, and a swing URCap has a slightly different structure. I believe the functionality you’re looking for can be implemented by creating a class which extends JPanel, and overrides the paintComponent(Graphics g) method, and uses the Graphics object to do any painting/drawing. Take a look at this and this for more info.

EDIT: I believe canvas is an older java object, and I’m not sure if its supported under URCaps, but from research it seems that the method i describe above will accomplish the same thing

1 Like