robotology / superquadric-model

Framework for modeling and visualizing objects through superquadrics
GNU General Public License v2.0
6 stars 4 forks source link

Consider using VTK for display purposes #6

Closed pattacini closed 6 years ago

pattacini commented 8 years ago

We should really consider using VTK to display the superquadric. Look at this code snippet to show an implicit function.

giuliavezzani commented 8 years ago

It looks very nice. I'll see how to extend it to superquadric and how to make it transparent.

pattacini commented 8 years ago

Since VTK would introduce a further dependency (see the dependency hell problem :wink:), we could enable/disable its use via cmake options and then deal with this choice accordingly in the code.

pattacini commented 8 years ago

More material on this:

pattacini commented 8 years ago

OpenGL is also a viable solution indeed.

giuliavezzani commented 8 years ago

Ok, thank you very much for this material!

klausberger1707 commented 8 years ago

maybe you can use the vtk implementation of superquadrics http://www.vtk.org/doc/nightly/html/classvtkSuperquadric.html

pattacini commented 8 years ago

@nrj127 thanks for pointing out.

@giuliavezzani actually therein it's said that:

vtkSuperquadric computes the implicit function and function gradient for a superquadric

If VTK really provides the gradient we need, that would be nice!

giuliavezzani commented 8 years ago

@nrj127 thank you very much for the suggestion. @pattacini it seems a very useful upgrade for our repo!

pattacini commented 7 years ago

@giuliavezzani now that we have some free time it might be worth reconsidering getting accustomed to VTK as a tool, in general.

pattacini commented 6 years ago

VTK is definitely the way to go. Look at this VTK viewer that displays point clouds along with their representation based on simple quadrics.

ezgif com-optimize

The code implementing the viewer makes use of Ipopt with analytical Jacobian.

cc @fbottarel @claudiofantacci

claudiofantacci commented 6 years ago

Great work @pattacini 🎉 Just a note from my side. I've been working on a PC visualization tool based on PCLVisualizer that itself relies on VTK. It's an experimental work on a private repository which includes an AR and a mesh visualization tool as well (it's something that I have been used for my research so far).

As soon as #robotology/yarp/1597 is merged we will also have a compatibility layer from/to YARP to/from PCL pointclouds which may be worth exploiting!

Maybe at a certain point we could discuss which one is preferable and implement everything in a single amazing 👓 tool!

pattacini commented 6 years ago

@claudiofantacci mine is just a demonstrator and, in no way, it claims to be a sort of "official" viewer 😉

My feeling is that VTK kind of outclasses PCL in terms of what can be easily shown; think of isosurfaces, marching cubes and the like.

giuliavezzani commented 6 years ago

@pattacini, that's very cool! We could absolutely use it for superquadric visualization. @claudiofantacci, we could discuss together about the best tool to use for this kind of applications.

claudiofantacci commented 6 years ago

My feeling is that VTK kind of outclasses PCL in terms of what can be easily shown; think of isosurfaces, marching cubes and the like.

Yes! The point to discuss are indeed the limitations on the PCL side. I reckon that VTK is much much (much much and did I say much?) better than PCL visualizer.

pattacini commented 6 years ago

Displaying superquadrics in VTK is doable as expected 😉

ezgif com-optimize

The code is available in https://github.com/pattacini/find-superquadric.

Aside from the viewer, that code implements the analytical Jacobian which we could now readily compare against the solution based on finite differences, even though the former works with a subset of rotations (i.e. only one angle around the z-axis). This is to keep things simple to start with and also to see whether we don't lose too much in terms of the representation of generic objects lying on a table.

@fbottarel has a version which incorporates the viewer only so that we can use it to display superquadrics at will.