Conversation
|
Of all the parts of cc @azeey |
cmake/SearchForStuff.cmake
Outdated
| ######################################## | ||
| # Find ignition common | ||
| # Set a variable for generating ProjectConfig.cmake | ||
| find_package(ignition-common4 4.0 QUIET) |
There was a problem hiding this comment.
Is ign-common needed for anything other than common::split? I'd avoid adding a dependency if we don't need it. We already have sdf::split that provides the same functionality.
|
I agree with @scpeters about |
Another possibility is keeping USD support in a separate component within this codebase. The advantage would be giving it more visibility, tighter maintenance, and maybe setting the standard for adding other converters in the future. My concern with a separate repository is that unless we make it a first-class Ignition library, it may just go unmaintained very quickly (similar to ign-rndf). |
sdformat doesn't use |
If this is something that we think would be valuable, it would be a good excuse to update SDFormat to use |
I'm very new to the ignition build system so I might be totally off, does a separate component means declaring it with |
I've taken an initial step towards this in gazebosim/gz-cmake#190, which is awaiting review |
There is an aspect that is more significant than whether the code produces a library or executable, which is to define a cmake component for packaging purposes. See for instance the discussion of the |
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
It looks like Is this a mistake, or does |
On a somewhat related note, it looks like Do we need to wait until the next |
libsdformat depends on ignition-cmake2 but isn't an ignition-cmake project that uses the cmake macros like ign_configure_project and ign_configure_build. Until recently, it only depended on ignition-cmake2 indirectly via ignition-math6, although it now uses |
that comment is wrong; this code is still needed. |
I made a PR that removes this comment in #740
Before we go ahead and make changes to |
If we want to perpetually support conversion between SDFormat and USD, I think there are advantages to keeping this code in the same repository. Since it requires additional dependencies, I think adding it in a separate component would be appropriate. If we wanted to put this code in a separate repository, I think that would be a valid choice as well; it would just take a bit more effort to keep the code synchronized and manage version differences. It would also make it easier to limit our commitment to support of the USD format, for better or worse. |
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
src/usd/usd_parser/polygon_helper.cc
Outdated
| fit != triangulation.finite_facets_end(); ++fit) | ||
| { | ||
| auto &face = fit; | ||
| if (face->first->vertex(0)->info() > maxIndex || |
|
|
||
| ///////////////////////////////////////////////// | ||
| /// Main | ||
| int main(int argc, char **argv) |
There was a problem hiding this comment.
This shouldn't be needed if you link to gtest_main.
| { | ||
| auto opt = std::make_shared<Options>(); | ||
|
|
||
| _app.add_option("-i,--input", |
There was a problem hiding this comment.
nit: It will be nice to have the same cli for usd -> sdf and sdf -> usd converter, iirc, the sdf -> usd converter takes the input and output args as positionals.
| return false; | ||
| } | ||
|
|
||
| if (USD2SDF::IsUSD(filename)) |
There was a problem hiding this comment.
Is embedding the usd converter into the sdf parser something we should be doing?
| auto doc = makeSdfDoc(); | ||
| usd2g.read(filename, &doc); | ||
| sdferr << "here! it's a USD!\n"; | ||
| if (sdf::readDoc(&doc, _sdf, "usd file", _convert, _config, _errors)) |
There was a problem hiding this comment.
I don't quite understand this, shouldn't the 3rd param be the filename?
| { | ||
| std::cerr << "UsdPhysicsMassAPI " << pxr::TfStringify(_prim.GetPath()) << '\n'; | ||
| if (pxr::UsdAttribute massAttribute = | ||
| _prim.GetAttribute(pxr::TfToken("physics:mass"))) |
There was a problem hiding this comment.
Could we use pxr::UsdPhysicsMassApi to avoid hard coded tokens?
| if (mass < 0.0001) | ||
| { | ||
| mass = 0.1; | ||
| } |
There was a problem hiding this comment.
whats the reason for having a minimal mass?
| _world->gravity[0] = gravity[0]; | ||
| _world->gravity[1] = gravity[1]; | ||
| _world->gravity[2] = gravity[2]; |
| sdf::Camera camera; | ||
|
|
||
| auto variantCamera = pxr::UsdGeomCamera(_prim); | ||
| float horizontalAperture = 20.955; |
| { | ||
| pxr::SdfAssetPath materialPath; | ||
| pxr::UsdShadeInput diffuseTextureShaderInput = | ||
| variantshader.GetInput(pxr::TfToken("diffuse_texture")); |
There was a problem hiding this comment.
Is there a doc explaining the available tokens?
|
TODO
|
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
I've added the |
adlarkin
left a comment
There was a problem hiding this comment.
This PR is really large and doesn't have documentation, so it's hard to review all at once. Once #817 is merged, would you mind refactoring this PR to match the component structure? Then, we can break it up into smaller PRs and review the smaller PRs, like what we're doing for SDF -> USD conversion.
| if (tokens.size() > 1) | ||
| { | ||
| bool shortName = false; | ||
| if (tokens.size() == 2) | ||
| { | ||
| if (prim.IsA<pxr::UsdGeomGprim>() || | ||
| (std::string(prim.GetPrimTypeInfo().GetTypeName().GetText()) == "Plane")) | ||
| { | ||
| if (prim.GetPath().GetName() != "imu") | ||
| { | ||
| baseLink = "/" + tokens[0]; | ||
| shortName = true; | ||
| // exit(-1); | ||
| } | ||
| } | ||
| } | ||
| if(!shortName) | ||
| { | ||
| baseLink = "/" + tokens[0] + "/" + tokens[1]; | ||
| } | ||
| } |
There was a problem hiding this comment.
it looks like this code block can be deleted, because tokens.size() > 1 is already being checked in the above if statement: https://github.com/ignitionrobotics/sdformat/blob/58ac549f454601bcf1f58917965c64d93617f527/src/usd/usd_parser/parser_usd.cc#L183
| if (pxr::TfStringify(parent.GetPath()) == _name) | ||
| { | ||
| return; | ||
| } |
There was a problem hiding this comment.
This check can be removed, because it's comparing the prim's path (which has a /) with the prim's name (which does not have a /).
* polygon triangulation using the fan-triangulation algorithm Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org> * remove cgal dep Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org> * add todo Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org> * fix xformOp:transform parsing (#822) Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org> Co-authored-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
* fix y up Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org> * cleanup Signed-off-by: Teo Koon Peng <koonpeng@openrobotics.org>
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
Closing this PR in favour of this metaticket #866 |
🎉 New feature
Summary
FYI @adlarkin @koonpeng . Feel free to push code, cleanups or suggestions
This draft PR creates a prototype to convert USD files into SDF files.
For now I already tested with
simple_articulated.usdandur10.usd.Regarding joints there are two fields
physics:body0andphysics:body1that indicate the parent and child of the joint, but in usd format there is no distinction between them. We need to rework this part a little bit more. I have to modifyur10.usdato set parent asbody1and child asbody0. No changes are required in thesimple_articulated.usdfile.The current implementation supports:
Code need a huge refactor. We can probably use some ignition library such as ignition-common or ignition-math in the
usd_parserfolders because I copy-paste the code from urdf. There are object likeSphere, poses, Vectors quaternions, links and many other that I'm pretty sure that we can use something from these libraries.Test it
-DPXR_ENABLE_PYTHON_SUPPORT=0usdcat: It allows to convertusd(binary format) intousda(human redeable format). `usdcat binary.usa > output.usdausdview. It allows to visualizeusdfilessdfconverterwhich allows to convert aurdforusdfiles in tosdf. it's simple to use:sdfconverter -i <input> -o <ouput>Checklist
codecheckpassed (See contributing)Note to maintainers: Remember to use Squash-Merge