Closed jwnimmer-tri closed 1 year ago
Where in pydrake would this python file go?
As far as an implementation pattern, either of meldis
or model_visualizer
are a good example. The class is in one file, and next door there's a sub-module with a main function that can be run from the command line.
The question then is which top-level model to place it in. I hadn't thought about that yet, but my first reaction is pydrake.multibody
, so it would be like python3 -m pydrake.multibody.foobarbaz --input=carrot.obj
.
I'm fine with pydrake.multibody
. Seems as good as anything else.
We should probably leave room in the command line naming design so that we can output either SDFormat or URDF (or maybe even MJCF) at the user's choice, even if for now it only does SDFormat. I could foresee users wanting the option to use a different output format.
(See also https://github.com/kevinzakka/obj2mjcf/ for related work.)
There was a question about including a cross reference to the obj2mjcf
resource linked above. So, until that last piece gets added, we'll leave this issue open.
I'll circle back to #19070 soon and mention both mesh_to_model
and obj2mjcf
in the documentation there.
I'll most likely also update the doxygen for class Parser with cross-links. For me, that class overview is already extremely difficult to read so I'm not quite sure yet about how to swing it.
First thought: probably some of the class Parser
doc could be spilled to the parsing_doxygen.h or so. I'm sure parsing_doxygen.h also needs some refresh as well.
With the doc changes landed in #19070, I understand this to be complete.
In #18776 we added the ability to parse an OBJ file directly into a MultibodyPlant + SceneGraph. It presumes lot of defaults for things, which is useful for certain uses cases and/or prototyping, but those defaults are not always satisfactory.
When the user needs more than we can offer with that Parser feature, they should instead write a real model file that wraps the OBJ.
To date, we have
drake/manipulation/util/meshlab_to_sdf.py
available to semi-automate that model file creation process, but:At this point, we should be able to do better by directly creating the SDFormat file using Drake features, without any need to shell out to meshlab.
The call to action here is to reimplement that tool, with better features, and install it as part of pydrake.
Near term, we'd want these options:
package.xml
. The uri will refer to thatpackage://
. (We'll calculate the relative directory name to use to reach from the package.xml directory to the mesh file directory.)Longer term, we could image that this tool could also grow features like: