Skip to main content

object2urdf

Manage a library of objects for use in pybullet physics

Installation

Install the release version

This package is available on pypi, so anyone can install it with pip: pip install object2urdf

Install the most-recent development version

  1. Clone the package from the github repo
  2. Navigate into the main folder
  3. pip install .

Usage

Set up YCB objects

  1. Download the 16k laser scan from the YCB Benchmarks website.
  2. Unzip the folder. You'll now be able to find several files, some of which we use
    • Files named textured include both object geometry and texture maps.
    • Files named nontextured include only object geometry.
  3. Notes:
    • All of these object files are in units of meters.

Set up custom objects

  1. Make your object in CAD or a 3D modeling software, and export it as either an .OBJ or .STL file.
    • .OBJ files can be rendered with a texture (using an .MTL file) and collisions with convex objects can be handled correctly (this utillity to handles that).
    • .STL files 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)
  2. Set up your file structure
    • Each 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.
  3. Place all of the relevant geometry and texture files into that subdirectory. Filenames must all match, with correct file extensions
    • Supported geometry must be either an .OBJ or .STL file.
    • Textures can be added to .OBJ files using an accompanying .MTL file. Linking to this is handled within the .OBJ file.
    • .MTL files usually refer to an image texture (jpg or png) that gets mapped onto the object.

Auto-generate URDFs

  1. Set up your file structure per the instructions for custom objects above.
    • Each object set directory must have its own _prototype.urdf template 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 .OBJ or .STL file, with .OBJ taking priority if multiple are found in the same folder
    • (optional) Add object-specific overrides to a .OVR file in the same folder. Filenames must all match
      • This can be things like the object's mass, orientations, etc.
      • This file should be an XML similar to the file in the fancy_cube >> holder example.
  2. 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 the output_folder argument to build_urdf or build_library
    • Due 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 the ObjectUrdfBuilder class by passing decompose_concave=True to the build_urdf or build_library functions. 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 uses trimesh to calculate the center of mass of objects from thier geometry.
      • To turn this behavior off and use the URDF or ORV files, pass center = None to the build_urdf or build_library functions
      • You can also use the geometric center (centroid) of the model with center = 'geometric'
      • You can also use faces of the bounding box: set center equal to one of the following: 'top', 'bottom', 'xy_pos', 'xy_neg', 'xz_pos', 'xz_neg', 'yz_pos', 'yz_neg'

Use objects in simulation

Just 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)

Metadata

Release files for object2urdf 0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for object2urdf 0.12
File Size Uploaded Provenance
object2urdf-0.12.tar.gz 7.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for object2urdf 0.12
File Interpreter ABI Platform
object2urdf-0.12-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / object2urdf-0.12.tar.gz

Download URL object2urdf-0.12.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0794d51277fcdfdc3500636f8cc943c66c700a7343479bad97dbca68b8d485f3
BLAKE2b-256 checksum
How to use checksums
60d293c4d194627e0aec165201c8d42a907c2435ca6d719b92dcdfc7f9f88bcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

Release files / object2urdf-0.12-py3-none-any.whl

Download URL object2urdf-0.12-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aac07be1dfc3bfd195f33642b1f55291eae52b30f97b6c4fc556fb407b381736
BLAKE2b-256 checksum
How to use checksums
745b7fe61a59929cba7538eb9cf9e64c5bc58334507173939fdb7b4f11324fc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

Security for object2urdf 0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page