Package: object2urdf
object2urdfManage a library of objects for use in pybullet physicsInstallationInstall the release versionThis package is available on pypi, so anyone can install it with pip:pip install object2urdfInstall the most-recent development versionClone the package from thegithub repoNavigate into the main folderpip install .UsageSet up YCB objectsDownload the16k laser scanfrom theYCB Benchmarks website.Unzip the folder. You'll now be able to find several files, some of which we useFiles namedtexturedinclude both object geometry and texture maps.Files namednontexturedinclude only object geometry.Notes:All of these object files are in units of meters.Set up custom objectsMake your object in CAD or a 3D modeling software, and export it as either an.OBJor.STLfile..OBJfiles can be rendered with a texture (using an.MTLfile) and collisions with convex objects can be handled correctly (this utillity to handles that)..STLfiles can only be rendered without textures, and the collision boundary will only be the convex hull of the object.(This is due to the limitations of the Bullet physics engine)Set up your file structureEach object set needs its own directory.Inside your directory for the object set, create a subdirectory for each new object.The subdirectory name will be used as the object name.Place all of the relevant geometry and texture files into that subdirectory.Filenames must all match, with correct file extensionsSupported geometry must be either an.OBJor.STLfile.Textures can be added to.OBJfiles using an accompanying.MTLfile.Linking to this is handled within the.OBJfile..MTLfiles usually refer to an image texture (jpgorpng) that gets mapped onto the object.Auto-generate URDFsSet up your file structure per the instructions for custom objects above.Each object set directory must have its own_prototype.urdftemplate file. This is where default units, colors, and masses are adjusted.If objects are buried in sub-subdirectories within each object's directory, this utility will still find them. However,only one URDF is generated from each object directory.Geometry must be generated from a.OBJor.STLfile, with.OBJtaking priority if multiple are found in the same folder(optional)Add object-specific overrides to a.OVRfile in the same folder.Filenames must all matchThis can be things like the object's mass, orientations, etc.This file should be an XML similar to the file in thefancy_cube>>holderexample.Use the package to automatically generate URDFs for your object library.Start with the "build_object_library.py" example.This example will place all URDFs into their respective object set directories, but you can change the output location by passing theoutput_folderargument tobuild_urdforbuild_libraryDue to limitations of Bullet's rigid body collision detection, concave objects must be split into several convex objects using a convex decomposition. You can do this with theObjectUrdfBuilderclass by passingdecompose_concave=Trueto thebuild_urdforbuild_libraryfunctions. The URDF builder will then generate a decomposed file, place it next to the original object file, and link to it as the collision geometry in the object's URDF.Set the center of mass of the object via a variety of options:By default, this package usestrimeshto calculate the center of mass of objects from thier geometry.To turn this behavior off and use the URDF or ORV files, passcenter = Noneto thebuild_urdforbuild_libraryfunctionsYou can also use the geometric center (centroid) of the model withcenter = 'geometric'You can also use faces of the bounding box: setcenterequal to one of the following:'top', 'bottom', 'xy_pos', 'xy_neg', 'xz_pos', 'xz_neg', 'yz_pos', 'yz_neg'Use objects in simulationJust import the object's URDF:object_urdf="fancy_cube/small_holder.urdf"boxStartPos=[0,0,0.5]boxStartOr=p.getQuaternionFromEuler(np.deg2rad([0,0,0]))boxId=p.loadURDF(object_urdf,boxStartPos,boxStartOr)