Closed ethanabrooks closed 2 years ago
I think this is an issue with the directory structure (though I thought I fixed this at some point). I will mark as a bug and look into it. The path handling should be more robust than this, so I think you might have uncovered a bug.
Looking at the URDF you provided, I see that the mesh filename refers to 013_apple/google_16k/textured.obj
:
This is a relative file path, so right now it's referring to nothing (because the URDF is actually inside the 013_apple
folder.
I think this package requires the _prototype.urdf
file to be outside of the 013_apple
folder. This would give you a new directory structure as follows:
_prototype.urdf
013_apple
└── google_16k
├── kinbody.xml
├── nontextured.ply
├── nontextured.stl
├── texture_map.png
├── textured.dae
├── textured.mtl
└── textured.obj
Then if you are running this script from within the root folder (where prototype.urdf
and folders of objects are), your python commands would be:
from object2urdf import ObjectUrdfBuilder
builder = ObjectUrdfBuilder('', urdf_prototype='_prototype.urdf') # Use empty string in first arg for current folder
builder.build_urdf(filename='013_apple/google_16k/textured.obj', force_overwrite=True, decompose_concave=True, force_decompose=False, center = 'mass')
Try this and let me know if this works.
I will say that attempting to load these objects using the iGibson
library I encountered the same issue, so I wonder if this is a deeper issue with the YCB dataset.
This does actually work for me.There are a few YCB objects (pulled directly from the YCB site) in the examples for this package. Have you tried running the relevant lines in build_object_library.py
? If that doesn't work, then maybe there's something different in our Python versions. Out of curiosity, what Python version are you running, and which OS?
python3.8, macOS version 12.1
I only had the issue with some objects and not others. Tuna can worked but apple didn't.
Huh, okay that's weird then. I'm stumped now.
So far this package has only been used (by our lab) in Ubuntu 18.04 and 20.04 and Windows 10. Perhaps there's some minute difference in directory handling in MacOS? I doubt this is the issue because Python handles this very well usually.
I'll keep thinking about this.
Ok thank you for your help. I have started using this repo: https://github.com/ChenEating716/pybullet-URDF-models
This appears to work on macOS for all models.
I have downloaded and unzipped the 16k laser scan of the YCB apple model from http://ycb-benchmarks.s3-website-us-east-1.amazonaws.com/.
My directory structure is as follows:
My
_prototype.urdf
is the same as https://github.com/harvard-microrobotics/object2urdf/blob/master/examples/ycb/_prototype.urdf.I run the following python code:
Output
``` No direct VHACD backend available, trying pybullet pybullet build time: Feb 1 2022 20:48:15 V-HACD V2.2 Syntax: testVHACD [options] --input infile.obj --output outfile.obj --log logfile.txt Options: --input Wavefront .obj input file name --output VRML 2.0 output file name --log Log file name --resolution Maximum number of voxels generated during the voxelization stage (default=100,000, range=10,000-16,000,000) --depth Maximum number of clipping stages. During each split stage, parts with a concavity higher than the user defined threshold are clipped according the "best" clipping plane (default=20, range=1-32) --concavity Maximum allowed concavity (default=0.0025, range=0.0-1.0) --planeDownsampling Controls the granularity of the search for the "best" clipping plane (default=4, range=1-16) --convexhullDownsampling Controls the precision of the convex-hull generation process during the clipping plane selection stage (default=4, range=1-16) --alpha Controls the bias toward clipping along symmetry planes (default=0.05, range=0.0-1.0) --beta Controls the bias toward clipping along revolution axes (default=0.05, range=0.0-1.0) --gamma Controls the maximum allowed concavity during the merge stage (default=0.00125, range=0.0-1.0) --delta Controls the bias toward maximaxing local concavity (default=0.05, range=0.0-1.0) --pca Enable/disable normalizing the mesh before applying the convex decomposition (default=0, range={0,1}) --mode 0: voxel-based approximate convex decomposition, 1: tetrahedron-based approximate convex decomposition (default=0, range={0,1}) --maxNumVerticesPerCH Controls the maximum number of triangles per convex-hull (default=64, range=4-1024) --minVolumePerCH Controls the adaptive sampling of the generated convex-hulls (default=0.0001, range=0.0-0.01) --convexhullApproximation Enable/disable approximation when computing convex-hulls (default=1, range={0,1}) --oclAcceleration Enable/disable OpenCL acceleration (default=0, range={0,1}) --oclPlatformID OpenCL platform id (default=0, range=0-# OCL platforms) --oclDeviceID OpenCL device id (default=0, range=0-# OCL devices) --help Print usage Examples: testVHACD.exe --input bunny.obj --output bunny_acd.obj --log log.txt + OpenCL (OFF) + Parameters input 013_apple/google_16k/textured.obj resolution 1000000 max. depth 20 max. concavity 0.001 plane down-sampling 4 convex-hull down-sampling 4 alpha 0.05 beta 0.05 gamma 0.0005 pca 0 mode 0 max. vertices per convex-hull 64 min. volume to add vertices to convex-hulls 0.0001 convex-hull approximation 1 OpenCL acceleration 1 OpenCL platform ID 0 OpenCL device ID 0 output 013_apple/google_16k/textured_vhacd.obj log /Users/ethanbrooks/ycb/vhacd_log.txt + Load mesh 0% [ Voxelization 20% ] Iteration 1 0% 0% [ Voxelization 20% ] Iteration 1 100% 0% [ Voxelization 40% ] Iteration 2 0% 0% [ Voxelization 40% ] Iteration 2 100% 0% [ Voxelization 60% ] Iteration 3 0% 0% [ Voxelization 60% ] Iteration 3 100% 10% [ Voxelization 100% ] Iteration 3 100% 10% [ Compute primitive set 0% ] Convert volume to pset 0% 15% [ Compute primitive set 100% ] Convert volume to pset 100% 15% [ Approximate Convex Decomposition 0% ] Subdivision level 1 0% 15% [ Approximate Convex Decomposition 0% ] Subdivision level 1 0% 15% [ Approximate Convex Decomposition 95% ] Subdivision level 1 100% 90% [ Approximate Convex Decomposition 95% ] Subdivision level 1 100% 90% [ Approximate Convex Decomposition 95% ] Generate convex-hulls 0% 90% [ Approximate Convex Decomposition 95% ] Generate convex-hulls 0% 95% [ Approximate Convex Decomposition 100% ] Generate convex-hulls 100% 99% [ Merge Convex Hulls 100% ] Generate convex-hulls 100% 99% [ Simplify convex-hulls 0% ] Simplify convex-hulls 0% 100% [ Simplify convex-hulls 100% ] Simplify convex-hulls 100% ```013_apple/013_apple.urdf
```013_apple/google_16k/textured_vhacd.obj
``` o convex_0 v -0.011816 -0.038989 0.029097 v 0.009096 0.033904 0.039228 v 0.009096 0.033904 0.037955 v 0.038260 -0.014901 0.037325 v -0.020060 -0.022514 0.068391 v -0.018794 0.007910 0.000563 v 0.025584 -0.007922 0.001193 v -0.036541 0.008545 0.046834 v 0.016707 0.016786 0.069658 v 0.021146 -0.028850 0.065215 v 0.011003 -0.033288 0.008176 v 0.028749 0.018684 0.017678 v -0.027031 -0.019974 0.013249 v -0.020060 0.019962 0.064585 v -0.013722 0.028195 0.018951 v 0.034461 0.010450 0.056979 v -0.025764 -0.030756 0.054439 v 0.011003 0.018691 0.002474 v 0.010370 -0.039624 0.051270 v -0.009284 -0.024412 0.001200 v 0.027483 -0.030756 0.026564 v 0.026217 -0.011726 0.070294 v -0.035275 -0.007930 0.057609 v -0.011816 0.030728 0.051907 v -0.031469 0.014253 0.024024 v 0.021146 0.027560 0.054439 v -0.004845 -0.037092 0.061415 v 0.036994 0.003472 0.024024 v -0.034642 -0.013631 0.030363 v -0.026398 0.023757 0.046197 v -0.026398 0.006647 0.067125 v 0.031289 -0.017434 0.011339 v 0.002125 0.028830 0.062052 v 0.034461 -0.018076 0.056343 v -0.027671 -0.006025 0.006903 v 0.014801 -0.019967 -0.000696 v 0.005291 -0.041522 0.032266 v 0.017340 0.028838 0.022128 v 0.031922 0.019954 0.034799 v 0.013535 0.009180 0.071568 v 0.011003 -0.025682 0.070287 v -0.007377 -0.034551 0.010709 v -0.025764 -0.030120 0.030363 v 0.028116 -0.030756 0.045560 v -0.015621 0.020589 0.006903 v 0.030023 0.004742 0.007539 v 0.003392 0.030093 0.017685 v 0.011636 0.012348 -0.000066 v 0.038900 0.000304 0.043664 v -0.009917 -0.039632 0.049367 v 0.032555 0.000304 0.065222 v -0.032110 0.011078 0.060149 v -0.018794 -0.014901 0.000563 v -0.036541 0.001567 0.032266 v -0.003579 0.019954 0.069021 v -0.006111 0.033276 0.034799 v 0.017340 -0.037727 0.029090 v -0.033376 -0.020609 0.047471 v -0.020060 -0.028215 0.011975 v 0.023045 -0.027580 0.009443 v -0.029570 -0.016171 0.064585 v -0.013722 0.007910 -0.000703 v 0.028116 0.019954 0.059512 v 0.024311 0.027560 0.038599 f 63 39 64 f 5 17 27 f 19 10 27 f 14 24 30 f 15 25 30 f 25 8 30 f 4 21 32 f 28 4 32 f 2 24 33 f 24 14 33 f 26 2 33 f 9 26 33 f 22 10 34 f 25 6 35 f 13 29 35 f 11 20 36 f 12 18 38 f 28 12 39 f 22 9 40 f 31 5 40 f 10 22 41 f 5 27 41 f 27 10 41 f 40 5 41 f 22 40 41 f 20 11 42 f 37 1 42 f 11 37 42 f 1 17 43 f 29 13 43 f 10 19 44 f 21 4 44 f 4 34 44 f 34 10 44 f 25 15 45 f 6 25 45 f 18 12 46 f 12 28 46 f 32 7 46 f 28 32 46 f 3 38 47 f 38 18 47 f 18 45 47 f 45 15 47 f 7 36 48 f 46 7 48 f 18 46 48 f 4 28 49 f 34 4 49 f 39 16 49 f 28 39 49 f 17 1 50 f 27 17 50 f 19 27 50 f 1 37 50 f 37 19 50 f 9 22 51 f 22 34 51 f 34 49 51 f 49 16 51 f 8 23 52 f 30 8 52 f 14 30 52 f 31 14 52 f 23 31 52 f 35 6 53 f 13 35 53 f 36 20 53 f 23 8 54 f 8 25 54 f 29 23 54 f 25 35 54 f 35 29 54 f 14 31 55 f 9 33 55 f 33 14 55 f 40 9 55 f 31 40 55 f 2 3 56 f 24 2 56 f 30 24 56 f 15 30 56 f 3 47 56 f 47 15 56 f 37 11 57 f 19 37 57 f 44 19 57 f 21 44 57 f 23 29 58 f 43 17 58 f 29 43 58 f 42 1 59 f 20 42 59 f 1 43 59 f 43 13 59 f 13 53 59 f 53 20 59 f 7 32 60 f 32 21 60 f 36 7 60 f 11 36 60 f 57 11 60 f 21 57 60 f 17 5 61 f 5 31 61 f 31 23 61 f 58 17 61 f 23 58 61 f 6 45 62 f 45 18 62 f 18 48 62 f 48 36 62 f 53 6 62 f 36 53 62 f 26 9 63 f 16 39 63 f 9 51 63 f 51 16 63 f 3 2 64 f 2 26 64 f 38 3 64 f 12 38 64 f 39 12 64 f 26 63 64 ```Next I run:
This is what I see:![image](https://user-images.githubusercontent.com/10344742/152083345-3f7a95ba-77ec-4601-8f26-9e4110e0ecf9.png)
Please let me know if I can provide any more information, and thank you for making this tool. Hopefully I can use it to upload some of the objects from the YCB dataset into pybullet.