OpenUSD schema definitions for the Newton physics engine
Actively maintained. Last release 6 days ago, commits in 15 of the last 26 weeks. A safe choice.
pip install newton-usd-schemasnewton-usd-schemas
Overview
Newton USD schemas provide extensions to OpenUSD's UsdPhysics specification, allowing USD layers to configure the Newton runtime data model.
These schemas can be deployed into any python runtime with USD support, allowing content creators to author Newton compatible robots, props, and environments in any application of their choice, without requiring the Newton runtime itself.
This project is part of Newton, a Linux Foundation project which is community-built and maintained.
Get Started
These schemas are codeless, in that they contain no compiled code nor any public API of their own. Since codeless schemas do not provide any code, clients do not need to recompile USD to use or update these schemas. They are deployed as a python module via a wheel package for convenience, as all Newton projects use pyproject based dependencies and most USD authoring workflows include a python runtime.
To start using the schemas, install the python wheel into a virtual environment using your favorite package manager:
python -m venv .venv
source .venv/bin/activate
pip install 'newton-usd-schemas[usd]' # or [usdex], or install any other USD runtime separately
At runtime, simply import the module to register the schemas with OpenUSD.
Important: Schemas must be registered before the
Usd.SchemaRegistryis initialized. Make sure to import the module very early in the process.
import newton_usd_schemas # this registers the schema
from pxr import Usd, UsdPhysics
stage: Usd.Stage = Usd.Stage.CreateInMemory()
# create a UsdPhysics.Scene and set gravity
scene: UsdPhysics.Scene = UsdPhysics.Scene.Define(stage, "/scene")
scene.GetGravityMagnitudeAttr().Set(9.81)
# apply a Newton schema and set some of its attributes
prim: Usd.Prim = scene.GetPrim()
prim.ApplyAPI("NewtonSceneAPI")
prim.GetAttribute("newton:timeStepsPerSecond").Set(500) # 2ms
stage.Export("/tmp/my_robot.usda") # or .usdc or .usd
Once a USD layer is authored to storage, it can be loaded into a Newton runtime using Newton's USD Parsing mechanism.