Closed luca-della-vedova closed 9 months ago
Setting this to ready for review. There are likely new issues to come up with further testing for the workcell editor mode but keeping adding them here might make the PR grow to an even more unmanageable size.
- I recommend changing the name of
MeshPrimitive
toPrimitiveShape
https://github.com/open-rmf/rmf_site/pull/177/commits/b57b53f85a73f41cee25763e4bad2e58aaf45152
- Why does
Geometry::Mesh
usefilename: String
instead ofsource: AssetSource
?
Good point, I think it was just to make conversion to urdf simpler but on second thought it really doesn't make a lot of sense. Fixed https://github.com/open-rmf/rmf_site/pull/177/commits/bff825832eb143e56abd916135aebd38f73311e7
I also found the issue with broken dependent references and fixed it in https://github.com/open-rmf/rmf_site/pull/177/commits/769d485036d0a19698d6e198aa572cc5f3312620.
There is still non-optimal behavior when flattening SDFs since all the models are assigned to the same parent. This issue actually originates from the sdf loading code since all visuals / collisions are assigned to the root element so there is no real hierarchy parsing there. I suspect we never bumped into this issue so far because all the SDFs we used have always been very simple with no complex hierarchies but this will probably become an issue once we start importing (for example) complex SDF workcells. My plan was to exploit the fact that Urdf is pretty much a subset of Sdf and unify the code for parsing of both, but I never got around to do it.
Hey, I'm getting one of the two errors when I'm trying to open a workcell with a mesh. I'm using the same workcell that I was using when developing the export URDF function.
2023-09-21T13:03:21.418787Z INFO librmf_site_editor::workspace: Opening workcell file
2023-09-21T13:03:21.419368Z ERROR librmf_site_editor::workspace: Failed loading workcell Error("missing field `source`", line: 101, column: 5)
or
2023-09-21T12:57:54.856592Z INFO librmf_site_editor::workspace: Opening workcell file
2023-09-21T12:57:54.857053Z ERROR librmf_site_editor::workspace: Failed loading workcell Error("no variant of enum Anchor found in flattened data", line: 70, column: 5)
Also, I still don't see the "Export URDF" button in the "File" menu.
Sorry forgot to reply to this!
Hey, I'm getting one of the two errors when I'm trying to open a workcell with a mesh. I'm using the same workcell that I was using when developing the export URDF function.
2023-09-21T13:03:21.418787Z INFO librmf_site_editor::workspace: Opening workcell file 2023-09-21T13:03:21.419368Z ERROR librmf_site_editor::workspace: Failed loading workcell Error("missing field `source`", line: 101, column: 5)
or
2023-09-21T12:57:54.856592Z INFO librmf_site_editor::workspace: Opening workcell file 2023-09-21T12:57:54.857053Z ERROR librmf_site_editor::workspace: Failed loading workcell Error("no variant of enum Anchor found in flattened data", line: 70, column: 5)
The file format changed, among other things the mesh filename changed from a String
to an AssetSource
and MeshConstraint
is gone for normal anchors, which might cause the errors above. Sadly the only way to fix that right now is to recreate a project.
Also, I still don't see the "Export URDF" button in the "File" menu.
True, I still need to do the refactor to only show some buttons in some states, didn't do it yet to avoid making this PR even more complex than it already is since that would touch the code in many areas that are not really workcell specific
Okay, let me know if I can help with this.
There are a few rough edges here and there but this is "stable enough" that it should be pretty much OK.
New feature implementation
Implemented feature
Based on #155 by @audrow, extends urdf export to also export joint and inertial data, as well as add a urdf import feature to convert URDF into a
Workcell
object. Having both allows adding an integration test that performs a roundtrip conversion inrmf_site_format
and makes sure that the files match. I am also refining various parts of the workcell editor mode and fix issues I found along the way. Will change it to in review and add a more detailed description of the changes once it's ready.Implementation description
Workcell
structure, including conversion back and forth fromurdf
.Workcell
format, including saving and loading to a site. No inspector is implemented yet though.NameInSite
components forNameInWorkcell
if the spawned object is a child of aWorkcell
. This will probably be removed in the future by having aNameInGroup
component that unifies the two.urdf
files through theOpen File
window.