diff --git a/src/experimental/usd/mjcPhysics/api.h b/src/experimental/usd/mjcPhysics/api.h new file mode 100644 index 00000000..dc5476c9 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/api.h @@ -0,0 +1,42 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef MJCPHYSICS_API_H +#define MJCPHYSICS_API_H + +#include "pxr/base/arch/export.h" + +#if defined(PXR_STATIC) +#define MJCPHYSICS_API +#define MJCPHYSICS_API_TEMPLATE_CLASS(...) +#define MJCPHYSICS_API_TEMPLATE_STRUCT(...) +#define MJCPHYSICS_LOCAL +#else +#if defined(MJCPHYSICS_EXPORTS) +#define MJCPHYSICS_API ARCH_EXPORT +#define MJCPHYSICS_API_TEMPLATE_CLASS(...) \ + ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) +#define MJCPHYSICS_API_TEMPLATE_STRUCT(...) \ + ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) +#else +#define MJCPHYSICS_API ARCH_IMPORT +#define MJCPHYSICS_API_TEMPLATE_CLASS(...) \ + ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) +#define MJCPHYSICS_API_TEMPLATE_STRUCT(...) \ + ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) +#endif +#define MJCPHYSICS_LOCAL ARCH_HIDDEN +#endif + +#endif diff --git a/src/experimental/usd/mjcPhysics/generatedSchema.usda b/src/experimental/usd/mjcPhysics/generatedSchema.usda new file mode 100644 index 00000000..62050c6c --- /dev/null +++ b/src/experimental/usd/mjcPhysics/generatedSchema.usda @@ -0,0 +1,228 @@ +#usda 1.0 +( + "WARNING: THIS FILE IS GENERATED BY usdGenSchema. DO NOT EDIT." +) + +class "MjcPhysicsSceneAPI" ( + doc = "API providing global simulation options for Mujoco." +) +{ + uniform int[] mjc:physics:actuatorgroupdisable ( + displayName = "Actuator Group Disable" + doc = "List of actuator groups to disable." + ) + uniform double mjc:physics:apirate = 100 ( + displayName = "ApiRate" + doc = """Determines the rate (in Hz) at which an external API allows + the update function to be executed.""" + ) + uniform int mjc:physics:ccd_iterations = 50 ( + displayName = "CCD Iterations" + doc = "Maximum number of iterations of the algorithm used for convex collisions." + ) + uniform double mjc:physics:ccd_tolerance = 0.000001 ( + displayName = "CCD Tolerance" + doc = """Tolerance threshold used for early termination of the convex + collision algorithm.""" + ) + uniform token mjc:physics:cone = "pyramidal" ( + allowedTokens = ["pyramidal", "elliptic"] + displayName = "Friction Cone Type" + doc = "The type of contact friction cone." + ) + uniform double mjc:physics:density = 0 ( + displayName = "Density" + doc = "Density of medium." + ) + uniform bool mjc:physics:flag:actuation = 1 ( + displayName = "Actuation Forces Toggle" + doc = "Enables all standard computations related to actuator forces, including actuator dynamics." + ) + uniform bool mjc:physics:flag:autoreset = 1 ( + displayName = "Automatic Simulation Reset Toggle" + doc = "Enables the automatic resetting of the simulation state when numerical issues are detected." + ) + uniform bool mjc:physics:flag:clampctrl = 1 ( + displayName = "Control Input Clamping Toggle" + doc = "Enables the clamping of control inputs to all actuators, according to actuator-specific attributes." + ) + uniform bool mjc:physics:flag:constraint = 1 ( + displayName = "Constraint Solver Toggle" + doc = "Enables constraint solver." + ) + uniform bool mjc:physics:flag:contact = 1 ( + displayName = "Contact Constraints and Collision Detection Toggle" + doc = "Enables collision detection and all standard computations related to contact constraints." + ) + uniform bool mjc:physics:flag:energy = 0 ( + displayName = "Energy Computation Toggle" + doc = "Enables the computation of potential and kinetic energy (mjData.energy[0,1])." + ) + uniform bool mjc:physics:flag:equality = 1 ( + displayName = "Equality Constraints Toggle" + doc = "Enables all standard computations related to equality constraints." + ) + uniform bool mjc:physics:flag:eulerdamp = 1 ( + displayName = "Euler Integrator Damping Toggle" + doc = "Enables implicit integration with respect to joint damping in the Euler integrator." + ) + uniform bool mjc:physics:flag:filterparent = 1 ( + displayName = "Parent-Child Contact Filtering Toggle" + doc = "Enables the filtering of contact pairs where the two geoms belong to a parent and child body." + ) + uniform bool mjc:physics:flag:frictionloss = 1 ( + displayName = "Friction Loss Constraints Toggle" + doc = "Enables all standard computations related to friction loss constraints." + ) + uniform bool mjc:physics:flag:fwdinv = 0 ( + displayName = "Forward/Inverse Dynamics Comparison Toggle" + doc = "Enables the automatic comparison of forward and inverse dynamics." + ) + uniform bool mjc:physics:flag:gravity = 1 ( + displayName = "Gravity Toggle" + doc = "Enables the application of gravitational acceleration as defined in mjOption." + ) + uniform bool mjc:physics:flag:invdiscrete = 0 ( + displayName = "Discrete-Time Inverse Dynamics Toggle" + doc = "Enables discrete-time inverse dynamics with mj_inverse for integrators other than RK4." + ) + uniform bool mjc:physics:flag:island = 0 ( + displayName = "Constraint Island Discovery Toggle" + doc = "Enables the discovery of constraint islands." + ) + uniform bool mjc:physics:flag:limit = 1 ( + displayName = "Joint and Tendon Limit Constraints Toggle" + doc = "Enables all standard computations related to joint and tendon limit constraints." + ) + uniform bool mjc:physics:flag:midphase = 1 ( + displayName = "Mid-Phase Collision Filtering Toggle" + doc = "Enables mid-phase collision filtering using a static AABB bounding volume hierarchy (BVH)." + ) + uniform bool mjc:physics:flag:multiccd = 0 ( + displayName = "Multiple Contact Collision Detection (CCD) Toggle" + doc = "Enables multiple-contact collision detection for geom pairs using a general-purpose convex-convex collider." + ) + uniform bool mjc:physics:flag:nativeccd = 1 ( + displayName = "Native Convex Collision Detection Toggle" + doc = "Enables the native convex collision detection pipeline instead of using the libccd library." + ) + uniform bool mjc:physics:flag:override = 0 ( + displayName = "Contact Override Mechanism Toggle" + doc = "Enables the contact override mechanism." + ) + uniform bool mjc:physics:flag:passive = 1 ( + displayName = "Passive Forces Toggle" + doc = "Enables the simulation of joint and tendon spring-dampers, fluid dynamics forces, and custom passive forces." + ) + uniform bool mjc:physics:flag:refsafe = 1 ( + displayName = "Solver Reference Safety Mechanism Toggle" + doc = "Enables a safety mechanism that prevents instabilities due to solref[0] being too small compared to the simulation timestep." + ) + uniform bool mjc:physics:flag:sensor = 1 ( + displayName = "Sensor Computations Toggle" + doc = "Enables all computations related to sensors." + ) + uniform bool mjc:physics:flag:warmstart = 1 ( + displayName = "Solver Warm-Starting Toggle" + doc = "Enables warm-starting of the constraint solver, using the solution from the previous time step to initialize the iterative optimization." + ) + uniform double mjc:physics:impratio = 1 ( + displayName = "Impedance Ratio" + doc = """Ratio of frictional-to-normal constraint impedance for elliptic + friction cones.""" + ) + uniform token mjc:physics:integrator = "euler" ( + allowedTokens = ["euler", "rk4", "implicit", "implicitfast"] + displayName = "Integrator" + doc = "Numerical integrator to be used." + ) + uniform int mjc:physics:iterations = 100 ( + displayName = "Solver Iterations" + doc = "Maximum number of iterations of the constraint solver." + ) + uniform token mjc:physics:jacobian = "auto" ( + allowedTokens = ["auto", "dense", "sparse"] + displayName = "Jacobian Type" + doc = "The type of constraint Jacobian and matrices computed from it." + ) + uniform int mjc:physics:ls_iterations = 50 ( + displayName = "Linesearch Iterations" + doc = """Maximum number of linesearch iterations performed by CG/Newton + constraint solvers.""" + ) + uniform double mjc:physics:ls_tolerance = 0.01 ( + displayName = "Linesearch Tolerance" + doc = "Tolerance threshold used for early termination of the linesearch algorithm." + ) + uniform double3 mjc:physics:magnetic = (0, -0.5, 0) ( + displayName = "Magnetic Flux" + doc = "Global magnetic flux." + ) + uniform int mjc:physics:noslip_iterations = 0 ( + displayName = "Noslip Iterations" + doc = "Maximum number of iterations of the Noslip solver." + ) + uniform double mjc:physics:noslip_tolerance = 0.000001 ( + displayName = "Noslip Tolerance" + doc = "Tolerance threshold used for early termination of the Noslip solver." + ) + uniform double[] mjc:physics:o_friction = [1, 1, 0.005, 0.0001, 0.0001] ( + displayName = "Contact Override Friction" + doc = """Replaces the friction parameter of all active contact pairs when + Contact override is enabled.""" + ) + uniform double mjc:physics:o_margin = 0 ( + displayName = "Contact Override Margin" + doc = """Replaces the margin parameter of all active contact pairs when + Contact override is enabled.""" + ) + uniform double[] mjc:physics:o_solimp = [0.9, 0.95, 0.001, 0.5, 2] ( + displayName = "Contact Override SolImp" + doc = """Replaces the solimp parameter of all active contact pairs when + Contact override is enabled.""" + ) + uniform double[] mjc:physics:o_solref = [0.02, 1] ( + displayName = "Contact Override SolRef" + doc = """Replaces the solref parameter of all active contact pairs when + Contact override is enabled.""" + ) + uniform int mjc:physics:sdf_initpoints = 40 ( + displayName = "SDF Initial Points" + doc = """Number of starting points used for finding contacts with Signed + Distance Field collisions.""" + ) + uniform int mjc:physics:sdf_iterations = 10 ( + displayName = "SDF Iterations" + doc = """Number of iterations used for Signed Distance Field collisions + (per initial point).""" + ) + uniform token mjc:physics:solver = "newton" ( + allowedTokens = ["pgs", "cg", "newton"] + displayName = "Solver" + doc = "Constraint solver algorithm to be used." + ) + uniform double mjc:physics:timestep = 0.002 ( + displayName = "Timestep" + doc = "Controls the timestep in seconds used by MuJoCo." + ) + uniform double mjc:physics:tolerance = 1e-8 ( + displayName = "Solver Tolerance" + doc = """Tolerance threshold used for early termination of the iterative + solver.""" + ) + uniform double mjc:physics:viscosity = 0 ( + displayName = "Viscosity" + doc = "Viscosity of medium." + ) + uniform double3 mjc:physics:wind = (0, 0, 0) ( + displayName = "Wind Velocity" + doc = "Velocity vector of medium (i.e. wind)." + ) +} + +class "MjcSiteAPI" ( + doc = "API describing a Mujoco site." +) +{ +} + diff --git a/src/experimental/usd/mjcPhysics/plugInfo.json b/src/experimental/usd/mjcPhysics/plugInfo.json new file mode 100644 index 00000000..fcf19910 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/plugInfo.json @@ -0,0 +1,38 @@ +#Portions of this file auto - generated by usdGenSchema. +#Edits will survive regeneration except for comments and +#changes to types with autoGenerated = true. +{ + "Plugins": [ + { + "Info": { + "Types": { + "MjcPhysicsSceneAPI": { + "alias": { + "UsdSchemaBase": "MjcPhysicsSceneAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + }, + "MjcPhysicsSiteAPI": { + "alias": { + "UsdSchemaBase": "MjcSiteAPI" + }, + "autoGenerated": true, + "bases": [ + "UsdAPISchemaBase" + ], + "schemaKind": "singleApplyAPI" + } + } + }, + "LibraryPath": "", + "Name": "mjcPhysics", + "ResourcePath": "", + "Root": ".", + "Type": "library" + } + ] +} diff --git a/src/experimental/usd/mjcPhysics/sceneAPI.cpp b/src/experimental/usd/mjcPhysics/sceneAPI.cpp new file mode 100644 index 00000000..0c01a533 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/sceneAPI.cpp @@ -0,0 +1,701 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "./sceneAPI.h" + +#include "pxr/usd/sdf/assetPath.h" +#include "pxr/usd/sdf/types.h" +#include "pxr/usd/usd/schemaRegistry.h" +#include "pxr/usd/usd/typed.h" + +PXR_NAMESPACE_OPEN_SCOPE + +// Register the schema with the TfType system. +TF_REGISTRY_FUNCTION(TfType) { + TfType::Define >(); +} + +/* virtual */ +MjcPhysicsSceneAPI::~MjcPhysicsSceneAPI() {} + +/* static */ +MjcPhysicsSceneAPI MjcPhysicsSceneAPI::Get(const UsdStagePtr &stage, + const SdfPath &path) { + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return MjcPhysicsSceneAPI(); + } + return MjcPhysicsSceneAPI(stage->GetPrimAtPath(path)); +} + +/* virtual */ +UsdSchemaKind MjcPhysicsSceneAPI::_GetSchemaKind() const { + return MjcPhysicsSceneAPI::schemaKind; +} + +/* static */ +bool MjcPhysicsSceneAPI::CanApply(const UsdPrim &prim, std::string *whyNot) { + return prim.CanApplyAPI(whyNot); +} + +/* static */ +MjcPhysicsSceneAPI MjcPhysicsSceneAPI::Apply(const UsdPrim &prim) { + if (prim.ApplyAPI()) { + return MjcPhysicsSceneAPI(prim); + } + return MjcPhysicsSceneAPI(); +} + +/* static */ +const TfType &MjcPhysicsSceneAPI::_GetStaticTfType() { + static TfType tfType = TfType::Find(); + return tfType; +} + +/* static */ +bool MjcPhysicsSceneAPI::_IsTypedSchema() { + static bool isTyped = _GetStaticTfType().IsA(); + return isTyped; +} + +/* virtual */ +const TfType &MjcPhysicsSceneAPI::_GetTfType() const { + return _GetStaticTfType(); +} + +UsdAttribute MjcPhysicsSceneAPI::GetTimestepAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsTimestep); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateTimestepAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsTimestep, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetApiRateAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsApirate); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateApiRateAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsApirate, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetImpRatioAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsImpratio); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateImpRatioAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsImpratio, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetWindAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsWind); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateWindAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsWind, SdfValueTypeNames->Double3, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetMagneticAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsMagnetic); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateMagneticAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsMagnetic, SdfValueTypeNames->Double3, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetDensityAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsDensity); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateDensityAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsDensity, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetViscosityAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsViscosity); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateViscosityAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsViscosity, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetOMarginAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsO_margin); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateOMarginAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsO_margin, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetOSolRefAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsO_solref); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateOSolRefAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsO_solref, SdfValueTypeNames->DoubleArray, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetOSolImpAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsO_solimp); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateOSolImpAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsO_solimp, SdfValueTypeNames->DoubleArray, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetOFrictionAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsO_friction); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateOFrictionAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsO_friction, SdfValueTypeNames->DoubleArray, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetIntegratorAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsIntegrator); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateIntegratorAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsIntegrator, SdfValueTypeNames->Token, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetConeAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsCone); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateConeAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsCone, SdfValueTypeNames->Token, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetJacobianAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsJacobian); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateJacobianAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsJacobian, SdfValueTypeNames->Token, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetSolverAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsSolver); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateSolverAttr(VtValue const &defaultValue, + bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsSolver, SdfValueTypeNames->Token, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetIterationsAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsIterations); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateIterationsAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsIterations, SdfValueTypeNames->Int, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetToleranceAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsTolerance); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateToleranceAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsTolerance, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetLSIterationsAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsLs_iterations); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateLSIterationsAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsLs_iterations, SdfValueTypeNames->Int, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetLSToleranceAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsLs_tolerance); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateLSToleranceAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsLs_tolerance, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetNoslipIterationsAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsNoslip_iterations); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateNoslipIterationsAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsNoslip_iterations, SdfValueTypeNames->Int, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetNoslipToleranceAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsNoslip_tolerance); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateNoslipToleranceAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsNoslip_tolerance, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetCCDIterationsAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsCcd_iterations); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateCCDIterationsAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsCcd_iterations, SdfValueTypeNames->Int, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetCCDToleranceAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsCcd_tolerance); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateCCDToleranceAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsCcd_tolerance, SdfValueTypeNames->Double, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetSDFIterationsAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsSdf_iterations); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateSDFIterationsAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsSdf_iterations, SdfValueTypeNames->Int, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetSDFInitPointsAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsSdf_initpoints); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateSDFInitPointsAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsSdf_initpoints, SdfValueTypeNames->Int, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetActuatorGroupDisableAttr() const { + return GetPrim().GetAttribute( + MjcPhysicsTokens->mjcPhysicsActuatorgroupdisable); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateActuatorGroupDisableAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsActuatorgroupdisable, + SdfValueTypeNames->IntArray, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetConstraintFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagConstraint); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateConstraintFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagConstraint, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetEqualityFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagEquality); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateEqualityFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagEquality, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetFrictionLossFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagFrictionloss); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateFrictionLossFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagFrictionloss, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetLimitFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagLimit); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateLimitFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagLimit, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetContactFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagContact); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateContactFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagContact, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetPassiveFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagPassive); +} + +UsdAttribute MjcPhysicsSceneAPI::CreatePassiveFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagPassive, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetGravityFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagGravity); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateGravityFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagGravity, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetClampCtrlFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagClampctrl); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateClampCtrlFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagClampctrl, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetWarmStartFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagWarmstart); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateWarmStartFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagWarmstart, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetFilterParentFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagFilterparent); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateFilterParentFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagFilterparent, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetActuationFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagActuation); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateActuationFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagActuation, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetRefSafeFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagRefsafe); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateRefSafeFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagRefsafe, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetSensorFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagSensor); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateSensorFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagSensor, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetMidPhaseFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagMidphase); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateMidPhaseFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagMidphase, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetNativeCCDFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagNativeccd); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateNativeCCDFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagNativeccd, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetEulerDampFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagEulerdamp); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateEulerDampFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagEulerdamp, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetAutoResetFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagAutoreset); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateAutoResetFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagAutoreset, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetOverrideFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagOverride); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateOverrideFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagOverride, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetEnergyFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagEnergy); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateEnergyFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagEnergy, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetFwdinvFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagFwdinv); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateFwdinvFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagFwdinv, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetInvDiscreteFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagInvdiscrete); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateInvDiscreteFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagInvdiscrete, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetMultiCCDFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagMulticcd); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateMultiCCDFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagMulticcd, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +UsdAttribute MjcPhysicsSceneAPI::GetIslandFlagAttr() const { + return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPhysicsFlagIsland); +} + +UsdAttribute MjcPhysicsSceneAPI::CreateIslandFlagAttr( + VtValue const &defaultValue, bool writeSparsely) const { + return UsdSchemaBase::_CreateAttr( + MjcPhysicsTokens->mjcPhysicsFlagIsland, SdfValueTypeNames->Bool, + /* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely); +} + +namespace { +static inline TfTokenVector _ConcatenateAttributeNames( + const TfTokenVector &left, const TfTokenVector &right) { + TfTokenVector result; + result.reserve(left.size() + right.size()); + result.insert(result.end(), left.begin(), left.end()); + result.insert(result.end(), right.begin(), right.end()); + return result; +} +} // namespace + +/*static*/ +const TfTokenVector &MjcPhysicsSceneAPI::GetSchemaAttributeNames( + bool includeInherited) { + static TfTokenVector localNames = { + MjcPhysicsTokens->mjcPhysicsTimestep, + MjcPhysicsTokens->mjcPhysicsApirate, + MjcPhysicsTokens->mjcPhysicsImpratio, + MjcPhysicsTokens->mjcPhysicsWind, + MjcPhysicsTokens->mjcPhysicsMagnetic, + MjcPhysicsTokens->mjcPhysicsDensity, + MjcPhysicsTokens->mjcPhysicsViscosity, + MjcPhysicsTokens->mjcPhysicsO_margin, + MjcPhysicsTokens->mjcPhysicsO_solref, + MjcPhysicsTokens->mjcPhysicsO_solimp, + MjcPhysicsTokens->mjcPhysicsO_friction, + MjcPhysicsTokens->mjcPhysicsIntegrator, + MjcPhysicsTokens->mjcPhysicsCone, + MjcPhysicsTokens->mjcPhysicsJacobian, + MjcPhysicsTokens->mjcPhysicsSolver, + MjcPhysicsTokens->mjcPhysicsIterations, + MjcPhysicsTokens->mjcPhysicsTolerance, + MjcPhysicsTokens->mjcPhysicsLs_iterations, + MjcPhysicsTokens->mjcPhysicsLs_tolerance, + MjcPhysicsTokens->mjcPhysicsNoslip_iterations, + MjcPhysicsTokens->mjcPhysicsNoslip_tolerance, + MjcPhysicsTokens->mjcPhysicsCcd_iterations, + MjcPhysicsTokens->mjcPhysicsCcd_tolerance, + MjcPhysicsTokens->mjcPhysicsSdf_iterations, + MjcPhysicsTokens->mjcPhysicsSdf_initpoints, + MjcPhysicsTokens->mjcPhysicsActuatorgroupdisable, + MjcPhysicsTokens->mjcPhysicsFlagConstraint, + MjcPhysicsTokens->mjcPhysicsFlagEquality, + MjcPhysicsTokens->mjcPhysicsFlagFrictionloss, + MjcPhysicsTokens->mjcPhysicsFlagLimit, + MjcPhysicsTokens->mjcPhysicsFlagContact, + MjcPhysicsTokens->mjcPhysicsFlagPassive, + MjcPhysicsTokens->mjcPhysicsFlagGravity, + MjcPhysicsTokens->mjcPhysicsFlagClampctrl, + MjcPhysicsTokens->mjcPhysicsFlagWarmstart, + MjcPhysicsTokens->mjcPhysicsFlagFilterparent, + MjcPhysicsTokens->mjcPhysicsFlagActuation, + MjcPhysicsTokens->mjcPhysicsFlagRefsafe, + MjcPhysicsTokens->mjcPhysicsFlagSensor, + MjcPhysicsTokens->mjcPhysicsFlagMidphase, + MjcPhysicsTokens->mjcPhysicsFlagNativeccd, + MjcPhysicsTokens->mjcPhysicsFlagEulerdamp, + MjcPhysicsTokens->mjcPhysicsFlagAutoreset, + MjcPhysicsTokens->mjcPhysicsFlagOverride, + MjcPhysicsTokens->mjcPhysicsFlagEnergy, + MjcPhysicsTokens->mjcPhysicsFlagFwdinv, + MjcPhysicsTokens->mjcPhysicsFlagInvdiscrete, + MjcPhysicsTokens->mjcPhysicsFlagMulticcd, + MjcPhysicsTokens->mjcPhysicsFlagIsland, + }; + static TfTokenVector allNames = _ConcatenateAttributeNames( + UsdAPISchemaBase::GetSchemaAttributeNames(true), localNames); + + if (includeInherited) + return allNames; + else + return localNames; +} + +PXR_NAMESPACE_CLOSE_SCOPE + +// ===================================================================== // +// Feel free to add custom code below this line. It will be preserved by +// the code generator. +// +// Just remember to wrap code in the appropriate delimiters: +// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'. +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- diff --git a/src/experimental/usd/mjcPhysics/sceneAPI.h b/src/experimental/usd/mjcPhysics/sceneAPI.h new file mode 100644 index 00000000..0fd0d56e --- /dev/null +++ b/src/experimental/usd/mjcPhysics/sceneAPI.h @@ -0,0 +1,1379 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef MJCPHYSICS_GENERATED_SCENEAPI_H +#define MJCPHYSICS_GENERATED_SCENEAPI_H + +/// \file mjcPhysics/sceneAPI.h + +#include "./api.h" +#include "./tokens.h" +#include "pxr/base/gf/matrix4d.h" +#include "pxr/base/gf/vec3d.h" +#include "pxr/base/gf/vec3f.h" +#include "pxr/base/tf/token.h" +#include "pxr/base/tf/type.h" +#include "pxr/base/vt/value.h" +#include "pxr/pxr.h" +#include "pxr/usd/usd/apiSchemaBase.h" +#include "pxr/usd/usd/prim.h" +#include "pxr/usd/usd/stage.h" + +PXR_NAMESPACE_OPEN_SCOPE + +class SdfAssetPath; + +// -------------------------------------------------------------------------- // +// MJCPHYSICSSCENEAPI // +// -------------------------------------------------------------------------- // + +/// \class MjcPhysicsSceneAPI +/// +/// API providing global simulation options for Mujoco. +/// +/// For any described attribute \em Fallback \em Value or \em Allowed \em Values +/// below that are text/tokens, the actual token is published and defined in +/// \ref MjcPhysicsTokens. So to set an attribute to the value "rightHanded", +/// use MjcPhysicsTokens->rightHanded as the value. +/// +class MjcPhysicsSceneAPI : public UsdAPISchemaBase { + public: + /// Compile time constant representing what kind of schema this class is. + /// + /// \sa UsdSchemaKind + static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI; + + /// Construct a MjcPhysicsSceneAPI on UsdPrim \p prim . + /// Equivalent to MjcPhysicsSceneAPI::Get(prim.GetStage(), prim.GetPath()) + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit MjcPhysicsSceneAPI(const UsdPrim &prim = UsdPrim()) + : UsdAPISchemaBase(prim) {} + + /// Construct a MjcPhysicsSceneAPI on the prim held by \p schemaObj . + /// Should be preferred over MjcPhysicsSceneAPI(schemaObj.GetPrim()), + /// as it preserves SchemaBase state. + explicit MjcPhysicsSceneAPI(const UsdSchemaBase &schemaObj) + : UsdAPISchemaBase(schemaObj) {} + + /// Destructor. + MJCPHYSICS_API + virtual ~MjcPhysicsSceneAPI(); + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes. Does not include attributes that + /// may be authored by custom/extended methods of the schemas involved. + MJCPHYSICS_API + static const TfTokenVector &GetSchemaAttributeNames( + bool includeInherited = true); + + /// Return a MjcPhysicsSceneAPI holding the prim adhering to this + /// schema at \p path on \p stage. If no prim exists at \p path on + /// \p stage, or if the prim at that path does not adhere to this schema, + /// return an invalid schema object. This is shorthand for the following: + /// + /// \code + /// MjcPhysicsSceneAPI(stage->GetPrimAtPath(path)); + /// \endcode + /// + MJCPHYSICS_API + static MjcPhysicsSceneAPI Get(const UsdStagePtr &stage, const SdfPath &path); + + /// Returns true if this single-apply API schema can be applied to + /// the given \p prim. If this schema can not be a applied to the prim, + /// this returns false and, if provided, populates \p whyNot with the + /// reason it can not be applied. + /// + /// Note that if CanApply returns false, that does not necessarily imply + /// that calling Apply will fail. Callers are expected to call CanApply + /// before calling Apply if they want to ensure that it is valid to + /// apply a schema. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + MJCPHYSICS_API + static bool CanApply(const UsdPrim &prim, std::string *whyNot = nullptr); + + /// Applies this single-apply API schema to the given \p prim. + /// This information is stored by adding "MjcPhysicsSceneAPI" to the + /// token-valued, listOp metadata \em apiSchemas on the prim. + /// + /// \return A valid MjcPhysicsSceneAPI object is returned upon success. + /// An invalid (or empty) MjcPhysicsSceneAPI object is returned upon + /// failure. See \ref UsdPrim::ApplyAPI() for conditions + /// resulting in failure. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + MJCPHYSICS_API + static MjcPhysicsSceneAPI Apply(const UsdPrim &prim); + + protected: + /// Returns the kind of schema this class belongs to. + /// + /// \sa UsdSchemaKind + MJCPHYSICS_API + UsdSchemaKind _GetSchemaKind() const override; + + private: + // needs to invoke _GetStaticTfType. + friend class UsdSchemaRegistry; + MJCPHYSICS_API + static const TfType &_GetStaticTfType(); + + static bool _IsTypedSchema(); + + // override SchemaBase virtuals. + MJCPHYSICS_API + const TfType &_GetTfType() const override; + + public: + // --------------------------------------------------------------------- // + // TIMESTEP + // --------------------------------------------------------------------- // + /// Controls the timestep in seconds used by MuJoCo. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:timestep = 0.002` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetTimestepAttr() const; + + /// See GetTimestepAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateTimestepAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // APIRATE + // --------------------------------------------------------------------- // + /// Determines the rate (in Hz) at which an external API allows + /// the update function to be executed. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:apirate = 100` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetApiRateAttr() const; + + /// See GetApiRateAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateApiRateAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // IMPRATIO + // --------------------------------------------------------------------- // + /// Ratio of frictional-to-normal constraint impedance for elliptic + /// friction cones. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:impratio = 1` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetImpRatioAttr() const; + + /// See GetImpRatioAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateImpRatioAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // WIND + // --------------------------------------------------------------------- // + /// Velocity vector of medium (i.e. wind). + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double3 mjc:physics:wind = (0, 0, 0)` | + /// | C++ Type | GfVec3d | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double3 | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetWindAttr() const; + + /// See GetWindAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateWindAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // MAGNETIC + // --------------------------------------------------------------------- // + /// Global magnetic flux. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double3 mjc:physics:magnetic = (0, -0.5, 0)` | + /// | C++ Type | GfVec3d | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double3 | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetMagneticAttr() const; + + /// See GetMagneticAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateMagneticAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // DENSITY + // --------------------------------------------------------------------- // + /// Density of medium. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:density = 0` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetDensityAttr() const; + + /// See GetDensityAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateDensityAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // VISCOSITY + // --------------------------------------------------------------------- // + /// Viscosity of medium. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:viscosity = 0` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetViscosityAttr() const; + + /// See GetViscosityAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateViscosityAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // OMARGIN + // --------------------------------------------------------------------- // + /// Replaces the margin parameter of all active contact pairs when + /// Contact override is enabled. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:o_margin = 0` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetOMarginAttr() const; + + /// See GetOMarginAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateOMarginAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // OSOLREF + // --------------------------------------------------------------------- // + /// Replaces the solref parameter of all active contact pairs when + /// Contact override is enabled. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double[] mjc:physics:o_solref = [0.02, 1]` | + /// | C++ Type | VtArray | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetOSolRefAttr() const; + + /// See GetOSolRefAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateOSolRefAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // OSOLIMP + // --------------------------------------------------------------------- // + /// Replaces the solimp parameter of all active contact pairs when + /// Contact override is enabled. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double[] mjc:physics:o_solimp = [0.9, 0.95, + /// 0.001, 0.5, 2]` | | C++ Type | VtArray | | \ref Usd_Datatypes "Usd + /// Type" | SdfValueTypeNames->DoubleArray | | \ref SdfVariability + /// "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetOSolImpAttr() const; + + /// See GetOSolImpAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateOSolImpAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // OFRICTION + // --------------------------------------------------------------------- // + /// Replaces the friction parameter of all active contact pairs when + /// Contact override is enabled. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double[] mjc:physics:o_friction = [1, 1, 0.005, + /// 0.0001, 0.0001]` | | C++ Type | VtArray | | \ref Usd_Datatypes + /// "Usd Type" | SdfValueTypeNames->DoubleArray | | \ref SdfVariability + /// "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetOFrictionAttr() const; + + /// See GetOFrictionAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateOFrictionAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // INTEGRATOR + // --------------------------------------------------------------------- // + /// Numerical integrator to be used. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform token mjc:physics:integrator = "euler"` | + /// | C++ Type | TfToken | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + /// | \ref MjcPhysicsTokens "Allowed Values" | euler, rk4, implicit, + /// implicitfast | + MJCPHYSICS_API + UsdAttribute GetIntegratorAttr() const; + + /// See GetIntegratorAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateIntegratorAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // CONE + // --------------------------------------------------------------------- // + /// The type of contact friction cone. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform token mjc:physics:cone = "pyramidal"` | + /// | C++ Type | TfToken | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + /// | \ref MjcPhysicsTokens "Allowed Values" | pyramidal, elliptic | + MJCPHYSICS_API + UsdAttribute GetConeAttr() const; + + /// See GetConeAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateConeAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // JACOBIAN + // --------------------------------------------------------------------- // + /// The type of constraint Jacobian and matrices computed from it. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform token mjc:physics:jacobian = "auto"` | + /// | C++ Type | TfToken | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + /// | \ref MjcPhysicsTokens "Allowed Values" | auto, dense, sparse | + MJCPHYSICS_API + UsdAttribute GetJacobianAttr() const; + + /// See GetJacobianAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateJacobianAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // SOLVER + // --------------------------------------------------------------------- // + /// Constraint solver algorithm to be used. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform token mjc:physics:solver = "newton"` | + /// | C++ Type | TfToken | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + /// | \ref MjcPhysicsTokens "Allowed Values" | pgs, cg, newton | + MJCPHYSICS_API + UsdAttribute GetSolverAttr() const; + + /// See GetSolverAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateSolverAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // ITERATIONS + // --------------------------------------------------------------------- // + /// Maximum number of iterations of the constraint solver. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int mjc:physics:iterations = 100` | + /// | C++ Type | int | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetIterationsAttr() const; + + /// See GetIterationsAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateIterationsAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // TOLERANCE + // --------------------------------------------------------------------- // + /// Tolerance threshold used for early termination of the iterative + /// solver. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:tolerance = 1e-8` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetToleranceAttr() const; + + /// See GetToleranceAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateToleranceAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // LSITERATIONS + // --------------------------------------------------------------------- // + /// Maximum number of linesearch iterations performed by CG/Newton + /// constraint solvers. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int mjc:physics:ls_iterations = 50` | + /// | C++ Type | int | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetLSIterationsAttr() const; + + /// See GetLSIterationsAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateLSIterationsAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // LSTOLERANCE + // --------------------------------------------------------------------- // + /// Tolerance threshold used for early termination of the linesearch + /// algorithm. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:ls_tolerance = 0.01` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetLSToleranceAttr() const; + + /// See GetLSToleranceAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateLSToleranceAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // NOSLIPITERATIONS + // --------------------------------------------------------------------- // + /// Maximum number of iterations of the Noslip solver. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int mjc:physics:noslip_iterations = 0` | + /// | C++ Type | int | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetNoslipIterationsAttr() const; + + /// See GetNoslipIterationsAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateNoslipIterationsAttr( + VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // NOSLIPTOLERANCE + // --------------------------------------------------------------------- // + /// Tolerance threshold used for early termination of the Noslip solver. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:noslip_tolerance = 0.000001` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetNoslipToleranceAttr() const; + + /// See GetNoslipToleranceAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateNoslipToleranceAttr( + VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // CCDITERATIONS + // --------------------------------------------------------------------- // + /// Maximum number of iterations of the algorithm used for convex collisions. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int mjc:physics:ccd_iterations = 50` | + /// | C++ Type | int | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetCCDIterationsAttr() const; + + /// See GetCCDIterationsAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateCCDIterationsAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // CCDTOLERANCE + // --------------------------------------------------------------------- // + /// Tolerance threshold used for early termination of the convex + /// collision algorithm. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform double mjc:physics:ccd_tolerance = 0.000001` | + /// | C++ Type | double | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetCCDToleranceAttr() const; + + /// See GetCCDToleranceAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateCCDToleranceAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // SDFITERATIONS + // --------------------------------------------------------------------- // + /// Number of iterations used for Signed Distance Field collisions + /// (per initial point). + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int mjc:physics:sdf_iterations = 10` | + /// | C++ Type | int | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetSDFIterationsAttr() const; + + /// See GetSDFIterationsAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateSDFIterationsAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // SDFINITPOINTS + // --------------------------------------------------------------------- // + /// Number of starting points used for finding contacts with Signed + /// Distance Field collisions. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int mjc:physics:sdf_initpoints = 40` | + /// | C++ Type | int | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetSDFInitPointsAttr() const; + + /// See GetSDFInitPointsAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateSDFInitPointsAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // ACTUATORGROUPDISABLE + // --------------------------------------------------------------------- // + /// List of actuator groups to disable. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform int[] mjc:physics:actuatorgroupdisable` | + /// | C++ Type | VtArray | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->IntArray | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetActuatorGroupDisableAttr() const; + + /// See GetActuatorGroupDisableAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateActuatorGroupDisableAttr( + VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // CONSTRAINTFLAG + // --------------------------------------------------------------------- // + /// Enables constraint solver. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:constraint = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetConstraintFlagAttr() const; + + /// See GetConstraintFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateConstraintFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // EQUALITYFLAG + // --------------------------------------------------------------------- // + /// Enables all standard computations related to equality constraints. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:equality = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetEqualityFlagAttr() const; + + /// See GetEqualityFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateEqualityFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // FRICTIONLOSSFLAG + // --------------------------------------------------------------------- // + /// Enables all standard computations related to friction loss constraints. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:frictionloss = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetFrictionLossFlagAttr() const; + + /// See GetFrictionLossFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateFrictionLossFlagAttr( + VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // LIMITFLAG + // --------------------------------------------------------------------- // + /// Enables all standard computations related to joint and tendon limit + /// constraints. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:limit = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetLimitFlagAttr() const; + + /// See GetLimitFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateLimitFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // CONTACTFLAG + // --------------------------------------------------------------------- // + /// Enables collision detection and all standard computations related to + /// contact constraints. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:contact = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetContactFlagAttr() const; + + /// See GetContactFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateContactFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // PASSIVEFLAG + // --------------------------------------------------------------------- // + /// Enables the simulation of joint and tendon spring-dampers, fluid dynamics + /// forces, and custom passive forces. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:passive = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetPassiveFlagAttr() const; + + /// See GetPassiveFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreatePassiveFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // GRAVITYFLAG + // --------------------------------------------------------------------- // + /// Enables the application of gravitational acceleration as defined in + /// mjOption. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:gravity = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetGravityFlagAttr() const; + + /// See GetGravityFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateGravityFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // CLAMPCTRLFLAG + // --------------------------------------------------------------------- // + /// Enables the clamping of control inputs to all actuators, according to + /// actuator-specific attributes. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:clampctrl = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetClampCtrlFlagAttr() const; + + /// See GetClampCtrlFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateClampCtrlFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // WARMSTARTFLAG + // --------------------------------------------------------------------- // + /// Enables warm-starting of the constraint solver, using the solution from + /// the previous time step to initialize the iterative optimization. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:warmstart = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetWarmStartFlagAttr() const; + + /// See GetWarmStartFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateWarmStartFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // FILTERPARENTFLAG + // --------------------------------------------------------------------- // + /// Enables the filtering of contact pairs where the two geoms belong to a + /// parent and child body. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:filterparent = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetFilterParentFlagAttr() const; + + /// See GetFilterParentFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateFilterParentFlagAttr( + VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // ACTUATIONFLAG + // --------------------------------------------------------------------- // + /// Enables all standard computations related to actuator forces, including + /// actuator dynamics. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:actuation = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetActuationFlagAttr() const; + + /// See GetActuationFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateActuationFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // REFSAFEFLAG + // --------------------------------------------------------------------- // + /// Enables a safety mechanism that prevents instabilities due to solref[0] + /// being too small compared to the simulation timestep. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:refsafe = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetRefSafeFlagAttr() const; + + /// See GetRefSafeFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateRefSafeFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // SENSORFLAG + // --------------------------------------------------------------------- // + /// Enables all computations related to sensors. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:sensor = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetSensorFlagAttr() const; + + /// See GetSensorFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateSensorFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // MIDPHASEFLAG + // --------------------------------------------------------------------- // + /// Enables mid-phase collision filtering using a static AABB bounding volume + /// hierarchy (BVH). + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:midphase = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetMidPhaseFlagAttr() const; + + /// See GetMidPhaseFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateMidPhaseFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // NATIVECCDFLAG + // --------------------------------------------------------------------- // + /// Enables the native convex collision detection pipeline instead of using + /// the libccd library. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:nativeccd = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetNativeCCDFlagAttr() const; + + /// See GetNativeCCDFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateNativeCCDFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // EULERDAMPFLAG + // --------------------------------------------------------------------- // + /// Enables implicit integration with respect to joint damping in the Euler + /// integrator. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:eulerdamp = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetEulerDampFlagAttr() const; + + /// See GetEulerDampFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateEulerDampFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // AUTORESETFLAG + // --------------------------------------------------------------------- // + /// Enables the automatic resetting of the simulation state when numerical + /// issues are detected. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:autoreset = 1` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetAutoResetFlagAttr() const; + + /// See GetAutoResetFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateAutoResetFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // OVERRIDEFLAG + // --------------------------------------------------------------------- // + /// Enables the contact override mechanism. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:override = 0` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetOverrideFlagAttr() const; + + /// See GetOverrideFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateOverrideFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // ENERGYFLAG + // --------------------------------------------------------------------- // + /// Enables the computation of potential and kinetic energy + /// (mjData.energy[0,1]). + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:energy = 0` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetEnergyFlagAttr() const; + + /// See GetEnergyFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateEnergyFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // FWDINVFLAG + // --------------------------------------------------------------------- // + /// Enables the automatic comparison of forward and inverse dynamics. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:fwdinv = 0` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetFwdinvFlagAttr() const; + + /// See GetFwdinvFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateFwdinvFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // INVDISCRETEFLAG + // --------------------------------------------------------------------- // + /// Enables discrete-time inverse dynamics with mj_inverse for integrators + /// other than RK4. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:invdiscrete = 0` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetInvDiscreteFlagAttr() const; + + /// See GetInvDiscreteFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateInvDiscreteFlagAttr( + VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // MULTICCDFLAG + // --------------------------------------------------------------------- // + /// Enables multiple-contact collision detection for geom pairs using a + /// general-purpose convex-convex collider. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:multiccd = 0` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetMultiCCDFlagAttr() const; + + /// See GetMultiCCDFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateMultiCCDFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // --------------------------------------------------------------------- // + // ISLANDFLAG + // --------------------------------------------------------------------- // + /// Enables the discovery of constraint islands. + /// + /// | || + /// | -- | -- | + /// | Declaration | `uniform bool mjc:physics:flag:island = 0` | + /// | C++ Type | bool | + /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool | + /// | \ref SdfVariability "Variability" | SdfVariabilityUniform | + MJCPHYSICS_API + UsdAttribute GetIslandFlagAttr() const; + + /// See GetIslandFlagAttr(), and also + /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create. + /// If specified, author \p defaultValue as the attribute's default, + /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true - + /// the default for \p writeSparsely is \c false. + MJCPHYSICS_API + UsdAttribute CreateIslandFlagAttr(VtValue const &defaultValue = VtValue(), + bool writeSparsely = false) const; + + public: + // ===================================================================== // + // Feel free to add custom code below this line, it will be preserved by + // the code generator. + // + // Just remember to: + // - Close the class declaration with }; + // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE + // - Close the include guard with #endif + // ===================================================================== // + // --(BEGIN CUSTOM CODE)-- +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/src/experimental/usd/mjcPhysics/siteAPI.cpp b/src/experimental/usd/mjcPhysics/siteAPI.cpp new file mode 100644 index 00000000..1693dd16 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/siteAPI.cpp @@ -0,0 +1,99 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "./siteAPI.h" + +#include "pxr/usd/sdf/assetPath.h" +#include "pxr/usd/sdf/types.h" +#include "pxr/usd/usd/schemaRegistry.h" +#include "pxr/usd/usd/typed.h" + +PXR_NAMESPACE_OPEN_SCOPE + +// Register the schema with the TfType system. +TF_REGISTRY_FUNCTION(TfType) { + TfType::Define >(); +} + +/* virtual */ +MjcPhysicsSiteAPI::~MjcPhysicsSiteAPI() {} + +/* static */ +MjcPhysicsSiteAPI MjcPhysicsSiteAPI::Get(const UsdStagePtr &stage, + const SdfPath &path) { + if (!stage) { + TF_CODING_ERROR("Invalid stage"); + return MjcPhysicsSiteAPI(); + } + return MjcPhysicsSiteAPI(stage->GetPrimAtPath(path)); +} + +/* virtual */ +UsdSchemaKind MjcPhysicsSiteAPI::_GetSchemaKind() const { + return MjcPhysicsSiteAPI::schemaKind; +} + +/* static */ +bool MjcPhysicsSiteAPI::CanApply(const UsdPrim &prim, std::string *whyNot) { + return prim.CanApplyAPI(whyNot); +} + +/* static */ +MjcPhysicsSiteAPI MjcPhysicsSiteAPI::Apply(const UsdPrim &prim) { + if (prim.ApplyAPI()) { + return MjcPhysicsSiteAPI(prim); + } + return MjcPhysicsSiteAPI(); +} + +/* static */ +const TfType &MjcPhysicsSiteAPI::_GetStaticTfType() { + static TfType tfType = TfType::Find(); + return tfType; +} + +/* static */ +bool MjcPhysicsSiteAPI::_IsTypedSchema() { + static bool isTyped = _GetStaticTfType().IsA(); + return isTyped; +} + +/* virtual */ +const TfType &MjcPhysicsSiteAPI::_GetTfType() const { + return _GetStaticTfType(); +} + +/*static*/ +const TfTokenVector &MjcPhysicsSiteAPI::GetSchemaAttributeNames( + bool includeInherited) { + static TfTokenVector localNames; + static TfTokenVector allNames = + UsdAPISchemaBase::GetSchemaAttributeNames(true); + + if (includeInherited) + return allNames; + else + return localNames; +} + +PXR_NAMESPACE_CLOSE_SCOPE + +// ===================================================================== // +// Feel free to add custom code below this line. It will be preserved by +// the code generator. +// +// Just remember to wrap code in the appropriate delimiters: +// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'. +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- diff --git a/src/experimental/usd/mjcPhysics/siteAPI.h b/src/experimental/usd/mjcPhysics/siteAPI.h new file mode 100644 index 00000000..e1981297 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/siteAPI.h @@ -0,0 +1,158 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef MJCPHYSICS_GENERATED_SITEAPI_H +#define MJCPHYSICS_GENERATED_SITEAPI_H + +/// \file mjcPhysics/siteAPI.h + +#include "./api.h" +#include "pxr/base/gf/matrix4d.h" +#include "pxr/base/gf/vec3d.h" +#include "pxr/base/gf/vec3f.h" +#include "pxr/base/tf/token.h" +#include "pxr/base/tf/type.h" +#include "pxr/base/vt/value.h" +#include "pxr/pxr.h" +#include "pxr/usd/usd/apiSchemaBase.h" +#include "pxr/usd/usd/prim.h" +#include "pxr/usd/usd/stage.h" + +PXR_NAMESPACE_OPEN_SCOPE + +class SdfAssetPath; + +// -------------------------------------------------------------------------- // +// MJCSITEAPI // +// -------------------------------------------------------------------------- // + +/// \class MjcPhysicsSiteAPI +/// +/// API describing a Mujoco site. +/// +class MjcPhysicsSiteAPI : public UsdAPISchemaBase { + public: + /// Compile time constant representing what kind of schema this class is. + /// + /// \sa UsdSchemaKind + static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI; + + /// Construct a MjcPhysicsSiteAPI on UsdPrim \p prim . + /// Equivalent to MjcPhysicsSiteAPI::Get(prim.GetStage(), prim.GetPath()) + /// for a \em valid \p prim, but will not immediately throw an error for + /// an invalid \p prim + explicit MjcPhysicsSiteAPI(const UsdPrim &prim = UsdPrim()) + : UsdAPISchemaBase(prim) {} + + /// Construct a MjcPhysicsSiteAPI on the prim held by \p schemaObj . + /// Should be preferred over MjcPhysicsSiteAPI(schemaObj.GetPrim()), + /// as it preserves SchemaBase state. + explicit MjcPhysicsSiteAPI(const UsdSchemaBase &schemaObj) + : UsdAPISchemaBase(schemaObj) {} + + /// Destructor. + MJCPHYSICS_API + virtual ~MjcPhysicsSiteAPI(); + + /// Return a vector of names of all pre-declared attributes for this schema + /// class and all its ancestor classes. Does not include attributes that + /// may be authored by custom/extended methods of the schemas involved. + MJCPHYSICS_API + static const TfTokenVector &GetSchemaAttributeNames( + bool includeInherited = true); + + /// Return a MjcPhysicsSiteAPI holding the prim adhering to this + /// schema at \p path on \p stage. If no prim exists at \p path on + /// \p stage, or if the prim at that path does not adhere to this schema, + /// return an invalid schema object. This is shorthand for the following: + /// + /// \code + /// MjcPhysicsSiteAPI(stage->GetPrimAtPath(path)); + /// \endcode + /// + MJCPHYSICS_API + static MjcPhysicsSiteAPI Get(const UsdStagePtr &stage, const SdfPath &path); + + /// Returns true if this single-apply API schema can be applied to + /// the given \p prim. If this schema can not be a applied to the prim, + /// this returns false and, if provided, populates \p whyNot with the + /// reason it can not be applied. + /// + /// Note that if CanApply returns false, that does not necessarily imply + /// that calling Apply will fail. Callers are expected to call CanApply + /// before calling Apply if they want to ensure that it is valid to + /// apply a schema. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + MJCPHYSICS_API + static bool CanApply(const UsdPrim &prim, std::string *whyNot = nullptr); + + /// Applies this single-apply API schema to the given \p prim. + /// This information is stored by adding "MjcSiteAPI" to the + /// token-valued, listOp metadata \em apiSchemas on the prim. + /// + /// \return A valid MjcPhysicsSiteAPI object is returned upon success. + /// An invalid (or empty) MjcPhysicsSiteAPI object is returned upon + /// failure. See \ref UsdPrim::ApplyAPI() for conditions + /// resulting in failure. + /// + /// \sa UsdPrim::GetAppliedSchemas() + /// \sa UsdPrim::HasAPI() + /// \sa UsdPrim::CanApplyAPI() + /// \sa UsdPrim::ApplyAPI() + /// \sa UsdPrim::RemoveAPI() + /// + MJCPHYSICS_API + static MjcPhysicsSiteAPI Apply(const UsdPrim &prim); + + protected: + /// Returns the kind of schema this class belongs to. + /// + /// \sa UsdSchemaKind + MJCPHYSICS_API + UsdSchemaKind _GetSchemaKind() const override; + + private: + // needs to invoke _GetStaticTfType. + friend class UsdSchemaRegistry; + MJCPHYSICS_API + static const TfType &_GetStaticTfType(); + + static bool _IsTypedSchema(); + + // override SchemaBase virtuals. + MJCPHYSICS_API + const TfType &_GetTfType() const override; + + public: + // ===================================================================== // + // Feel free to add custom code below this line, it will be preserved by + // the code generator. + // + // Just remember to: + // - Close the class declaration with }; + // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE + // - Close the include guard with #endif + // ===================================================================== // + // --(BEGIN CUSTOM CODE)-- +}; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/src/experimental/usd/mjcPhysics/tokens.cpp b/src/experimental/usd/mjcPhysics/tokens.cpp new file mode 100644 index 00000000..b6bfd4b8 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/tokens.cpp @@ -0,0 +1,156 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "./tokens.h" + +PXR_NAMESPACE_OPEN_SCOPE + +MjcPhysicsTokensType::MjcPhysicsTokensType() + : auto_("auto", TfToken::Immortal), + cg("cg", TfToken::Immortal), + dense("dense", TfToken::Immortal), + elliptic("elliptic", TfToken::Immortal), + euler("euler", TfToken::Immortal), + implicit("implicit", TfToken::Immortal), + implicitfast("implicitfast", TfToken::Immortal), + mjcPhysicsActuatorgroupdisable("mjc:physics:actuatorgroupdisable", + TfToken::Immortal), + mjcPhysicsApirate("mjc:physics:apirate", TfToken::Immortal), + mjcPhysicsCcd_iterations("mjc:physics:ccd_iterations", TfToken::Immortal), + mjcPhysicsCcd_tolerance("mjc:physics:ccd_tolerance", TfToken::Immortal), + mjcPhysicsCone("mjc:physics:cone", TfToken::Immortal), + mjcPhysicsDensity("mjc:physics:density", TfToken::Immortal), + mjcPhysicsFlagActuation("mjc:physics:flag:actuation", TfToken::Immortal), + mjcPhysicsFlagAutoreset("mjc:physics:flag:autoreset", TfToken::Immortal), + mjcPhysicsFlagClampctrl("mjc:physics:flag:clampctrl", TfToken::Immortal), + mjcPhysicsFlagConstraint("mjc:physics:flag:constraint", + TfToken::Immortal), + mjcPhysicsFlagContact("mjc:physics:flag:contact", TfToken::Immortal), + mjcPhysicsFlagEnergy("mjc:physics:flag:energy", TfToken::Immortal), + mjcPhysicsFlagEquality("mjc:physics:flag:equality", TfToken::Immortal), + mjcPhysicsFlagEulerdamp("mjc:physics:flag:eulerdamp", TfToken::Immortal), + mjcPhysicsFlagFilterparent("mjc:physics:flag:filterparent", + TfToken::Immortal), + mjcPhysicsFlagFrictionloss("mjc:physics:flag:frictionloss", + TfToken::Immortal), + mjcPhysicsFlagFwdinv("mjc:physics:flag:fwdinv", TfToken::Immortal), + mjcPhysicsFlagGravity("mjc:physics:flag:gravity", TfToken::Immortal), + mjcPhysicsFlagInvdiscrete("mjc:physics:flag:invdiscrete", + TfToken::Immortal), + mjcPhysicsFlagIsland("mjc:physics:flag:island", TfToken::Immortal), + mjcPhysicsFlagLimit("mjc:physics:flag:limit", TfToken::Immortal), + mjcPhysicsFlagMidphase("mjc:physics:flag:midphase", TfToken::Immortal), + mjcPhysicsFlagMulticcd("mjc:physics:flag:multiccd", TfToken::Immortal), + mjcPhysicsFlagNativeccd("mjc:physics:flag:nativeccd", TfToken::Immortal), + mjcPhysicsFlagOverride("mjc:physics:flag:override", TfToken::Immortal), + mjcPhysicsFlagPassive("mjc:physics:flag:passive", TfToken::Immortal), + mjcPhysicsFlagRefsafe("mjc:physics:flag:refsafe", TfToken::Immortal), + mjcPhysicsFlagSensor("mjc:physics:flag:sensor", TfToken::Immortal), + mjcPhysicsFlagWarmstart("mjc:physics:flag:warmstart", TfToken::Immortal), + mjcPhysicsImpratio("mjc:physics:impratio", TfToken::Immortal), + mjcPhysicsIntegrator("mjc:physics:integrator", TfToken::Immortal), + mjcPhysicsIterations("mjc:physics:iterations", TfToken::Immortal), + mjcPhysicsJacobian("mjc:physics:jacobian", TfToken::Immortal), + mjcPhysicsLs_iterations("mjc:physics:ls_iterations", TfToken::Immortal), + mjcPhysicsLs_tolerance("mjc:physics:ls_tolerance", TfToken::Immortal), + mjcPhysicsMagnetic("mjc:physics:magnetic", TfToken::Immortal), + mjcPhysicsNoslip_iterations("mjc:physics:noslip_iterations", + TfToken::Immortal), + mjcPhysicsNoslip_tolerance("mjc:physics:noslip_tolerance", + TfToken::Immortal), + mjcPhysicsO_friction("mjc:physics:o_friction", TfToken::Immortal), + mjcPhysicsO_margin("mjc:physics:o_margin", TfToken::Immortal), + mjcPhysicsO_solimp("mjc:physics:o_solimp", TfToken::Immortal), + mjcPhysicsO_solref("mjc:physics:o_solref", TfToken::Immortal), + mjcPhysicsSdf_initpoints("mjc:physics:sdf_initpoints", TfToken::Immortal), + mjcPhysicsSdf_iterations("mjc:physics:sdf_iterations", TfToken::Immortal), + mjcPhysicsSolver("mjc:physics:solver", TfToken::Immortal), + mjcPhysicsTimestep("mjc:physics:timestep", TfToken::Immortal), + mjcPhysicsTolerance("mjc:physics:tolerance", TfToken::Immortal), + mjcPhysicsViscosity("mjc:physics:viscosity", TfToken::Immortal), + mjcPhysicsWind("mjc:physics:wind", TfToken::Immortal), + newton("newton", TfToken::Immortal), + pgs("pgs", TfToken::Immortal), + pyramidal("pyramidal", TfToken::Immortal), + rk4("rk4", TfToken::Immortal), + sparse("sparse", TfToken::Immortal), + MjcPhysicsSceneAPI("MjcPhysicsSceneAPI", TfToken::Immortal), + MjcSiteAPI("MjcSiteAPI", TfToken::Immortal), + allTokens({auto_, + cg, + dense, + elliptic, + euler, + implicit, + implicitfast, + mjcPhysicsActuatorgroupdisable, + mjcPhysicsApirate, + mjcPhysicsCcd_iterations, + mjcPhysicsCcd_tolerance, + mjcPhysicsCone, + mjcPhysicsDensity, + mjcPhysicsFlagActuation, + mjcPhysicsFlagAutoreset, + mjcPhysicsFlagClampctrl, + mjcPhysicsFlagConstraint, + mjcPhysicsFlagContact, + mjcPhysicsFlagEnergy, + mjcPhysicsFlagEquality, + mjcPhysicsFlagEulerdamp, + mjcPhysicsFlagFilterparent, + mjcPhysicsFlagFrictionloss, + mjcPhysicsFlagFwdinv, + mjcPhysicsFlagGravity, + mjcPhysicsFlagInvdiscrete, + mjcPhysicsFlagIsland, + mjcPhysicsFlagLimit, + mjcPhysicsFlagMidphase, + mjcPhysicsFlagMulticcd, + mjcPhysicsFlagNativeccd, + mjcPhysicsFlagOverride, + mjcPhysicsFlagPassive, + mjcPhysicsFlagRefsafe, + mjcPhysicsFlagSensor, + mjcPhysicsFlagWarmstart, + mjcPhysicsImpratio, + mjcPhysicsIntegrator, + mjcPhysicsIterations, + mjcPhysicsJacobian, + mjcPhysicsLs_iterations, + mjcPhysicsLs_tolerance, + mjcPhysicsMagnetic, + mjcPhysicsNoslip_iterations, + mjcPhysicsNoslip_tolerance, + mjcPhysicsO_friction, + mjcPhysicsO_margin, + mjcPhysicsO_solimp, + mjcPhysicsO_solref, + mjcPhysicsSdf_initpoints, + mjcPhysicsSdf_iterations, + mjcPhysicsSolver, + mjcPhysicsTimestep, + mjcPhysicsTolerance, + mjcPhysicsViscosity, + mjcPhysicsWind, + newton, + pgs, + pyramidal, + rk4, + sparse, + MjcPhysicsSceneAPI, + MjcSiteAPI}) {} + +TfStaticData MjcPhysicsTokens; + +PXR_NAMESPACE_CLOSE_SCOPE diff --git a/src/experimental/usd/mjcPhysics/tokens.h b/src/experimental/usd/mjcPhysics/tokens.h new file mode 100644 index 00000000..8d6b5f92 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/tokens.h @@ -0,0 +1,332 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef MJCPHYSICS_TOKENS_H +#define MJCPHYSICS_TOKENS_H + +/// \file mjcPhysics/tokens.h + +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +// +// This is an automatically generated file (by usdGenSchema.py). +// Do not hand-edit! +// +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +#include + +#include "./api.h" +#include "pxr/base/tf/staticData.h" +#include "pxr/base/tf/token.h" +#include "pxr/pxr.h" + +PXR_NAMESPACE_OPEN_SCOPE + +/// \class MjcPhysicsTokensType +/// +/// \link MjcPhysicsTokens \endlink provides static, efficient +/// \link TfToken TfTokens\endlink for use in all public USD API. +/// +/// These tokens are auto-generated from the module's schema, representing +/// property names, for when you need to fetch an attribute or relationship +/// directly by name, e.g. UsdPrim::GetAttribute(), in the most efficient +/// manner, and allow the compiler to verify that you spelled the name +/// correctly. +/// +/// MjcPhysicsTokens also contains all of the \em allowedTokens values +/// declared for schema builtin attributes of 'token' scene description type. +/// Use MjcPhysicsTokens like so: +/// +/// \code +/// gprim.GetMyTokenValuedAttr().Set(MjcPhysicsTokens->auto_); +/// \endcode +struct MjcPhysicsTokensType { + MJCPHYSICS_API MjcPhysicsTokensType(); + /// \brief "auto" + /// + /// Fallback value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token + /// represents the auto constraint Jacobian and matrices computed from it. + const TfToken auto_; + /// \brief "cg" + /// + /// Possible value for MjcPhysicsSceneAPI::GetSolverAttr(), This token + /// represents the CG constraint solver algorithm. + const TfToken cg; + /// \brief "dense" + /// + /// Possible value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token + /// represents the dense constraint Jacobian and matrices computed from it. + const TfToken dense; + /// \brief "elliptic" + /// + /// Possible value for MjcPhysicsSceneAPI::GetConeAttr(), This token + /// represents the elliptic contact friction cone type. + const TfToken elliptic; + /// \brief "euler" + /// + /// Fallback value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token + /// represents the Euler numerical integrator. + const TfToken euler; + /// \brief "implicit" + /// + /// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token + /// represents the implicit numerical integrator. + const TfToken implicit; + /// \brief "implicitfast" + /// + /// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token + /// represents the implicitfast numerical integrator. + const TfToken implicitfast; + /// \brief "mjc:physics:actuatorgroupdisable" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsActuatorgroupdisable; + /// \brief "mjc:physics:apirate" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsApirate; + /// \brief "mjc:physics:ccd_iterations" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsCcd_iterations; + /// \brief "mjc:physics:ccd_tolerance" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsCcd_tolerance; + /// \brief "mjc:physics:cone" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsCone; + /// \brief "mjc:physics:density" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsDensity; + /// \brief "mjc:physics:flag:actuation" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagActuation; + /// \brief "mjc:physics:flag:autoreset" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagAutoreset; + /// \brief "mjc:physics:flag:clampctrl" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagClampctrl; + /// \brief "mjc:physics:flag:constraint" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagConstraint; + /// \brief "mjc:physics:flag:contact" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagContact; + /// \brief "mjc:physics:flag:energy" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagEnergy; + /// \brief "mjc:physics:flag:equality" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagEquality; + /// \brief "mjc:physics:flag:eulerdamp" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagEulerdamp; + /// \brief "mjc:physics:flag:filterparent" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagFilterparent; + /// \brief "mjc:physics:flag:frictionloss" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagFrictionloss; + /// \brief "mjc:physics:flag:fwdinv" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagFwdinv; + /// \brief "mjc:physics:flag:gravity" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagGravity; + /// \brief "mjc:physics:flag:invdiscrete" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagInvdiscrete; + /// \brief "mjc:physics:flag:island" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagIsland; + /// \brief "mjc:physics:flag:limit" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagLimit; + /// \brief "mjc:physics:flag:midphase" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagMidphase; + /// \brief "mjc:physics:flag:multiccd" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagMulticcd; + /// \brief "mjc:physics:flag:nativeccd" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagNativeccd; + /// \brief "mjc:physics:flag:override" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagOverride; + /// \brief "mjc:physics:flag:passive" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagPassive; + /// \brief "mjc:physics:flag:refsafe" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagRefsafe; + /// \brief "mjc:physics:flag:sensor" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagSensor; + /// \brief "mjc:physics:flag:warmstart" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsFlagWarmstart; + /// \brief "mjc:physics:impratio" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsImpratio; + /// \brief "mjc:physics:integrator" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsIntegrator; + /// \brief "mjc:physics:iterations" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsIterations; + /// \brief "mjc:physics:jacobian" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsJacobian; + /// \brief "mjc:physics:ls_iterations" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsLs_iterations; + /// \brief "mjc:physics:ls_tolerance" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsLs_tolerance; + /// \brief "mjc:physics:magnetic" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsMagnetic; + /// \brief "mjc:physics:noslip_iterations" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsNoslip_iterations; + /// \brief "mjc:physics:noslip_tolerance" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsNoslip_tolerance; + /// \brief "mjc:physics:o_friction" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsO_friction; + /// \brief "mjc:physics:o_margin" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsO_margin; + /// \brief "mjc:physics:o_solimp" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsO_solimp; + /// \brief "mjc:physics:o_solref" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsO_solref; + /// \brief "mjc:physics:sdf_initpoints" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsSdf_initpoints; + /// \brief "mjc:physics:sdf_iterations" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsSdf_iterations; + /// \brief "mjc:physics:solver" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsSolver; + /// \brief "mjc:physics:timestep" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsTimestep; + /// \brief "mjc:physics:tolerance" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsTolerance; + /// \brief "mjc:physics:viscosity" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsViscosity; + /// \brief "mjc:physics:wind" + /// + /// MjcPhysicsSceneAPI + const TfToken mjcPhysicsWind; + /// \brief "newton" + /// + /// Fallback value for MjcPhysicsSceneAPI::GetSolverAttr(), This token + /// represents the Newton constraint solver algorithm. + const TfToken newton; + /// \brief "pgs" + /// + /// Possible value for MjcPhysicsSceneAPI::GetSolverAttr(), This token + /// represents the PGS constraint solver algorithm. + const TfToken pgs; + /// \brief "pyramidal" + /// + /// Fallback value for MjcPhysicsSceneAPI::GetConeAttr(), This token + /// represents the pyramidal contact friction cone type. + const TfToken pyramidal; + /// \brief "rk4" + /// + /// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token + /// represents the RK4 numerical integrator. + const TfToken rk4; + /// \brief "sparse" + /// + /// Possible value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token + /// represents the sparse constraint Jacobian and matrices computed from it. + const TfToken sparse; + /// \brief "MjcPhysicsSceneAPI" + /// + /// Schema identifer and family for MjcPhysicsSceneAPI + const TfToken MjcPhysicsSceneAPI; + /// \brief "MjcSiteAPI" + /// + /// Schema identifer and family for MjcPhysicsSiteAPI + const TfToken MjcSiteAPI; + /// A vector of all of the tokens listed above. + const std::vector allTokens; +}; + +/// \var MjcPhysicsTokens +/// +/// A global variable with static, efficient \link TfToken TfTokens\endlink +/// for use in all public USD API. \sa MjcPhysicsTokensType +extern MJCPHYSICS_API TfStaticData MjcPhysicsTokens; + +PXR_NAMESPACE_CLOSE_SCOPE + +#endif diff --git a/src/experimental/usd/mjcPhysics/wrapSceneAPI.cpp b/src/experimental/usd/mjcPhysics/wrapSceneAPI.cpp new file mode 100644 index 00000000..f8936938 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/wrapSceneAPI.cpp @@ -0,0 +1,653 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "./sceneAPI.h" +#include "pxr/base/tf/pyAnnotatedBoolResult.h" +#include "pxr/base/tf/pyContainerConversions.h" +#include "pxr/base/tf/pyResultConversions.h" +#include "pxr/base/tf/pyUtils.h" +#include "pxr/base/tf/wrapTypeHelpers.h" +#include "pxr/usd/sdf/primSpec.h" +#include "pxr/usd/usd/pyConversions.h" +#include "pxr/usd/usd/schemaBase.h" + +using namespace boost::python; + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace { + +#define WRAP_CUSTOM \ + template \ + static void _CustomWrapCode(Cls &_class) + +// fwd decl. +WRAP_CUSTOM; + +static UsdAttribute _CreateTimestepAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateTimestepAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateApiRateAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateApiRateAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateImpRatioAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateImpRatioAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateWindAttr(MjcPhysicsSceneAPI &self, object defaultVal, + bool writeSparsely) { + return self.CreateWindAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double3), + writeSparsely); +} + +static UsdAttribute _CreateMagneticAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateMagneticAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double3), + writeSparsely); +} + +static UsdAttribute _CreateDensityAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateDensityAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateViscosityAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateViscosityAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateOMarginAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateOMarginAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateOSolRefAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateOSolRefAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->DoubleArray), + writeSparsely); +} + +static UsdAttribute _CreateOSolImpAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateOSolImpAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->DoubleArray), + writeSparsely); +} + +static UsdAttribute _CreateOFrictionAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateOFrictionAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->DoubleArray), + writeSparsely); +} + +static UsdAttribute _CreateIntegratorAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateIntegratorAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Token), writeSparsely); +} + +static UsdAttribute _CreateConeAttr(MjcPhysicsSceneAPI &self, object defaultVal, + bool writeSparsely) { + return self.CreateConeAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Token), writeSparsely); +} + +static UsdAttribute _CreateJacobianAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateJacobianAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Token), writeSparsely); +} + +static UsdAttribute _CreateSolverAttr(MjcPhysicsSceneAPI &self, + object defaultVal, bool writeSparsely) { + return self.CreateSolverAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Token), writeSparsely); +} + +static UsdAttribute _CreateIterationsAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateIterationsAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely); +} + +static UsdAttribute _CreateToleranceAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateToleranceAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateLSIterationsAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateLSIterationsAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely); +} + +static UsdAttribute _CreateLSToleranceAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateLSToleranceAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateNoslipIterationsAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateNoslipIterationsAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely); +} + +static UsdAttribute _CreateNoslipToleranceAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateNoslipToleranceAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateCCDIterationsAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateCCDIterationsAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely); +} + +static UsdAttribute _CreateCCDToleranceAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateCCDToleranceAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely); +} + +static UsdAttribute _CreateSDFIterationsAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateSDFIterationsAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely); +} + +static UsdAttribute _CreateSDFInitPointsAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateSDFInitPointsAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely); +} + +static UsdAttribute _CreateActuatorGroupDisableAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateActuatorGroupDisableAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->IntArray), + writeSparsely); +} + +static UsdAttribute _CreateConstraintFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateConstraintFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateEqualityFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateEqualityFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateFrictionLossFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateFrictionLossFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateLimitFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateLimitFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateContactFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateContactFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreatePassiveFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreatePassiveFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateGravityFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateGravityFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateClampCtrlFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateClampCtrlFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateWarmStartFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateWarmStartFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateFilterParentFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateFilterParentFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateActuationFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateActuationFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateRefSafeFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateRefSafeFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateSensorFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateSensorFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateMidPhaseFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateMidPhaseFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateNativeCCDFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateNativeCCDFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateEulerDampFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateEulerDampFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateAutoResetFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateAutoResetFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateOverrideFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateOverrideFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateEnergyFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateEnergyFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateFwdinvFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateFwdinvFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateInvDiscreteFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateInvDiscreteFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateMultiCCDFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateMultiCCDFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static UsdAttribute _CreateIslandFlagAttr(MjcPhysicsSceneAPI &self, + object defaultVal, + bool writeSparsely) { + return self.CreateIslandFlagAttr( + UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely); +} + +static std::string _Repr(const MjcPhysicsSceneAPI &self) { + std::string primRepr = TfPyRepr(self.GetPrim()); + return TfStringPrintf("MjcPhysics.SceneAPI(%s)", primRepr.c_str()); +} + +struct MjcPhysicsSceneAPI_CanApplyResult + : public TfPyAnnotatedBoolResult { + MjcPhysicsSceneAPI_CanApplyResult(bool val, std::string const &msg) + : TfPyAnnotatedBoolResult(val, msg) {} +}; + +static MjcPhysicsSceneAPI_CanApplyResult _WrapCanApply(const UsdPrim &prim) { + std::string whyNot; + bool result = MjcPhysicsSceneAPI::CanApply(prim, &whyNot); + return MjcPhysicsSceneAPI_CanApplyResult(result, whyNot); +} + +} // anonymous namespace + +void wrapMjcPhysicsSceneAPI() { + typedef MjcPhysicsSceneAPI This; + + MjcPhysicsSceneAPI_CanApplyResult::Wrap( + "_CanApplyResult", "whyNot"); + + class_ > cls("SceneAPI"); + + cls.def(init(arg("prim"))) + .def(init(arg("schemaObj"))) + .def(TfTypePythonClass()) + + .def("Get", &This::Get, (arg("stage"), arg("path"))) + .staticmethod("Get") + + .def("CanApply", &_WrapCanApply, (arg("prim"))) + .staticmethod("CanApply") + + .def("Apply", &This::Apply, (arg("prim"))) + .staticmethod("Apply") + + .def("GetSchemaAttributeNames", &This::GetSchemaAttributeNames, + arg("includeInherited") = true, + return_value_policy()) + .staticmethod("GetSchemaAttributeNames") + + .def("_GetStaticTfType", (TfType const &(*)())TfType::Find, + return_value_policy()) + .staticmethod("_GetStaticTfType") + + .def(!self) + + .def("GetTimestepAttr", &This::GetTimestepAttr) + .def("CreateTimestepAttr", &_CreateTimestepAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetApiRateAttr", &This::GetApiRateAttr) + .def("CreateApiRateAttr", &_CreateApiRateAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetImpRatioAttr", &This::GetImpRatioAttr) + .def("CreateImpRatioAttr", &_CreateImpRatioAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetWindAttr", &This::GetWindAttr) + .def("CreateWindAttr", &_CreateWindAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetMagneticAttr", &This::GetMagneticAttr) + .def("CreateMagneticAttr", &_CreateMagneticAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetDensityAttr", &This::GetDensityAttr) + .def("CreateDensityAttr", &_CreateDensityAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetViscosityAttr", &This::GetViscosityAttr) + .def("CreateViscosityAttr", &_CreateViscosityAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetOMarginAttr", &This::GetOMarginAttr) + .def("CreateOMarginAttr", &_CreateOMarginAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetOSolRefAttr", &This::GetOSolRefAttr) + .def("CreateOSolRefAttr", &_CreateOSolRefAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetOSolImpAttr", &This::GetOSolImpAttr) + .def("CreateOSolImpAttr", &_CreateOSolImpAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetOFrictionAttr", &This::GetOFrictionAttr) + .def("CreateOFrictionAttr", &_CreateOFrictionAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetIntegratorAttr", &This::GetIntegratorAttr) + .def("CreateIntegratorAttr", &_CreateIntegratorAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetConeAttr", &This::GetConeAttr) + .def("CreateConeAttr", &_CreateConeAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetJacobianAttr", &This::GetJacobianAttr) + .def("CreateJacobianAttr", &_CreateJacobianAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetSolverAttr", &This::GetSolverAttr) + .def("CreateSolverAttr", &_CreateSolverAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetIterationsAttr", &This::GetIterationsAttr) + .def("CreateIterationsAttr", &_CreateIterationsAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetToleranceAttr", &This::GetToleranceAttr) + .def("CreateToleranceAttr", &_CreateToleranceAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetLSIterationsAttr", &This::GetLSIterationsAttr) + .def("CreateLSIterationsAttr", &_CreateLSIterationsAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetLSToleranceAttr", &This::GetLSToleranceAttr) + .def("CreateLSToleranceAttr", &_CreateLSToleranceAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetNoslipIterationsAttr", &This::GetNoslipIterationsAttr) + .def("CreateNoslipIterationsAttr", &_CreateNoslipIterationsAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetNoslipToleranceAttr", &This::GetNoslipToleranceAttr) + .def("CreateNoslipToleranceAttr", &_CreateNoslipToleranceAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetCCDIterationsAttr", &This::GetCCDIterationsAttr) + .def("CreateCCDIterationsAttr", &_CreateCCDIterationsAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetCCDToleranceAttr", &This::GetCCDToleranceAttr) + .def("CreateCCDToleranceAttr", &_CreateCCDToleranceAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetSDFIterationsAttr", &This::GetSDFIterationsAttr) + .def("CreateSDFIterationsAttr", &_CreateSDFIterationsAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetSDFInitPointsAttr", &This::GetSDFInitPointsAttr) + .def("CreateSDFInitPointsAttr", &_CreateSDFInitPointsAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetActuatorGroupDisableAttr", &This::GetActuatorGroupDisableAttr) + .def("CreateActuatorGroupDisableAttr", &_CreateActuatorGroupDisableAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetConstraintFlagAttr", &This::GetConstraintFlagAttr) + .def("CreateConstraintFlagAttr", &_CreateConstraintFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetEqualityFlagAttr", &This::GetEqualityFlagAttr) + .def("CreateEqualityFlagAttr", &_CreateEqualityFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetFrictionLossFlagAttr", &This::GetFrictionLossFlagAttr) + .def("CreateFrictionLossFlagAttr", &_CreateFrictionLossFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetLimitFlagAttr", &This::GetLimitFlagAttr) + .def("CreateLimitFlagAttr", &_CreateLimitFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetContactFlagAttr", &This::GetContactFlagAttr) + .def("CreateContactFlagAttr", &_CreateContactFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetPassiveFlagAttr", &This::GetPassiveFlagAttr) + .def("CreatePassiveFlagAttr", &_CreatePassiveFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetGravityFlagAttr", &This::GetGravityFlagAttr) + .def("CreateGravityFlagAttr", &_CreateGravityFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetClampCtrlFlagAttr", &This::GetClampCtrlFlagAttr) + .def("CreateClampCtrlFlagAttr", &_CreateClampCtrlFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetWarmStartFlagAttr", &This::GetWarmStartFlagAttr) + .def("CreateWarmStartFlagAttr", &_CreateWarmStartFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetFilterParentFlagAttr", &This::GetFilterParentFlagAttr) + .def("CreateFilterParentFlagAttr", &_CreateFilterParentFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetActuationFlagAttr", &This::GetActuationFlagAttr) + .def("CreateActuationFlagAttr", &_CreateActuationFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetRefSafeFlagAttr", &This::GetRefSafeFlagAttr) + .def("CreateRefSafeFlagAttr", &_CreateRefSafeFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetSensorFlagAttr", &This::GetSensorFlagAttr) + .def("CreateSensorFlagAttr", &_CreateSensorFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetMidPhaseFlagAttr", &This::GetMidPhaseFlagAttr) + .def("CreateMidPhaseFlagAttr", &_CreateMidPhaseFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetNativeCCDFlagAttr", &This::GetNativeCCDFlagAttr) + .def("CreateNativeCCDFlagAttr", &_CreateNativeCCDFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetEulerDampFlagAttr", &This::GetEulerDampFlagAttr) + .def("CreateEulerDampFlagAttr", &_CreateEulerDampFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetAutoResetFlagAttr", &This::GetAutoResetFlagAttr) + .def("CreateAutoResetFlagAttr", &_CreateAutoResetFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetOverrideFlagAttr", &This::GetOverrideFlagAttr) + .def("CreateOverrideFlagAttr", &_CreateOverrideFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetEnergyFlagAttr", &This::GetEnergyFlagAttr) + .def("CreateEnergyFlagAttr", &_CreateEnergyFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetFwdinvFlagAttr", &This::GetFwdinvFlagAttr) + .def("CreateFwdinvFlagAttr", &_CreateFwdinvFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetInvDiscreteFlagAttr", &This::GetInvDiscreteFlagAttr) + .def("CreateInvDiscreteFlagAttr", &_CreateInvDiscreteFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetMultiCCDFlagAttr", &This::GetMultiCCDFlagAttr) + .def("CreateMultiCCDFlagAttr", &_CreateMultiCCDFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("GetIslandFlagAttr", &This::GetIslandFlagAttr) + .def("CreateIslandFlagAttr", &_CreateIslandFlagAttr, + (arg("defaultValue") = object(), arg("writeSparsely") = false)) + + .def("__repr__", ::_Repr); + + _CustomWrapCode(cls); +} + +// ===================================================================== // +// Feel free to add custom code below this line, it will be preserved by +// the code generator. The entry point for your custom code should look +// minimally like the following: +// +// WRAP_CUSTOM { +// _class +// .def("MyCustomMethod", ...) +// ; +// } +// +// Of course any other ancillary or support code may be provided. +// +// Just remember to wrap code in the appropriate delimiters: +// 'namespace {', '}'. +// +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +namespace { + +WRAP_CUSTOM {} + +} // namespace diff --git a/src/experimental/usd/mjcPhysics/wrapSiteAPI.cpp b/src/experimental/usd/mjcPhysics/wrapSiteAPI.cpp new file mode 100644 index 00000000..267978d7 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/wrapSiteAPI.cpp @@ -0,0 +1,120 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "./siteAPI.h" +#include "pxr/base/tf/pyAnnotatedBoolResult.h" +#include "pxr/base/tf/pyContainerConversions.h" +#include "pxr/base/tf/pyResultConversions.h" +#include "pxr/base/tf/pyUtils.h" +#include "pxr/base/tf/wrapTypeHelpers.h" +#include "pxr/usd/sdf/primSpec.h" +#include "pxr/usd/usd/pyConversions.h" +#include "pxr/usd/usd/schemaBase.h" + +using namespace boost::python; + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace { + +#define WRAP_CUSTOM \ + template \ + static void _CustomWrapCode(Cls &_class) + +// fwd decl. +WRAP_CUSTOM; + +static std::string _Repr(const MjcPhysicsSiteAPI &self) { + std::string primRepr = TfPyRepr(self.GetPrim()); + return TfStringPrintf("MjcPhysics.SiteAPI(%s)", primRepr.c_str()); +} + +struct MjcPhysicsSiteAPI_CanApplyResult + : public TfPyAnnotatedBoolResult { + MjcPhysicsSiteAPI_CanApplyResult(bool val, std::string const &msg) + : TfPyAnnotatedBoolResult(val, msg) {} +}; + +static MjcPhysicsSiteAPI_CanApplyResult _WrapCanApply(const UsdPrim &prim) { + std::string whyNot; + bool result = MjcPhysicsSiteAPI::CanApply(prim, &whyNot); + return MjcPhysicsSiteAPI_CanApplyResult(result, whyNot); +} + +} // anonymous namespace + +void wrapMjcPhysicsSiteAPI() { + typedef MjcPhysicsSiteAPI This; + + MjcPhysicsSiteAPI_CanApplyResult::Wrap( + "_CanApplyResult", "whyNot"); + + class_ > cls("SiteAPI"); + + cls.def(init(arg("prim"))) + .def(init(arg("schemaObj"))) + .def(TfTypePythonClass()) + + .def("Get", &This::Get, (arg("stage"), arg("path"))) + .staticmethod("Get") + + .def("CanApply", &_WrapCanApply, (arg("prim"))) + .staticmethod("CanApply") + + .def("Apply", &This::Apply, (arg("prim"))) + .staticmethod("Apply") + + .def("GetSchemaAttributeNames", &This::GetSchemaAttributeNames, + arg("includeInherited") = true, + return_value_policy()) + .staticmethod("GetSchemaAttributeNames") + + .def("_GetStaticTfType", (TfType const &(*)())TfType::Find, + return_value_policy()) + .staticmethod("_GetStaticTfType") + + .def(!self) + + .def("__repr__", ::_Repr); + + _CustomWrapCode(cls); +} + +// ===================================================================== // +// Feel free to add custom code below this line, it will be preserved by +// the code generator. The entry point for your custom code should look +// minimally like the following: +// +// WRAP_CUSTOM { +// _class +// .def("MyCustomMethod", ...) +// ; +// } +// +// Of course any other ancillary or support code may be provided. +// +// Just remember to wrap code in the appropriate delimiters: +// 'namespace {', '}'. +// +// ===================================================================== // +// --(BEGIN CUSTOM CODE)-- + +namespace { + +WRAP_CUSTOM {} + +} // namespace diff --git a/src/experimental/usd/mjcPhysics/wrapTokens.cpp b/src/experimental/usd/mjcPhysics/wrapTokens.cpp new file mode 100644 index 00000000..bd9d4b75 --- /dev/null +++ b/src/experimental/usd/mjcPhysics/wrapTokens.cpp @@ -0,0 +1,150 @@ +// Copyright 2025 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// GENERATED FILE. DO NOT EDIT. +#include + +#include "./tokens.h" + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace { + +// Helper to return a static token as a string. We wrap tokens as Python +// strings and for some reason simply wrapping the token using def_readonly +// bypasses to-Python conversion, leading to the error that there's no +// Python type for the C++ TfToken type. So we wrap this functor instead. +class _WrapStaticToken { + public: + _WrapStaticToken(const TfToken* token) : _token(token) {} + + std::string operator()() const { return _token->GetString(); } + + private: + const TfToken* _token; +}; + +template +void _AddToken(T& cls, const char* name, const TfToken& token) { + cls.add_static_property( + name, + boost::python::make_function( + _WrapStaticToken(&token), + boost::python::return_value_policy(), + boost::mpl::vector1())); +} + +} // namespace + +void wrapMjcPhysicsTokens() { + boost::python::class_ cls( + "Tokens", boost::python::no_init); + _AddToken(cls, "auto_", MjcPhysicsTokens->auto_); + _AddToken(cls, "cg", MjcPhysicsTokens->cg); + _AddToken(cls, "dense", MjcPhysicsTokens->dense); + _AddToken(cls, "elliptic", MjcPhysicsTokens->elliptic); + _AddToken(cls, "euler", MjcPhysicsTokens->euler); + _AddToken(cls, "implicit", MjcPhysicsTokens->implicit); + _AddToken(cls, "implicitfast", MjcPhysicsTokens->implicitfast); + _AddToken(cls, "mjcPhysicsActuatorgroupdisable", + MjcPhysicsTokens->mjcPhysicsActuatorgroupdisable); + _AddToken(cls, "mjcPhysicsApirate", MjcPhysicsTokens->mjcPhysicsApirate); + _AddToken(cls, "mjcPhysicsCcd_iterations", + MjcPhysicsTokens->mjcPhysicsCcd_iterations); + _AddToken(cls, "mjcPhysicsCcd_tolerance", + MjcPhysicsTokens->mjcPhysicsCcd_tolerance); + _AddToken(cls, "mjcPhysicsCone", MjcPhysicsTokens->mjcPhysicsCone); + _AddToken(cls, "mjcPhysicsDensity", MjcPhysicsTokens->mjcPhysicsDensity); + _AddToken(cls, "mjcPhysicsFlagActuation", + MjcPhysicsTokens->mjcPhysicsFlagActuation); + _AddToken(cls, "mjcPhysicsFlagAutoreset", + MjcPhysicsTokens->mjcPhysicsFlagAutoreset); + _AddToken(cls, "mjcPhysicsFlagClampctrl", + MjcPhysicsTokens->mjcPhysicsFlagClampctrl); + _AddToken(cls, "mjcPhysicsFlagConstraint", + MjcPhysicsTokens->mjcPhysicsFlagConstraint); + _AddToken(cls, "mjcPhysicsFlagContact", + MjcPhysicsTokens->mjcPhysicsFlagContact); + _AddToken(cls, "mjcPhysicsFlagEnergy", + MjcPhysicsTokens->mjcPhysicsFlagEnergy); + _AddToken(cls, "mjcPhysicsFlagEquality", + MjcPhysicsTokens->mjcPhysicsFlagEquality); + _AddToken(cls, "mjcPhysicsFlagEulerdamp", + MjcPhysicsTokens->mjcPhysicsFlagEulerdamp); + _AddToken(cls, "mjcPhysicsFlagFilterparent", + MjcPhysicsTokens->mjcPhysicsFlagFilterparent); + _AddToken(cls, "mjcPhysicsFlagFrictionloss", + MjcPhysicsTokens->mjcPhysicsFlagFrictionloss); + _AddToken(cls, "mjcPhysicsFlagFwdinv", + MjcPhysicsTokens->mjcPhysicsFlagFwdinv); + _AddToken(cls, "mjcPhysicsFlagGravity", + MjcPhysicsTokens->mjcPhysicsFlagGravity); + _AddToken(cls, "mjcPhysicsFlagInvdiscrete", + MjcPhysicsTokens->mjcPhysicsFlagInvdiscrete); + _AddToken(cls, "mjcPhysicsFlagIsland", + MjcPhysicsTokens->mjcPhysicsFlagIsland); + _AddToken(cls, "mjcPhysicsFlagLimit", MjcPhysicsTokens->mjcPhysicsFlagLimit); + _AddToken(cls, "mjcPhysicsFlagMidphase", + MjcPhysicsTokens->mjcPhysicsFlagMidphase); + _AddToken(cls, "mjcPhysicsFlagMulticcd", + MjcPhysicsTokens->mjcPhysicsFlagMulticcd); + _AddToken(cls, "mjcPhysicsFlagNativeccd", + MjcPhysicsTokens->mjcPhysicsFlagNativeccd); + _AddToken(cls, "mjcPhysicsFlagOverride", + MjcPhysicsTokens->mjcPhysicsFlagOverride); + _AddToken(cls, "mjcPhysicsFlagPassive", + MjcPhysicsTokens->mjcPhysicsFlagPassive); + _AddToken(cls, "mjcPhysicsFlagRefsafe", + MjcPhysicsTokens->mjcPhysicsFlagRefsafe); + _AddToken(cls, "mjcPhysicsFlagSensor", + MjcPhysicsTokens->mjcPhysicsFlagSensor); + _AddToken(cls, "mjcPhysicsFlagWarmstart", + MjcPhysicsTokens->mjcPhysicsFlagWarmstart); + _AddToken(cls, "mjcPhysicsImpratio", MjcPhysicsTokens->mjcPhysicsImpratio); + _AddToken(cls, "mjcPhysicsIntegrator", + MjcPhysicsTokens->mjcPhysicsIntegrator); + _AddToken(cls, "mjcPhysicsIterations", + MjcPhysicsTokens->mjcPhysicsIterations); + _AddToken(cls, "mjcPhysicsJacobian", MjcPhysicsTokens->mjcPhysicsJacobian); + _AddToken(cls, "mjcPhysicsLs_iterations", + MjcPhysicsTokens->mjcPhysicsLs_iterations); + _AddToken(cls, "mjcPhysicsLs_tolerance", + MjcPhysicsTokens->mjcPhysicsLs_tolerance); + _AddToken(cls, "mjcPhysicsMagnetic", MjcPhysicsTokens->mjcPhysicsMagnetic); + _AddToken(cls, "mjcPhysicsNoslip_iterations", + MjcPhysicsTokens->mjcPhysicsNoslip_iterations); + _AddToken(cls, "mjcPhysicsNoslip_tolerance", + MjcPhysicsTokens->mjcPhysicsNoslip_tolerance); + _AddToken(cls, "mjcPhysicsO_friction", + MjcPhysicsTokens->mjcPhysicsO_friction); + _AddToken(cls, "mjcPhysicsO_margin", MjcPhysicsTokens->mjcPhysicsO_margin); + _AddToken(cls, "mjcPhysicsO_solimp", MjcPhysicsTokens->mjcPhysicsO_solimp); + _AddToken(cls, "mjcPhysicsO_solref", MjcPhysicsTokens->mjcPhysicsO_solref); + _AddToken(cls, "mjcPhysicsSdf_initpoints", + MjcPhysicsTokens->mjcPhysicsSdf_initpoints); + _AddToken(cls, "mjcPhysicsSdf_iterations", + MjcPhysicsTokens->mjcPhysicsSdf_iterations); + _AddToken(cls, "mjcPhysicsSolver", MjcPhysicsTokens->mjcPhysicsSolver); + _AddToken(cls, "mjcPhysicsTimestep", MjcPhysicsTokens->mjcPhysicsTimestep); + _AddToken(cls, "mjcPhysicsTolerance", MjcPhysicsTokens->mjcPhysicsTolerance); + _AddToken(cls, "mjcPhysicsViscosity", MjcPhysicsTokens->mjcPhysicsViscosity); + _AddToken(cls, "mjcPhysicsWind", MjcPhysicsTokens->mjcPhysicsWind); + _AddToken(cls, "newton", MjcPhysicsTokens->newton); + _AddToken(cls, "pgs", MjcPhysicsTokens->pgs); + _AddToken(cls, "pyramidal", MjcPhysicsTokens->pyramidal); + _AddToken(cls, "rk4", MjcPhysicsTokens->rk4); + _AddToken(cls, "sparse", MjcPhysicsTokens->sparse); + _AddToken(cls, "MjcPhysicsSceneAPI", MjcPhysicsTokens->MjcPhysicsSceneAPI); + _AddToken(cls, "MjcSiteAPI", MjcPhysicsTokens->MjcSiteAPI); +}