jupyter-robotics / jupyterlab-urdf

A URDF viewer and editor extension for JupyterLab.
https://jupyterlab-urdf.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
97 stars 9 forks source link

Suggestions: Mesh loading and URDF export #31

Open stephane-caron opened 1 year ago

stephane-caron commented 1 year ago

This is a nice project :smiley: Here are my two cents. (This is a discussion thread rather than an issue, feel free to close any time.)

Context: I'm writing a note on building URDF models (in the context of refreshing this description) and this tool could simplify the tutorial a great deal. Currently the process is:

With two tabs in JupyterLite and seeing the updates immediatly, this loop would accelerate nicely!

Adoption brake: I read in the docs that mesh loading relies on ROS, which assumes ROS (an adoption brake in itself :smile:). Meshes change along the edition process, so it would reduce friction further to be able to load/upload them in the interface directly (e.g. by drag-and-dropping STL files?).

Suggestion: Exporting a description package once the model is ready could be convenient too. Or maybe assume the notebook is started from the directory of the description package, and interpret file paths from there?

Hoping this is helpful feedback. All the best for this project!

IsabelParedes commented 1 year ago

Hi @stephane-caron!

Thank you so much for your input. And you're right, relying on ROS to load mesh files really limits the use. But, I've recently changed that so that instead of relying on a ROS connection, mesh files can be loaded directly. For now, this only works with JupyterLab. The idea is that the description folders will be in the directory where JupyterLab is launched from. Plus there is an option to modify the path to search for the description files. So from the file manager in JupyterLab, you should be able to modify mesh files on the go. I'm currently working on updating the documentation to reflect this, and all the new changes should be available in the next release.

Hopefully, this also works with JupyterLite. But I'm waiting until JupyterLite completes the transition to JupyterLab 4 to make sure.

A question for you, we've been considering some sort of integration with JupyterCAD maybe to modify the mesh files directly. Would that be something you would consider useful?

Thanks!

stephane-caron commented 1 year ago

JupyterCAD looks very cool! I'm a beginner at CAD, many parts in Upkie were done in Blender :see_no_evil: Recently new contributors have designed or redesigned parts in FreeCAD, so I've started to learn it. Next time I do CAD I'll try JupyterCAD.

I guess what would be great overall would be to do the whole mechanical design in one software (e.g. JupyterCAD) that exports a proper URDF. From what I've seen the URDF exporter from SolidWorks is not there yet (some post-processing to do to get a decent URDF). Onshape to Robot is an alternative, but I'd rather use open source tools rather than depend on commercial products for this.

IsabelParedes commented 1 year ago

I think it should be possible to export URDFs from JupyterCAD and continue editing them with this extension. To make exporting possible, JupyterCAD would need some sort of joint property manager such as the one in SolidWorks, but it's doable.

Do you have examples or could you describe a bit more the post-processing needed when using SolidWorks? I haven't used SolidWorks in a long time, but I'm just curious.

stephane-caron commented 1 year ago

This is just anecdotal evidence, but the post-processing I did once after receiving a SW-exported URDF for a variant of Upkie involved turning joint frames around (some leg copy-pasting gone wrong I assume), along with some meshes that were not exported properly. I have no idea which version of the SolidWorks to URDF Exporter or SolidWorks were used to produce that imperfect URDF :sweat_smile: