Skip to content

Add NewtonJointAPI #9

@andrewkaufman

Description

@andrewkaufman

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

Feature Description

NewtonJointAPI is an extension to UsdPhysicsJoint to configure per-DOF joint attributes.

It is a single-apply API, with arrays specifying which DOFs are affected, and a series of equally sized arrays specifying per-DOF properties (see additional context for justification). These arrays should be indexed according to the primary dofs token array.

For single-DOF joints (Prismatic & Revolute) a special DOF token distance or angle should be specified. All other DOF tokens should match UsdPhysicsLimitAPI instance-name tokens.

The following array attributes will be provided in the initial implementation:

newton:dofs

A token array specifying the affected DOFs for this joint

An empty array can be seen as disabling the NewtonJointAPI without explicitly removing it.

newton:armature

An additional source of intertia affecting each DOF which is not due to body mass. This is often used to represent a rotor (a.k.a armature) but can also be used as a way of stabalizing simulation for some solvers.

The default value for unspecified armature is 0.

Units:

  • Linear joint: mass
  • Angular joint: mass * distance^2

Note: A future Actuator Prim may also provide armature, in which case this value could be omitted for actuated joints. If both are authored, the two values should be summed.

newton:staticFrictionEffort

The maximum static friction force or torque applied to resist motion in stationary joints. Prevents motion initiation until the applied force exceeds this threshold.

The default value for unspecified staticFrictionEffort is 0.

Units:

  • Linear joint: force (mass * distance / second^2)
  • Angular joint: torque (mass * distance^2 / second^2)

newton:dynamicFrictionEffort

Coulomb friction force or torque applied to resist motion in moving joints. Should be less than or equal to staticFrictionEffort.

The default value for unspecified dynamicFrictionEffort is 0.

Units:

  • Linear joint: force (mass * distance / second^2)
  • Angular joint: torque (mass * distance^2 / second^2)

newton:viscousDamping

Coefficient used to calculate velocity-dependent friction effort. Total friction effort in moving joints is:
- sign(jointVelocity) * (dynamicFrictionEffort + viscousDamping * abs(jointVelocity))

The default value for unspecified viscousDamping is 0.

Units:

  • Linear joint: force * second / distance
  • Angular joint: torque * second / degrees

Example

A 3 DOF "planar" joint might look like:

def Joint "Foo" (
    prepend apiSchemas = ["NewtonJointAPI"]
)
{
    uniform token[] newton:dofs = [ "transX", "transY", "rotZ" ]
    uniform float[] newton:armature = [ 0.1, 0.2, 0.3 ]
    uniform float[] newton:dynamicFrictionEffort = [10.0, 10.0, 10.0]
    // remaining attrs unspecified & use defined fallback values for all DOFs
}

Additional context or alternatives

Despite being per-DOF, NewtonJointAPI is not a multi-apply API (unlike UsdPhysicsLimitAPI). The rationalle from the design meeting is that multi-apply APIs are overly clunky in client code & drastically reduce legibility of authored content (both text USDA and in GUIs).

The only benefit we saw for multi-apply was to obtian sparse single-valued attributes, which are easier to override & timesample.

However, as Joint DOF arrays are very small (0-6 values), it should not be necessary to author them sparsly for perf reasons. The particular values on NewtonJointAPI are also uniform/static configuration of default state; there is no user need to timesample these values. Additionally, in newer USD runtimes, sparse editing of array attributes is possible, so there is no significant loss of functionailty (in the mid/long term) and dense overrides of small arrays are easy enough to manage (in the short term).

Code of Conduct

  • I agree to follow newton-usd-schemas Code of Conduct
  • I have searched the open issues and have found no duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions