-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save assets for generated cylinder meshes #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main comments:
- I tested and the porposed PR does seem to fix the issue for Cylinder collider, however a similar problem will still occur for other basic geometries: box and sphere.
- Better not to modify the
ConvertMeshToColliders()
and instead create a new function to handle the basic geometry (either one for all three, or a separate one for each if there is not much to share in the code). - Better to create the newly generated meshes inside the same directory as the URDF, rather than a new folder outside.
com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs
Outdated
Show resolved
Hide resolved
com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I confirm your assessment that the issue is just with Cylinder and not with Sphere and Box.
- The issue seems to persist when convex decomposition = unity.
- I think it is better not to create the generated cylinder mesh in a new folder outside. As it fragments the artifacts created by URDF importer. And may lead to mistakes, e.g. when transferring the artifacts to a different project.
- If possible I prefer that we handle the creation of the folder and generating the name, outside the
ConvertMeshToColiders()
, but I am ok if it can't be done.
com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs
Outdated
Show resolved
Hide resolved
com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs
Outdated
Show resolved
Hide resolved
com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs
Outdated
Show resolved
Hide resolved
nit: do we want to add a couple of unit tests for the changes? :) |
good point, i have actually just been wondering about this! i thought some simple but relatively solid tests would be 1) importing a urdf with a) VHACD and b) Unity's mesh decomposer; 2) saving the new GameObjects as prefabs, and 3) adding the prefabs back into the scene. at each point the colliders should be verified to not be null, or something similar. however! given that there are no URDF files inherent to the package, i wasn't sure exactly how to proceed! we could add some dummy URDF files that are just primitive geometries, but it wouldn't cover |
@at669 Get you. For unit tests, I think we don't need to make it complicated. The tests of working with both VHACD and unity are out of the scope of this PR's change. It needs to be tested, but they don't have to be in this PR because it is more like integration tests. We only need to verify that the methods/functions in this PR behave as you expected. In this PR, I personally think we only need to test the following functions:
|
com.unity.robotics.urdf-importer/Runtime/Extensions/UrdfGeometryCollision.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [ ] use unity's standard method to generate collision meshes instead of vhacd. either all the time (as the cylinder is always convex), but specially when user has not selected vhacd decomposition method.
- all other changes look good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
minor suggestion for improvement is naming the unit tests according to this: https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices#naming-your-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass and the code looks good.
* Adding ROS# link (#39) * Adding ROS# link * Fixing Unity 2020.1.8f1 compatability issues. * Adding precompile error if an older version of Unity is used * Fixing spacing * Removing 2020.1 version enforcement * Remove degree to rad conversions (#44) * AIRO-331 Re-organizing package directory and adding Yamato integration (#41) * Moving package into package folder * Adding test project. * Adding boilerplate tests. * Add yamato config * Disabling audio in test project and adding submodule checkout to Yamato cfg * Adding Unity .gitattributes and normalizing line endings. (#42) * Vidur/remove controller limits for free joints (#45) * AIRO - 365 Add feedback while URDF is being imported (#43) * Convert RobotExtensions to an iterator * Adding EditorCorutine to package manifest * Adding import status data * Updating the assembly file. * Adding option to add or remove progressbar * Update git links with tags(#48) * Regenerating meta files for tests copied from ROS-TCP-Connector * Latest VHACD (#49) * Remove the submodule for now, to avoid a packman bug. (#52) * Update version (#53) * VHACD license -> root folder (#55) * VHACD dlls should not be in LFS * update latest version in readme (#58) * Disable RigidbodyEditor controls at runtime Fix for #59 * test.txt * deleting the txt file added by mistake * Adding default values for Articulation Body Parameters (#57) * Adding a default value if mass is zero. * Correct the null value error in Articulation Body attributes * Adding return value of Create function as GameObject * Adding default values variables for damping and friction * Update link branch from master to main. (#66) * Updating Contribution Content (#68) * Contributing content * PR feedback * Adding PR template (#73) * Resolve conflicts (#80) Merge main to dev and resolve all the conflicts * Update package.json (#84) * Fix bad merge * Fix bad merge * support for runtime urdf importing (#67) * moved "NeedsRuntimeConversion" to Runtime and adjusted namespace * moved MeshProcessing and AssetHandler to Runtime * move all editor only calls to RuntimeURDF.cs * fixed compile issues: builds in runtime, but does nothing * URDF can now be imported in runtime (STL only) * cleanup: moved files into corresponding runtime directories. * Added UnityMeshImporter and AssimpNet plugin * Loading collada files in runtime (using AssimpNet plugin). * Proper creation of materials for HDRP/Standard when loading collada files * disable Assimpnet for IL2CPP builds * added parameter to URDFRobotExtensions.Create() to allow the option of using the runtime import mode in editor. * cleaning up material extensions * disable controller component during import to avoid incorrect configuration. * fix for the default diffuse material in HDRP * minor clean up and code convention fixes * added support for .obj visual meshes * don't enable the controller automatically in runtime mode. * variable name typo fix * Broke the Create() function into pipeline stages to reuse the code for both the none-blocking coroutine and blocking function call. * Added RuntimeURDFImporter component as an example usage of runtime import functionality * fix the bug with editor dialogs * random code formatting fixes * Moved and renamed the Transform extension function FindChildByQuery * fixed materials for URP projects. * removed unused code. * minor code formatting * removed unused code * URDF imported objects lose mesh colliders when made into prefabs (#72) * Saving decomposed mesh * checks to make the newly added vhacd mesh creation be compatible with the runtime mode. * minor code formatting Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> * removing lfs as causes issues with the plugin dlls * deleting plugin to add it back without lfs * adding back AssimpNet libraries without lfs * deleting vhacd library to add it back without lfs * adding back VHACD libraries without lfs * Fixed the overexposed highlight color Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> * Hamid/fix bad merge (#87) * Merge 0.3.0 into main (#86) * Adding ROS# link (#39) * Adding ROS# link * Fixing Unity 2020.1.8f1 compatability issues. * Adding precompile error if an older version of Unity is used * Fixing spacing * Removing 2020.1 version enforcement * Remove degree to rad conversions (#44) * AIRO-331 Re-organizing package directory and adding Yamato integration (#41) * Moving package into package folder * Adding test project. * Adding boilerplate tests. * Add yamato config * Disabling audio in test project and adding submodule checkout to Yamato cfg * Adding Unity .gitattributes and normalizing line endings. (#42) * Vidur/remove controller limits for free joints (#45) * AIRO - 365 Add feedback while URDF is being imported (#43) * Convert RobotExtensions to an iterator * Adding EditorCorutine to package manifest * Adding import status data * Updating the assembly file. * Adding option to add or remove progressbar * Update git links with tags(#48) * Regenerating meta files for tests copied from ROS-TCP-Connector * Latest VHACD (#49) * Remove the submodule for now, to avoid a packman bug. (#52) * Update version (#53) * VHACD license -> root folder (#55) * VHACD dlls should not be in LFS * update latest version in readme (#58) * Disable RigidbodyEditor controls at runtime Fix for #59 * test.txt * deleting the txt file added by mistake * Adding default values for Articulation Body Parameters (#57) * Adding a default value if mass is zero. * Correct the null value error in Articulation Body attributes * Adding return value of Create function as GameObject * Adding default values variables for damping and friction * Update link branch from master to main. (#66) * Updating Contribution Content (#68) * Contributing content * PR feedback * Adding PR template (#73) * Resolve conflicts (#80) Merge main to dev and resolve all the conflicts * Update package.json (#84) * Fix bad merge * Fix bad merge Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> * removing unused meta file Co-authored-by: LaurieCheers-unity <73140792+LaurieCheers-unity@users.noreply.github.com> Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> * [AIRO-589] Model and collision rotation mismatch (#78) correct collider rotation only for y-axis and add null check * Replace ../ with package://, throw more warnings otherwise (#90) * Replace ../ with package://, throw more warnings otherwise * PR feedback: more descriptive warning message * add changelog (#92) add changelog * Save assets for generated cylinder meshes (#91) * Initial GeneratedMeshes directory commit * Cylinder mesh saving * PR feedback: new cylinder method, Unity decomposer support * PR feedback: non-VHACD cylinder, unit tests * PR feedback: unit test conventions * Forum links to README, config.yml (#96) * Add test coverage (#93) * Math, VHACD Unit Tests (#94) * Math, VHACD tests * Organization for Math, VHACD * Vector3 fixes * fix the bash numeric error (#99) * RuntimeURDF tests (#97) * RuntimeURDF tests, skippping dialogs * PR feedback: removing unused blocks * Geometry, GeometryCollision Tests (#95) * UrdfGeometry tests * Folder organization * PR feedback: test fixes, Yamato config * Added sample STL for Geometry tests * UrdfCollisionExtensions, UrdfCollisionsExtensions Tests (#98) * UrdfCollisionExtensions tests * UrdfCollisionsExtensions tests * Destroy objects, naming conventions * UrdfCollision(s) minor cleanup, reorganization * Fixing line coverage typo * Cleaning up Geometry tests, fixes to Collisions tests * Remove class member * add unit tests for UrdfJoint (#100) * BuiltInExtensions Tests (#103) * BuiltInExtensions Tests * Removed debug logs * PR feedback: internal BuiltIn class * Add unit tests for UrdfJoints (#102) * UrdfAssetPathHandler Tests (#104) * UrdfAssetPathHandler Tests * UrdfAssetPathHandler test cleanup * PR feedback * update version to 0.4.0 (#109) Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: LaurieCheers-unity <73140792+LaurieCheers-unity@users.noreply.github.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> Co-authored-by: Hamid Younesy <hyounesy@users.noreply.github.com>
* Adding ROS# link (#39) * Adding ROS# link * Fixing Unity 2020.1.8f1 compatability issues. * Adding precompile error if an older version of Unity is used * Fixing spacing * Removing 2020.1 version enforcement * Remove degree to rad conversions (#44) * AIRO-331 Re-organizing package directory and adding Yamato integration (#41) * Moving package into package folder * Adding test project. * Adding boilerplate tests. * Add yamato config * Disabling audio in test project and adding submodule checkout to Yamato cfg * Adding Unity .gitattributes and normalizing line endings. (#42) * Vidur/remove controller limits for free joints (#45) * AIRO - 365 Add feedback while URDF is being imported (#43) * Convert RobotExtensions to an iterator * Adding EditorCorutine to package manifest * Adding import status data * Updating the assembly file. * Adding option to add or remove progressbar * Update git links with tags(#48) * Regenerating meta files for tests copied from ROS-TCP-Connector * Latest VHACD (#49) * Remove the submodule for now, to avoid a packman bug. (#52) * Update version (#53) * VHACD license -> root folder (#55) * VHACD dlls should not be in LFS * update latest version in readme (#58) * Disable RigidbodyEditor controls at runtime Fix for #59 * test.txt * deleting the txt file added by mistake * Adding default values for Articulation Body Parameters (#57) * Adding a default value if mass is zero. * Correct the null value error in Articulation Body attributes * Adding return value of Create function as GameObject * Adding default values variables for damping and friction * Update link branch from master to main. (#66) * Updating Contribution Content (#68) * Contributing content * PR feedback * Adding PR template (#73) * Resolve conflicts (#80) Merge main to dev and resolve all the conflicts * Update package.json (#84) * Fix bad merge * Fix bad merge * support for runtime urdf importing (#67) * moved "NeedsRuntimeConversion" to Runtime and adjusted namespace * moved MeshProcessing and AssetHandler to Runtime * move all editor only calls to RuntimeURDF.cs * fixed compile issues: builds in runtime, but does nothing * URDF can now be imported in runtime (STL only) * cleanup: moved files into corresponding runtime directories. * Added UnityMeshImporter and AssimpNet plugin * Loading collada files in runtime (using AssimpNet plugin). * Proper creation of materials for HDRP/Standard when loading collada files * disable Assimpnet for IL2CPP builds * added parameter to URDFRobotExtensions.Create() to allow the option of using the runtime import mode in editor. * cleaning up material extensions * disable controller component during import to avoid incorrect configuration. * fix for the default diffuse material in HDRP * minor clean up and code convention fixes * added support for .obj visual meshes * don't enable the controller automatically in runtime mode. * variable name typo fix * Broke the Create() function into pipeline stages to reuse the code for both the none-blocking coroutine and blocking function call. * Added RuntimeURDFImporter component as an example usage of runtime import functionality * fix the bug with editor dialogs * random code formatting fixes * Moved and renamed the Transform extension function FindChildByQuery * fixed materials for URP projects. * removed unused code. * minor code formatting * removed unused code * URDF imported objects lose mesh colliders when made into prefabs (#72) * Saving decomposed mesh * checks to make the newly added vhacd mesh creation be compatible with the runtime mode. * minor code formatting Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> * removing lfs as causes issues with the plugin dlls * deleting plugin to add it back without lfs * adding back AssimpNet libraries without lfs * deleting vhacd library to add it back without lfs * adding back VHACD libraries without lfs * Fixed the overexposed highlight color Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> * Hamid/fix bad merge (#87) * Merge 0.3.0 into main (#86) * Adding ROS# link (#39) * Adding ROS# link * Fixing Unity 2020.1.8f1 compatability issues. * Adding precompile error if an older version of Unity is used * Fixing spacing * Removing 2020.1 version enforcement * Remove degree to rad conversions (#44) * AIRO-331 Re-organizing package directory and adding Yamato integration (#41) * Moving package into package folder * Adding test project. * Adding boilerplate tests. * Add yamato config * Disabling audio in test project and adding submodule checkout to Yamato cfg * Adding Unity .gitattributes and normalizing line endings. (#42) * Vidur/remove controller limits for free joints (#45) * AIRO - 365 Add feedback while URDF is being imported (#43) * Convert RobotExtensions to an iterator * Adding EditorCorutine to package manifest * Adding import status data * Updating the assembly file. * Adding option to add or remove progressbar * Update git links with tags(#48) * Regenerating meta files for tests copied from ROS-TCP-Connector * Latest VHACD (#49) * Remove the submodule for now, to avoid a packman bug. (#52) * Update version (#53) * VHACD license -> root folder (#55) * VHACD dlls should not be in LFS * update latest version in readme (#58) * Disable RigidbodyEditor controls at runtime Fix for #59 * test.txt * deleting the txt file added by mistake * Adding default values for Articulation Body Parameters (#57) * Adding a default value if mass is zero. * Correct the null value error in Articulation Body attributes * Adding return value of Create function as GameObject * Adding default values variables for damping and friction * Update link branch from master to main. (#66) * Updating Contribution Content (#68) * Contributing content * PR feedback * Adding PR template (#73) * Resolve conflicts (#80) Merge main to dev and resolve all the conflicts * Update package.json (#84) * Fix bad merge * Fix bad merge Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> * removing unused meta file Co-authored-by: LaurieCheers-unity <73140792+LaurieCheers-unity@users.noreply.github.com> Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> * [AIRO-589] Model and collision rotation mismatch (#78) correct collider rotation only for y-axis and add null check * Replace ../ with package://, throw more warnings otherwise (#90) * Replace ../ with package://, throw more warnings otherwise * PR feedback: more descriptive warning message * add changelog (#92) add changelog * Save assets for generated cylinder meshes (#91) * Initial GeneratedMeshes directory commit * Cylinder mesh saving * PR feedback: new cylinder method, Unity decomposer support * PR feedback: non-VHACD cylinder, unit tests * PR feedback: unit test conventions * Forum links to README, config.yml (#96) * Add test coverage (#93) * Math, VHACD Unit Tests (#94) * Math, VHACD tests * Organization for Math, VHACD * Vector3 fixes * fix the bash numeric error (#99) * RuntimeURDF tests (#97) * RuntimeURDF tests, skippping dialogs * PR feedback: removing unused blocks * Geometry, GeometryCollision Tests (#95) * UrdfGeometry tests * Folder organization * PR feedback: test fixes, Yamato config * Added sample STL for Geometry tests * UrdfCollisionExtensions, UrdfCollisionsExtensions Tests (#98) * UrdfCollisionExtensions tests * UrdfCollisionsExtensions tests * Destroy objects, naming conventions * UrdfCollision(s) minor cleanup, reorganization * Fixing line coverage typo * Cleaning up Geometry tests, fixes to Collisions tests * Remove class member * add unit tests for UrdfJoint (#100) * BuiltInExtensions Tests (#103) * BuiltInExtensions Tests * Removed debug logs * PR feedback: internal BuiltIn class * Add unit tests for UrdfJoints (#102) * UrdfAssetPathHandler Tests (#104) * UrdfAssetPathHandler Tests * UrdfAssetPathHandler test cleanup * PR feedback * update version to 0.4.0 (#109) Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: LaurieCheers-unity <73140792+LaurieCheers-unity@users.noreply.github.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> Co-authored-by: Hamid Younesy <hyounesy@users.noreply.github.com> Co-authored-by: vidurvij-Unity <60901103+vidurvij-Unity@users.noreply.github.com> Co-authored-by: Devin Miller (Unity) <mrpropellers@users.noreply.github.com> Co-authored-by: Devin Miller <devin.miller@unity3d.com> Co-authored-by: LaurieCheers-unity <73140792+LaurieCheers-unity@users.noreply.github.com> Co-authored-by: peifeng-unity <56408141+peifeng-unity@users.noreply.github.com> Co-authored-by: Hamid Younesy <hamid.younesy@unity3d.com> Co-authored-by: Amanda <31416491+at669@users.noreply.github.com> Co-authored-by: Hamid Younesy <hyounesy@users.noreply.github.com>
* Initial GeneratedMeshes directory commit * Cylinder mesh saving * PR feedback: new cylinder method, Unity decomposer support * PR feedback: non-VHACD cylinder, unit tests * PR feedback: unit test conventions
Proposed change(s)
This PR introduces saving the generated cylinder meshes (to a new folder,
Assets/URDF/GeneratedMeshes
, as primitive cylinders will have no associated .stl filename/path) such that they can be saved as prefabs. Additionally, minor changes to the Runtime AssetDatabase-related functions to prevent creating duplicate folders and providing an option for creating a unique path when saving a new asset.Screen.Recording.2021-05-05.at.10.42.44.AM.mov
Useful links (GitHub issues, JIRA tickets, forum threads, etc.)
Types of change(s)
Testing and Verification
Tested importing user's sample URDF (single cylinder), saving to prefab, and re-adding the prefab to the scene to ensure all colliders still appeared as desired. Repeated the process with Turtlebot (box + cylinders) and Niryo One (many custom meshes, no cylinders). Additionally, ran & verified existing unit tests pass.
Test Configuration:
Checklist
dev
branchdev
branchOther comments