Add support for tendons to mjcPhysics.
PiperOrigin-RevId: 822230926 Change-Id: I232a9fbfb473186ac742d210458ff0221a561126
This commit is contained in:
committed by
Copybara-Service
parent
ac2cd5dfd6
commit
160b9480f9
@@ -0,0 +1,816 @@
|
||||
// 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_TENDON_H
|
||||
#define MJCPHYSICS_GENERATED_TENDON_H
|
||||
|
||||
/// \file mjcPhysics/tendon.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/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/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
#include <pxr/usd/usd/typed.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCTENDON //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsTendon
|
||||
///
|
||||
/// Type describing fixed and spatial tendons.
|
||||
///
|
||||
/// 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 MjcPhysicsTendon : public UsdTyped {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
|
||||
|
||||
/// Construct a MjcPhysicsTendon on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsTendon::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsTendon(const UsdPrim& prim = UsdPrim()) : UsdTyped(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsTendon on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsTendon(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsTendon(const UsdSchemaBase& schemaObj)
|
||||
: UsdTyped(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsTendon();
|
||||
|
||||
/// 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 MjcPhysicsTendon 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
|
||||
/// MjcPhysicsTendon(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsTendon Get(const UsdStagePtr& stage, const SdfPath& path);
|
||||
|
||||
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
|
||||
/// is defined (according to UsdPrim::IsDefined()) on this stage.
|
||||
///
|
||||
/// If a prim adhering to this schema at \p path is already defined on this
|
||||
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
|
||||
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
|
||||
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
|
||||
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
|
||||
/// current EditTarget for any nonexistent, or existing but not \a Defined
|
||||
/// ancestors.
|
||||
///
|
||||
/// The given \a path must be an absolute prim path that does not contain
|
||||
/// any variant selections.
|
||||
///
|
||||
/// If it is impossible to author any of the necessary PrimSpecs, (for
|
||||
/// example, in case \a path cannot map to the current UsdEditTarget's
|
||||
/// namespace) issue an error and return an invalid \a UsdPrim.
|
||||
///
|
||||
/// Note that this method may return a defined prim whose typeName does not
|
||||
/// specify this schema class, in case a stronger typeName opinion overrides
|
||||
/// the opinion at the current EditTarget.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsTendon Define(const UsdStagePtr& stage, const SdfPath& path);
|
||||
|
||||
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:
|
||||
// --------------------------------------------------------------------- //
|
||||
// TYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Type of tendon, valid values are 'spatial' and 'fixed'.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:type = "spatial"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | spatial, fixed |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetTypeAttr() const;
|
||||
|
||||
/// See GetTypeAttr(), 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 CreateTypeAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSIDESITESINDICES
|
||||
// --------------------------------------------------------------------- //
|
||||
/// For spatial tendons, if mjc:sideSites has targets then index 'i' in this
|
||||
/// list represents the position in the relationship targets of mjc:sideSites
|
||||
/// that the geom at index 'i' in mjc:path uses as a side site. It is
|
||||
/// considered an authoring error to assign a side site to something other
|
||||
/// than a geom. Geoms that do not use a side site should use index value
|
||||
/// '-1'.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int[] mjc:sideSites:indices = []` |
|
||||
/// | C++ Type | VtArray<int> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->IntArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSideSitesIndicesAttr() const;
|
||||
|
||||
/// See GetMjcSideSitesIndicesAttr(), 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 CreateMjcSideSitesIndicesAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCPATHSEGMENTS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// For spatial tendons, this holds the index of the segment each tendon path
|
||||
/// wrap point belongs to.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int[] mjc:path:segments = []` |
|
||||
/// | C++ Type | VtArray<int> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->IntArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcPathSegmentsAttr() const;
|
||||
|
||||
/// See GetMjcPathSegmentsAttr(), 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 CreateMjcPathSegmentsAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCPATHDIVISORS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// For spatial tendons, this represents an indexed array of divisors. A
|
||||
/// tendon path segments' length contribution to the overall tendon length is
|
||||
/// divided by its divisor.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:path:divisors = []` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcPathDivisorsAttr() const;
|
||||
|
||||
/// See GetMjcPathDivisorsAttr(), 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 CreateMjcPathDivisorsAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCPATHCOEF
|
||||
// --------------------------------------------------------------------- //
|
||||
/// For fixed tendons passing through joints this represents a multiplicative
|
||||
/// factor on the position or angle of the targeted joint.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:path:coef = []` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcPathCoefAttr() const;
|
||||
|
||||
/// See GetMjcPathCoefAttr(), 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 CreateMjcPathCoefAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GROUP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Integer MuJoCo group to which the tendon belongs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:group = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGroupAttr() const;
|
||||
|
||||
/// See GetGroupAttr(), 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 CreateGroupAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// LIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the tendon length is limited to the range specified by
|
||||
/// mjc:range:min/max.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:limited = "auto"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | auto, true, false |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetLimitedAttr() const;
|
||||
|
||||
/// See GetLimitedAttr(), 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 CreateLimitedAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// ACTUATORFRCLIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// This attribute specifies whether actuator forces acting on the tendon
|
||||
/// should be clamped. See Force limits for details. This attribute interacts
|
||||
/// with the actuatorfrcrange attribute. If this attribute is “false”,
|
||||
/// actuator force clamping is disabled. If it is “true”, actuator force
|
||||
/// clamping is enabled. If this attribute is “auto”, and autolimits is set in
|
||||
/// compiler, actuator force clamping will be enabled if actuatorfrcrange is
|
||||
/// defined.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:actuatorfrclimited = "auto"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | false, true, auto |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetActuatorFrcLimitedAttr() const;
|
||||
|
||||
/// See GetActuatorFrcLimitedAttr(), 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 CreateActuatorFrcLimitedAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// RANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum allowed tendon length. Setting this attribute without specifying
|
||||
/// limited is an error, unless autolimits is set in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:range:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetRangeMinAttr() const;
|
||||
|
||||
/// See GetRangeMinAttr(), 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 CreateRangeMinAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// RANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum allowed tendon length. Setting this attribute without specifying
|
||||
/// limited is an error, unless autolimits is set in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:range:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetRangeMaxAttr() const;
|
||||
|
||||
/// See GetRangeMaxAttr(), 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 CreateRangeMaxAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// ACTUATORFRCRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping total actuator forces acting on this tendon.
|
||||
/// See Force limits for details. The compiler expects the lower bound to be
|
||||
/// nonpositive. Setting this attribute without specifying actuatorfrclimited
|
||||
/// is an error if compiler-autolimits is “false”.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actuatorfrcrange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetActuatorFrcRangeMinAttr() const;
|
||||
|
||||
/// See GetActuatorFrcRangeMinAttr(), 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 CreateActuatorFrcRangeMinAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// ACTUATORFRCRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping total actuator forces acting on this tendon.
|
||||
/// See Force limits for details. The compiler expects the upper bound to be
|
||||
/// nonnegative. Setting this attribute without specifying actuatorfrclimited
|
||||
/// is an error if compiler-autolimits is “false”.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actuatorfrcrange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetActuatorFrcRangeMaxAttr() const;
|
||||
|
||||
/// See GetActuatorFrcRangeMaxAttr(), 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 CreateActuatorFrcRangeMaxAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLREFLIMIT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating tendon limits.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solreflimit = [0.02, 1]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolRefLimitAttr() const;
|
||||
|
||||
/// See GetSolRefLimitAttr(), 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 CreateSolRefLimitAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLIMPLIMIT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating tendon limits.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solimplimit = [0.9, 0.95, 0.001,
|
||||
/// 0.5, 2]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type"
|
||||
/// | SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolImpLimitAttr() const;
|
||||
|
||||
/// See GetSolImpLimitAttr(), 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 CreateSolImpLimitAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLREFFRICTION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating dry friction in the tendon.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solreffriction = [0.02, 1]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolRefFrictionAttr() const;
|
||||
|
||||
/// See GetSolRefFrictionAttr(), 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 CreateSolRefFrictionAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLIMPFRICTION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating dry friction in the tendon.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solimpfriction = [0.9, 0.95, 0.001,
|
||||
/// 0.5, 2]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type"
|
||||
/// | SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolImpFrictionAttr() const;
|
||||
|
||||
/// See GetSolImpFrictionAttr(), 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 CreateSolImpFrictionAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MARGIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The limit constraint becomes active when the absolute value of the
|
||||
/// difference between the tendon length and either limit of the specified
|
||||
/// range falls below this margin. Similar to contacts, the margin parameter
|
||||
/// is subtracted from the difference between the range limit and the tendon
|
||||
/// length. The resulting constraint distance is always negative when the
|
||||
/// constraint is active. This quantity is used to compute constraint
|
||||
/// impedance as a function of distance.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:margin = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMarginAttr() const;
|
||||
|
||||
/// See GetMarginAttr(), 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 CreateMarginAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// FRICTIONLOSS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Friction loss caused by dry friction. To enable friction loss, set this
|
||||
/// attribute to a positive value.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:frictionloss = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetFrictionLossAttr() const;
|
||||
|
||||
/// See GetFrictionLossAttr(), 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 CreateFrictionLossAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// WIDTH
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Radius of the cross-section area of the spatial tendon, used for rendering
|
||||
/// in MuJoCo. Parts of the tendon that wrap around geom obstacles are
|
||||
/// rendered with reduced width.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:width = 0.003` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetWidthAttr() const;
|
||||
|
||||
/// See GetWidthAttr(), 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 CreateWidthAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// RGBA
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Color and transparency of the tendon in MuJoCo.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform color4f mjc:rgba = (0.5, 0.5, 0.5, 1)` |
|
||||
/// | C++ Type | GfVec4f |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Color4f |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetRgbaAttr() const;
|
||||
|
||||
/// See GetRgbaAttr(), 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 CreateRgbaAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SPRINGLENGTH
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Spring resting position, can take either one or two values. If one value
|
||||
/// is given, it corresponds to the length of the tendon at rest. If it is -1,
|
||||
/// the tendon resting length is determined from the model reference
|
||||
/// configuration in mjModel.qpos0. Note that the default value of -1, which
|
||||
/// invokes the automatic length computation, was designed with spatial
|
||||
/// tendons in mind, which can only have nonegative length. In order to set
|
||||
/// the springlength of a fixed tendon to -1, use a nearby value like
|
||||
/// -0.99999. If two non-decreasing values are given, they define a dead-band
|
||||
/// range. If the tendon length is between the two values, the force is 0. If
|
||||
/// it is outside this range, the force behaves like a regular spring, with
|
||||
/// the rest-point corresponding to the nearest springlength value. A deadband
|
||||
/// can be used to define tendons whose limits are enforced by springs rather
|
||||
/// than constraints.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:springlength = [-1, -1]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSpringLengthAttr() const;
|
||||
|
||||
/// See GetSpringLengthAttr(), 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 CreateSpringLengthAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// STIFFNESS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Stiffness coefficient. A positive value generates a spring force (linear
|
||||
/// in position) acting along the tendon.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:stiffness = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetStiffnessAttr() const;
|
||||
|
||||
/// See GetStiffnessAttr(), 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 CreateStiffnessAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// DAMPING
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Damping coefficient. A positive value generates a damping force (linear in
|
||||
/// velocity) acting along the tendon. Unlike joint damping which is
|
||||
/// integrated implicitly by the Euler method, tendon damping is not
|
||||
/// integrated implicitly, thus joint damping should be used if possible.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:damping = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetDampingAttr() const;
|
||||
|
||||
/// See GetDampingAttr(), 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 CreateDampingAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// ARMATURE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Inertia associated with changes in tendon length.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:armature = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetArmatureAttr() const;
|
||||
|
||||
/// See GetArmatureAttr(), 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 CreateArmatureAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCPATH
|
||||
// --------------------------------------------------------------------- //
|
||||
/// For spatial tendons, this describes a list of sites and geoms the tendon
|
||||
/// wraps. For fixed tendons, this is instead a list of joints.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcPathRel() const;
|
||||
|
||||
/// See GetMjcPathRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcPathRel() const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSIDESITES
|
||||
// --------------------------------------------------------------------- //
|
||||
/// For spatial tendons, a geom wrapped by the tendon may specify which side
|
||||
/// of the geom the tendon wraps around via a site prim. This is a list of
|
||||
/// sites that are used as side sites in mjc:path.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcSideSitesRel() const;
|
||||
|
||||
/// See GetMjcSideSitesRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcSideSitesRel() 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
|
||||
@@ -65,8 +65,10 @@ struct MjcPhysicsTokensType {
|
||||
/// MjcPhysicsActuator::GetMjcActLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsActuator::GetMjcCtrlLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsActuator::GetMjcForceLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr(), This token represents
|
||||
/// the auto constraint Jacobian and matrices computed from it.
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsTendon::GetActuatorFrcLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsTendon::GetLimitedAttr(), This token represents the auto
|
||||
/// constraint Jacobian and matrices computed from it.
|
||||
const TfToken auto_;
|
||||
/// \brief "cg"
|
||||
///
|
||||
@@ -106,7 +108,9 @@ struct MjcPhysicsTokensType {
|
||||
/// value for MjcPhysicsActuator::GetMjcActLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcCtrlLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcForceLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr()
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr(), Possible value for
|
||||
/// MjcPhysicsTendon::GetActuatorFrcLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsTendon::GetLimitedAttr()
|
||||
const TfToken false_;
|
||||
/// \brief "filter"
|
||||
///
|
||||
@@ -118,7 +122,8 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken filterexact;
|
||||
/// \brief "fixed"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsActuator::GetMjcGainTypeAttr()
|
||||
/// Fallback value for MjcPhysicsActuator::GetMjcGainTypeAttr(), Possible
|
||||
/// value for MjcPhysicsTendon::GetTypeAttr()
|
||||
const TfToken fixed;
|
||||
/// \brief "implicit"
|
||||
///
|
||||
@@ -164,15 +169,15 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken mjcActRangeMin;
|
||||
/// \brief "mjc:actuatorfrclimited"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcActuatorfrclimited;
|
||||
/// \brief "mjc:actuatorfrcrange:max"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcActuatorfrcrangeMax;
|
||||
/// \brief "mjc:actuatorfrcrange:min"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcActuatorfrcrangeMin;
|
||||
/// \brief "mjc:actuatorgravcomp"
|
||||
///
|
||||
@@ -180,7 +185,7 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken mjcActuatorgravcomp;
|
||||
/// \brief "mjc:armature"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcArmature;
|
||||
/// \brief "mjc:biasPrm"
|
||||
///
|
||||
@@ -272,7 +277,7 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken mjcCtrlRangeMin;
|
||||
/// \brief "mjc:damping"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcDamping;
|
||||
/// \brief "mjc:dynPrm"
|
||||
///
|
||||
@@ -392,7 +397,7 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken mjcForceRangeMin;
|
||||
/// \brief "mjc:frictionloss"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcFrictionloss;
|
||||
/// \brief "mjc:gainPrm"
|
||||
///
|
||||
@@ -413,7 +418,7 @@ struct MjcPhysicsTokensType {
|
||||
/// \brief "mjc:group"
|
||||
///
|
||||
/// MjcPhysicsSiteAPI, MjcPhysicsImageableAPI, MjcPhysicsCollisionAPI,
|
||||
/// MjcPhysicsActuator, MjcPhysicsJointAPI
|
||||
/// MjcPhysicsActuator, MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcGroup;
|
||||
/// \brief "mjc:inertia"
|
||||
///
|
||||
@@ -435,9 +440,13 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcLengthRangeMin;
|
||||
/// \brief "mjc:limited"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcLimited;
|
||||
/// \brief "mjc:margin"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI, MjcPhysicsJointAPI
|
||||
/// MjcPhysicsCollisionAPI, MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcMargin;
|
||||
/// \brief "mjc:maxhullvert"
|
||||
///
|
||||
@@ -551,6 +560,22 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionWind;
|
||||
/// \brief "mjc:path"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcPath;
|
||||
/// \brief "mjc:path:coef"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcPathCoef;
|
||||
/// \brief "mjc:path:divisors"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcPathDivisors;
|
||||
/// \brief "mjc:path:segments"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcPathSegments;
|
||||
/// \brief "mjc:priority"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
@@ -563,6 +588,14 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcQvel;
|
||||
/// \brief "mjc:range:max"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcRangeMax;
|
||||
/// \brief "mjc:range:min"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcRangeMin;
|
||||
/// \brief "mjc:ref"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
@@ -571,6 +604,10 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcRefSite;
|
||||
/// \brief "mjc:rgba"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcRgba;
|
||||
/// \brief "mjc:rollingfriction"
|
||||
///
|
||||
/// MjcPhysicsMaterialAPI
|
||||
@@ -579,6 +616,14 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcShellinertia;
|
||||
/// \brief "mjc:sideSites"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcSideSites;
|
||||
/// \brief "mjc:sideSites:indices"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcSideSitesIndices;
|
||||
/// \brief "mjc:sliderSite"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
@@ -589,11 +634,11 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken mjcSolimp;
|
||||
/// \brief "mjc:solimpfriction"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcSolimpfriction;
|
||||
/// \brief "mjc:solimplimit"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcSolimplimit;
|
||||
/// \brief "mjc:solmix"
|
||||
///
|
||||
@@ -605,23 +650,27 @@ struct MjcPhysicsTokensType {
|
||||
const TfToken mjcSolref;
|
||||
/// \brief "mjc:solreffriction"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcSolreffriction;
|
||||
/// \brief "mjc:solreflimit"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcSolreflimit;
|
||||
/// \brief "mjc:springdamper"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSpringdamper;
|
||||
/// \brief "mjc:springlength"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcSpringlength;
|
||||
/// \brief "mjc:springref"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSpringref;
|
||||
/// \brief "mjc:stiffness"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
/// MjcPhysicsJointAPI, MjcPhysicsTendon
|
||||
const TfToken mjcStiffness;
|
||||
/// \brief "mjc:target"
|
||||
///
|
||||
@@ -631,6 +680,14 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsMaterialAPI
|
||||
const TfToken mjcTorsionalfriction;
|
||||
/// \brief "mjc:type"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcType;
|
||||
/// \brief "mjc:width"
|
||||
///
|
||||
/// MjcPhysicsTendon
|
||||
const TfToken mjcWidth;
|
||||
/// \brief "muscle"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcBiasTypeAttr(), Possible
|
||||
@@ -675,13 +732,19 @@ struct MjcPhysicsTokensType {
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token
|
||||
/// represents the sparse constraint Jacobian and matrices computed from it.
|
||||
const TfToken sparse;
|
||||
/// \brief "spatial"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsTendon::GetTypeAttr()
|
||||
const TfToken spatial;
|
||||
/// \brief "true"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetInertiaFromGeomAttr(), Possible
|
||||
/// value for MjcPhysicsActuator::GetMjcActLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcCtrlLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcForceLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr()
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr(), Possible value for
|
||||
/// MjcPhysicsTendon::GetActuatorFrcLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsTendon::GetLimitedAttr()
|
||||
const TfToken true_;
|
||||
/// \brief "user"
|
||||
///
|
||||
@@ -725,6 +788,10 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsSiteAPI
|
||||
const TfToken MjcSiteAPI;
|
||||
/// \brief "MjcTendon"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsTendon
|
||||
const TfToken MjcTendon;
|
||||
/// A vector of all of the tokens listed above.
|
||||
const std::vector<TfToken> allTokens;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <mujoco/experimental/usd/mjcPhysics/actuator.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/keyframe.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/siteAPI.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tendon.h>
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
#include <pxr/usd/usd/common.h>
|
||||
@@ -171,6 +172,12 @@ ExtractedPrims ExtractPrims(pxr::UsdStageRefPtr stage) {
|
||||
it.PruneChildren();
|
||||
}
|
||||
|
||||
if (prim.IsA<pxr::MjcPhysicsTendon>()) {
|
||||
root->tendons.push_back(prim_path);
|
||||
// Tendons should not have children of interest.
|
||||
it.PruneChildren();
|
||||
}
|
||||
|
||||
if (prim.IsA<pxr::MjcPhysicsKeyframe>()) {
|
||||
root->keyframes.push_back(prim_path);
|
||||
// Keyframes should not have children.
|
||||
|
||||
@@ -35,6 +35,7 @@ struct Node {
|
||||
std::vector<pxr::SdfPath> visual_gprims;
|
||||
std::vector<pxr::SdfPath> colliders;
|
||||
std::vector<pxr::SdfPath> sites;
|
||||
std::vector<pxr::SdfPath> tendons;
|
||||
std::vector<pxr::SdfPath> keyframes;
|
||||
std::vector<std::unique_ptr<Node>> children;
|
||||
};
|
||||
|
||||
@@ -550,3 +550,110 @@ class "MjcMaterialAPI" (
|
||||
)
|
||||
}
|
||||
|
||||
class MjcTendon "MjcTendon" (
|
||||
doc = "Type describing fixed and spatial tendons."
|
||||
)
|
||||
{
|
||||
uniform token mjc:actuatorfrclimited = "auto" (
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
displayName = "Actuator Force Limited"
|
||||
doc = "This attribute specifies whether actuator forces acting on the tendon should be clamped. See Force limits for details. This attribute interacts with the actuatorfrcrange attribute. If this attribute is “false”, actuator force clamping is disabled. If it is “true”, actuator force clamping is enabled. If this attribute is “auto”, and autolimits is set in compiler, actuator force clamping will be enabled if actuatorfrcrange is defined."
|
||||
)
|
||||
uniform double mjc:actuatorfrcrange:max = 0 (
|
||||
displayName = "Actuator Force Range Max"
|
||||
doc = "Maximum range for clamping total actuator forces acting on this tendon. See Force limits for details. The compiler expects the upper bound to be nonnegative. Setting this attribute without specifying actuatorfrclimited is an error if compiler-autolimits is “false”."
|
||||
)
|
||||
uniform double mjc:actuatorfrcrange:min = 0 (
|
||||
displayName = "Actuator Force Range Min"
|
||||
doc = "Minimum range for clamping total actuator forces acting on this tendon. See Force limits for details. The compiler expects the lower bound to be nonpositive. Setting this attribute without specifying actuatorfrclimited is an error if compiler-autolimits is “false”."
|
||||
)
|
||||
uniform double mjc:armature = 0 (
|
||||
displayName = "Armature"
|
||||
doc = "Inertia associated with changes in tendon length."
|
||||
)
|
||||
uniform double mjc:damping = 0 (
|
||||
displayName = "Damping"
|
||||
doc = "Damping coefficient. A positive value generates a damping force (linear in velocity) acting along the tendon. Unlike joint damping which is integrated implicitly by the Euler method, tendon damping is not integrated implicitly, thus joint damping should be used if possible."
|
||||
)
|
||||
uniform double mjc:frictionloss = 0 (
|
||||
displayName = "Friction Loss"
|
||||
doc = "Friction loss caused by dry friction. To enable friction loss, set this attribute to a positive value."
|
||||
)
|
||||
uniform int mjc:group = 0 (
|
||||
displayName = "Group"
|
||||
doc = "Integer MuJoCo group to which the tendon belongs."
|
||||
)
|
||||
uniform token mjc:limited = "auto" (
|
||||
allowedTokens = ["auto", "true", "false"]
|
||||
displayName = "Limited"
|
||||
doc = "If true, the tendon length is limited to the range specified by mjc:range:min/max."
|
||||
)
|
||||
uniform double mjc:margin = 0 (
|
||||
displayName = "Margin"
|
||||
doc = "The limit constraint becomes active when the absolute value of the difference between the tendon length and either limit of the specified range falls below this margin. Similar to contacts, the margin parameter is subtracted from the difference between the range limit and the tendon length. The resulting constraint distance is always negative when the constraint is active. This quantity is used to compute constraint impedance as a function of distance."
|
||||
)
|
||||
rel mjc:path (
|
||||
doc = "For spatial tendons, this describes a list of sites and geoms the tendon wraps. For fixed tendons, this is instead a list of joints."
|
||||
)
|
||||
uniform double[] mjc:path:coef = [] (
|
||||
doc = "For fixed tendons passing through joints this represents a multiplicative factor on the position or angle of the targeted joint."
|
||||
)
|
||||
uniform double[] mjc:path:divisors = [] (
|
||||
doc = "For spatial tendons, this represents an indexed array of divisors. A tendon path segments' length contribution to the overall tendon length is divided by its divisor."
|
||||
)
|
||||
uniform int[] mjc:path:segments = [] (
|
||||
doc = "For spatial tendons, this holds the index of the segment each tendon path wrap point belongs to."
|
||||
)
|
||||
uniform double mjc:range:max = 0 (
|
||||
displayName = "Range Max"
|
||||
doc = "Maximum allowed tendon length. Setting this attribute without specifying limited is an error, unless autolimits is set in compiler."
|
||||
)
|
||||
uniform double mjc:range:min = 0 (
|
||||
displayName = "Range Min"
|
||||
doc = "Minimum allowed tendon length. Setting this attribute without specifying limited is an error, unless autolimits is set in compiler."
|
||||
)
|
||||
uniform color4f mjc:rgba = (0.5, 0.5, 0.5, 1) (
|
||||
displayName = "RGBA"
|
||||
doc = "Color and transparency of the tendon in MuJoCo."
|
||||
)
|
||||
rel mjc:sideSites (
|
||||
doc = "For spatial tendons, a geom wrapped by the tendon may specify which side of the geom the tendon wraps around via a site prim. This is a list of sites that are used as side sites in mjc:path."
|
||||
)
|
||||
uniform int[] mjc:sideSites:indices = [] (
|
||||
doc = "For spatial tendons, if mjc:sideSites has targets then index 'i' in this list represents the position in the relationship targets of mjc:sideSites that the geom at index 'i' in mjc:path uses as a side site. It is considered an authoring error to assign a side site to something other than a geom. Geoms that do not use a side site should use index value '-1'."
|
||||
)
|
||||
uniform double[] mjc:solimpfriction = [0.9, 0.95, 0.001, 0.5, 2] (
|
||||
displayName = "Solver Impedance Friction"
|
||||
doc = "Constraint solver parameters for simulating dry friction in the tendon."
|
||||
)
|
||||
uniform double[] mjc:solimplimit = [0.9, 0.95, 0.001, 0.5, 2] (
|
||||
displayName = "Solver Impedance Limit"
|
||||
doc = "Constraint solver parameters for simulating tendon limits."
|
||||
)
|
||||
uniform double[] mjc:solreffriction = [0.02, 1] (
|
||||
displayName = "Solver Reference Friction"
|
||||
doc = "Constraint solver parameters for simulating dry friction in the tendon."
|
||||
)
|
||||
uniform double[] mjc:solreflimit = [0.02, 1] (
|
||||
displayName = "Solver Reference Limit"
|
||||
doc = "Constraint solver parameters for simulating tendon limits."
|
||||
)
|
||||
uniform double[] mjc:springlength = [-1, -1] (
|
||||
displayName = "Spring Length"
|
||||
doc = "Spring resting position, can take either one or two values. If one value is given, it corresponds to the length of the tendon at rest. If it is -1, the tendon resting length is determined from the model reference configuration in mjModel.qpos0. Note that the default value of -1, which invokes the automatic length computation, was designed with spatial tendons in mind, which can only have nonegative length. In order to set the springlength of a fixed tendon to -1, use a nearby value like -0.99999. If two non-decreasing values are given, they define a dead-band range. If the tendon length is between the two values, the force is 0. If it is outside this range, the force behaves like a regular spring, with the rest-point corresponding to the nearest springlength value. A deadband can be used to define tendons whose limits are enforced by springs rather than constraints."
|
||||
)
|
||||
uniform double mjc:stiffness = 0 (
|
||||
displayName = "Stiffness"
|
||||
doc = "Stiffness coefficient. A positive value generates a spring force (linear in position) acting along the tendon."
|
||||
)
|
||||
uniform token mjc:type = "spatial" (
|
||||
allowedTokens = ["spatial", "fixed"]
|
||||
displayName = "Type"
|
||||
doc = "Type of tendon, valid values are 'spatial' and 'fixed'."
|
||||
)
|
||||
uniform double mjc:width = 0.003 (
|
||||
displayName = "Width"
|
||||
doc = "Radius of the cross-section area of the spatial tendon, used for rendering in MuJoCo. Parts of the tendon that wrap around geom obstacles are rendered with reduced width."
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,16 @@
|
||||
"UsdAPISchemaBase"
|
||||
],
|
||||
"schemaKind": "singleApplyAPI"
|
||||
},
|
||||
"MjcPhysicsTendon": {
|
||||
"alias": {
|
||||
"UsdSchemaBase": "MjcTendon"
|
||||
},
|
||||
"autoGenerated": true,
|
||||
"bases": [
|
||||
"UsdTyped"
|
||||
],
|
||||
"schemaKind": "concreteTyped"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1056,3 +1056,201 @@ class "MjcMaterialAPI"
|
||||
doc = """Friction value acting around both axes on the contact tangent plane."""
|
||||
)
|
||||
}
|
||||
|
||||
class MjcTendon "MjcTendon"
|
||||
(
|
||||
customData = {
|
||||
string className = "Tendon"
|
||||
}
|
||||
doc = """Type describing fixed and spatial tendons."""
|
||||
|
||||
inherits = </Typed>
|
||||
)
|
||||
{
|
||||
uniform token mjc:type = "spatial" (
|
||||
allowedTokens = ["spatial", "fixed"]
|
||||
customData = {
|
||||
string apiName = "Type"
|
||||
}
|
||||
displayName = "Type"
|
||||
doc = """Type of tendon, valid values are 'spatial' and 'fixed'."""
|
||||
)
|
||||
|
||||
rel mjc:path (
|
||||
doc = "For spatial tendons, this describes a list of sites and geoms the tendon wraps. For fixed tendons, this is instead a list of joints."
|
||||
)
|
||||
|
||||
rel mjc:sideSites (
|
||||
doc = "For spatial tendons, a geom wrapped by the tendon may specify which side of the geom the tendon wraps around via a site prim. This is a list of sites that are used as side sites in mjc:path."
|
||||
)
|
||||
|
||||
uniform int[] mjc:sideSites:indices = [] (
|
||||
doc = "For spatial tendons, if mjc:sideSites has targets then index 'i' in this list represents the position in the relationship targets of mjc:sideSites that the geom at index 'i' in mjc:path uses as a side site. It is considered an authoring error to assign a side site to something other than a geom. Geoms that do not use a side site should use index value '-1'."
|
||||
)
|
||||
|
||||
uniform int[] mjc:path:segments = [] (
|
||||
doc = "For spatial tendons, this holds the index of the segment each tendon path wrap point belongs to."
|
||||
)
|
||||
|
||||
uniform double[] mjc:path:divisors = [] (
|
||||
doc = "For spatial tendons, this represents an indexed array of divisors. A tendon path segments' length contribution to the overall tendon length is divided by its divisor."
|
||||
)
|
||||
|
||||
uniform double[] mjc:path:coef = [] (
|
||||
doc = "For fixed tendons passing through joints this represents a multiplicative factor on the position or angle of the targeted joint."
|
||||
)
|
||||
|
||||
uniform int mjc:group = 0 (
|
||||
customData = {
|
||||
string apiName = "Group"
|
||||
}
|
||||
displayName = "Group"
|
||||
doc = """Integer MuJoCo group to which the tendon belongs."""
|
||||
)
|
||||
|
||||
uniform token mjc:limited = "auto" (
|
||||
allowedTokens = ["auto", "true", "false"]
|
||||
customData = {
|
||||
string apiName = "Limited"
|
||||
}
|
||||
displayName = "Limited"
|
||||
doc = """If true, the tendon length is limited to the range specified by mjc:range:min/max."""
|
||||
)
|
||||
|
||||
uniform token mjc:actuatorfrclimited = "auto" (
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
customData = {
|
||||
string apiName = "ActuatorFrcLimited"
|
||||
}
|
||||
displayName = "Actuator Force Limited"
|
||||
doc = """This attribute specifies whether actuator forces acting on the tendon should be clamped. See Force limits for details. This attribute interacts with the actuatorfrcrange attribute. If this attribute is “false”, actuator force clamping is disabled. If it is “true”, actuator force clamping is enabled. If this attribute is “auto”, and autolimits is set in compiler, actuator force clamping will be enabled if actuatorfrcrange is defined."""
|
||||
)
|
||||
|
||||
uniform double mjc:range:min = 0 (
|
||||
customData = {
|
||||
string apiName = "RangeMin"
|
||||
}
|
||||
displayName = "Range Min"
|
||||
doc = """Minimum allowed tendon length. Setting this attribute without specifying limited is an error, unless autolimits is set in compiler."""
|
||||
)
|
||||
|
||||
uniform double mjc:range:max = 0 (
|
||||
customData = {
|
||||
string apiName = "RangeMax"
|
||||
}
|
||||
displayName = "Range Max"
|
||||
doc = """Maximum allowed tendon length. Setting this attribute without specifying limited is an error, unless autolimits is set in compiler."""
|
||||
)
|
||||
|
||||
uniform double mjc:actuatorfrcrange:min = 0 (
|
||||
customData = {
|
||||
string apiName = "ActuatorFrcRangeMin"
|
||||
}
|
||||
displayName = "Actuator Force Range Min"
|
||||
doc = """Minimum range for clamping total actuator forces acting on this tendon. See Force limits for details. The compiler expects the lower bound to be nonpositive. Setting this attribute without specifying actuatorfrclimited is an error if compiler-autolimits is “false”."""
|
||||
)
|
||||
|
||||
uniform double mjc:actuatorfrcrange:max = 0 (
|
||||
customData = {
|
||||
string apiName = "ActuatorFrcRangeMax"
|
||||
}
|
||||
displayName = "Actuator Force Range Max"
|
||||
doc = """Maximum range for clamping total actuator forces acting on this tendon. See Force limits for details. The compiler expects the upper bound to be nonnegative. Setting this attribute without specifying actuatorfrclimited is an error if compiler-autolimits is “false”."""
|
||||
)
|
||||
|
||||
uniform double[] mjc:solreflimit = [0.02, 1.0] (
|
||||
customData = {
|
||||
string apiName = "SolRefLimit"
|
||||
}
|
||||
displayName = "Solver Reference Limit"
|
||||
doc = """Constraint solver parameters for simulating tendon limits."""
|
||||
)
|
||||
|
||||
uniform double[] mjc:solimplimit = [0.9, 0.95, 0.001, 0.5, 2.0] (
|
||||
customData = {
|
||||
string apiName = "SolImpLimit"
|
||||
}
|
||||
displayName = "Solver Impedance Limit"
|
||||
doc = """Constraint solver parameters for simulating tendon limits."""
|
||||
)
|
||||
|
||||
uniform double[] mjc:solreffriction = [0.02, 1.0] (
|
||||
customData = {
|
||||
string apiName = "SolRefFriction"
|
||||
}
|
||||
displayName = "Solver Reference Friction"
|
||||
doc = """Constraint solver parameters for simulating dry friction in the tendon."""
|
||||
)
|
||||
|
||||
uniform double[] mjc:solimpfriction = [0.9, 0.95, 0.001, 0.5, 2.0] (
|
||||
customData = {
|
||||
string apiName = "SolImpFriction"
|
||||
}
|
||||
displayName = "Solver Impedance Friction"
|
||||
doc = """Constraint solver parameters for simulating dry friction in the tendon."""
|
||||
)
|
||||
|
||||
uniform double mjc:margin = 0.0 (
|
||||
customData = {
|
||||
string apiName = "Margin"
|
||||
}
|
||||
displayName = "Margin"
|
||||
doc = """The limit constraint becomes active when the absolute value of the difference between the tendon length and either limit of the specified range falls below this margin. Similar to contacts, the margin parameter is subtracted from the difference between the range limit and the tendon length. The resulting constraint distance is always negative when the constraint is active. This quantity is used to compute constraint impedance as a function of distance."""
|
||||
)
|
||||
|
||||
uniform double mjc:frictionloss = 0.0 (
|
||||
customData = {
|
||||
string apiName = "FrictionLoss"
|
||||
}
|
||||
displayName = "Friction Loss"
|
||||
doc = """Friction loss caused by dry friction. To enable friction loss, set this attribute to a positive value."""
|
||||
)
|
||||
|
||||
uniform double mjc:width = 0.003 (
|
||||
customData = {
|
||||
string apiName = "Width"
|
||||
}
|
||||
displayName = "Width"
|
||||
doc = """Radius of the cross-section area of the spatial tendon, used for rendering in MuJoCo. Parts of the tendon that wrap around geom obstacles are rendered with reduced width."""
|
||||
)
|
||||
|
||||
uniform color4f mjc:rgba = (0.5, 0.5, 0.5, 1.0) (
|
||||
customData = {
|
||||
string apiName = "Rgba"
|
||||
}
|
||||
displayName = "RGBA"
|
||||
doc = """Color and transparency of the tendon in MuJoCo."""
|
||||
)
|
||||
|
||||
uniform double[] mjc:springlength = [-1, -1] (
|
||||
customData = {
|
||||
string apiName = "SpringLength"
|
||||
}
|
||||
displayName = "Spring Length"
|
||||
doc = """Spring resting position, can take either one or two values. If one value is given, it corresponds to the length of the tendon at rest. If it is -1, the tendon resting length is determined from the model reference configuration in mjModel.qpos0. Note that the default value of -1, which invokes the automatic length computation, was designed with spatial tendons in mind, which can only have nonegative length. In order to set the springlength of a fixed tendon to -1, use a nearby value like -0.99999. If two non-decreasing values are given, they define a dead-band range. If the tendon length is between the two values, the force is 0. If it is outside this range, the force behaves like a regular spring, with the rest-point corresponding to the nearest springlength value. A deadband can be used to define tendons whose limits are enforced by springs rather than constraints."""
|
||||
)
|
||||
|
||||
uniform double mjc:stiffness = 0.0 (
|
||||
customData = {
|
||||
string apiName = "Stiffness"
|
||||
}
|
||||
displayName = "Stiffness"
|
||||
doc = """Stiffness coefficient. A positive value generates a spring force (linear in position) acting along the tendon."""
|
||||
)
|
||||
|
||||
uniform double mjc:damping = 0.0 (
|
||||
customData = {
|
||||
string apiName = "Damping"
|
||||
}
|
||||
displayName = "Damping"
|
||||
doc = """Damping coefficient. A positive value generates a damping force (linear in velocity) acting along the tendon. Unlike joint damping which is integrated implicitly by the Euler method, tendon damping is not integrated implicitly, thus joint damping should be used if possible."""
|
||||
)
|
||||
|
||||
uniform double mjc:armature = 0.0 (
|
||||
customData = {
|
||||
string apiName = "Armature"
|
||||
}
|
||||
displayName = "Armature"
|
||||
doc = """Inertia associated with changes in tendon length."""
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
// 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 <mujoco/experimental/usd/mjcPhysics/tendon.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<MjcPhysicsTendon, TfType::Bases<UsdTyped> >();
|
||||
|
||||
// Register the usd prim typename as an alias under UsdSchemaBase. This
|
||||
// enables one to call
|
||||
// TfType::Find<UsdSchemaBase>().FindDerivedByName("MjcTendon")
|
||||
// to find TfType<MjcPhysicsTendon>, which is how IsA queries are
|
||||
// answered.
|
||||
TfType::AddAlias<UsdSchemaBase, MjcPhysicsTendon>("MjcTendon");
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
MjcPhysicsTendon::~MjcPhysicsTendon() {}
|
||||
|
||||
/* static */
|
||||
MjcPhysicsTendon MjcPhysicsTendon::Get(const UsdStagePtr& stage,
|
||||
const SdfPath& path) {
|
||||
if (!stage) {
|
||||
TF_CODING_ERROR("Invalid stage");
|
||||
return MjcPhysicsTendon();
|
||||
}
|
||||
return MjcPhysicsTendon(stage->GetPrimAtPath(path));
|
||||
}
|
||||
|
||||
/* static */
|
||||
MjcPhysicsTendon MjcPhysicsTendon::Define(const UsdStagePtr& stage,
|
||||
const SdfPath& path) {
|
||||
static TfToken usdPrimTypeName("MjcTendon");
|
||||
if (!stage) {
|
||||
TF_CODING_ERROR("Invalid stage");
|
||||
return MjcPhysicsTendon();
|
||||
}
|
||||
return MjcPhysicsTendon(stage->DefinePrim(path, usdPrimTypeName));
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
UsdSchemaKind MjcPhysicsTendon::_GetSchemaKind() const {
|
||||
return MjcPhysicsTendon::schemaKind;
|
||||
}
|
||||
|
||||
/* static */
|
||||
const TfType& MjcPhysicsTendon::_GetStaticTfType() {
|
||||
static TfType tfType = TfType::Find<MjcPhysicsTendon>();
|
||||
return tfType;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool MjcPhysicsTendon::_IsTypedSchema() {
|
||||
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
|
||||
return isTyped;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
const TfType& MjcPhysicsTendon::_GetTfType() const {
|
||||
return _GetStaticTfType();
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetTypeAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcType);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateTypeAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcType, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetMjcSideSitesIndicesAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcSideSitesIndices);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateMjcSideSitesIndicesAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcSideSitesIndices, SdfValueTypeNames->IntArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetMjcPathSegmentsAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPathSegments);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateMjcPathSegmentsAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcPathSegments, SdfValueTypeNames->IntArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetMjcPathDivisorsAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPathDivisors);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateMjcPathDivisorsAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcPathDivisors, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetMjcPathCoefAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcPathCoef);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateMjcPathCoefAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcPathCoef, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetGroupAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcGroup);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateGroupAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcGroup, SdfValueTypeNames->Int,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetLimitedAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcLimited);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateLimitedAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcLimited, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetActuatorFrcLimitedAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActuatorfrclimited);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateActuatorFrcLimitedAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActuatorfrclimited, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetRangeMinAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcRangeMin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateRangeMinAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcRangeMin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetRangeMaxAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcRangeMax);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateRangeMaxAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcRangeMax, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetActuatorFrcRangeMinAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActuatorfrcrangeMin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateActuatorFrcRangeMinAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActuatorfrcrangeMin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetActuatorFrcRangeMaxAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActuatorfrcrangeMax);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateActuatorFrcRangeMaxAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActuatorfrcrangeMax, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetSolRefLimitAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcSolreflimit);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateSolRefLimitAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcSolreflimit, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetSolImpLimitAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcSolimplimit);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateSolImpLimitAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcSolimplimit, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetSolRefFrictionAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcSolreffriction);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateSolRefFrictionAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcSolreffriction, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetSolImpFrictionAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcSolimpfriction);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateSolImpFrictionAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcSolimpfriction, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetMarginAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcMargin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateMarginAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcMargin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetFrictionLossAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcFrictionloss);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateFrictionLossAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcFrictionloss, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetWidthAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcWidth);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateWidthAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcWidth, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetRgbaAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcRgba);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateRgbaAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcRgba, SdfValueTypeNames->Color4f,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetSpringLengthAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcSpringlength);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateSpringLengthAttr(
|
||||
VtValue const& defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcSpringlength, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetStiffnessAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcStiffness);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateStiffnessAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcStiffness, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetDampingAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcDamping);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateDampingAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcDamping, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::GetArmatureAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcArmature);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsTendon::CreateArmatureAttr(VtValue const& defaultValue,
|
||||
bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcArmature, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsTendon::GetMjcPathRel() const {
|
||||
return GetPrim().GetRelationship(MjcPhysicsTokens->mjcPath);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsTendon::CreateMjcPathRel() const {
|
||||
return GetPrim().CreateRelationship(MjcPhysicsTokens->mjcPath,
|
||||
/* custom = */ false);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsTendon::GetMjcSideSitesRel() const {
|
||||
return GetPrim().GetRelationship(MjcPhysicsTokens->mjcSideSites);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsTendon::CreateMjcSideSitesRel() const {
|
||||
return GetPrim().CreateRelationship(MjcPhysicsTokens->mjcSideSites,
|
||||
/* custom = */ false);
|
||||
}
|
||||
|
||||
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& MjcPhysicsTendon::GetSchemaAttributeNames(
|
||||
bool includeInherited) {
|
||||
static TfTokenVector localNames = {
|
||||
MjcPhysicsTokens->mjcType,
|
||||
MjcPhysicsTokens->mjcSideSitesIndices,
|
||||
MjcPhysicsTokens->mjcPathSegments,
|
||||
MjcPhysicsTokens->mjcPathDivisors,
|
||||
MjcPhysicsTokens->mjcPathCoef,
|
||||
MjcPhysicsTokens->mjcGroup,
|
||||
MjcPhysicsTokens->mjcLimited,
|
||||
MjcPhysicsTokens->mjcActuatorfrclimited,
|
||||
MjcPhysicsTokens->mjcRangeMin,
|
||||
MjcPhysicsTokens->mjcRangeMax,
|
||||
MjcPhysicsTokens->mjcActuatorfrcrangeMin,
|
||||
MjcPhysicsTokens->mjcActuatorfrcrangeMax,
|
||||
MjcPhysicsTokens->mjcSolreflimit,
|
||||
MjcPhysicsTokens->mjcSolimplimit,
|
||||
MjcPhysicsTokens->mjcSolreffriction,
|
||||
MjcPhysicsTokens->mjcSolimpfriction,
|
||||
MjcPhysicsTokens->mjcMargin,
|
||||
MjcPhysicsTokens->mjcFrictionloss,
|
||||
MjcPhysicsTokens->mjcWidth,
|
||||
MjcPhysicsTokens->mjcRgba,
|
||||
MjcPhysicsTokens->mjcSpringlength,
|
||||
MjcPhysicsTokens->mjcStiffness,
|
||||
MjcPhysicsTokens->mjcDamping,
|
||||
MjcPhysicsTokens->mjcArmature,
|
||||
};
|
||||
static TfTokenVector allNames = _ConcatenateAttributeNames(
|
||||
UsdTyped::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)--
|
||||
@@ -112,6 +112,7 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcJointInParent("mjc:jointInParent", TfToken::Immortal),
|
||||
mjcLengthRangeMax("mjc:lengthRange:max", TfToken::Immortal),
|
||||
mjcLengthRangeMin("mjc:lengthRange:min", TfToken::Immortal),
|
||||
mjcLimited("mjc:limited", TfToken::Immortal),
|
||||
mjcMargin("mjc:margin", TfToken::Immortal),
|
||||
mjcMaxhullvert("mjc:maxhullvert", TfToken::Immortal),
|
||||
mjcMpos("mjc:mpos", TfToken::Immortal),
|
||||
@@ -144,13 +145,22 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcOptionTolerance("mjc:option:tolerance", TfToken::Immortal),
|
||||
mjcOptionViscosity("mjc:option:viscosity", TfToken::Immortal),
|
||||
mjcOptionWind("mjc:option:wind", TfToken::Immortal),
|
||||
mjcPath("mjc:path", TfToken::Immortal),
|
||||
mjcPathCoef("mjc:path:coef", TfToken::Immortal),
|
||||
mjcPathDivisors("mjc:path:divisors", TfToken::Immortal),
|
||||
mjcPathSegments("mjc:path:segments", TfToken::Immortal),
|
||||
mjcPriority("mjc:priority", TfToken::Immortal),
|
||||
mjcQpos("mjc:qpos", TfToken::Immortal),
|
||||
mjcQvel("mjc:qvel", TfToken::Immortal),
|
||||
mjcRangeMax("mjc:range:max", TfToken::Immortal),
|
||||
mjcRangeMin("mjc:range:min", TfToken::Immortal),
|
||||
mjcRef("mjc:ref", TfToken::Immortal),
|
||||
mjcRefSite("mjc:refSite", TfToken::Immortal),
|
||||
mjcRgba("mjc:rgba", TfToken::Immortal),
|
||||
mjcRollingfriction("mjc:rollingfriction", TfToken::Immortal),
|
||||
mjcShellinertia("mjc:shellinertia", TfToken::Immortal),
|
||||
mjcSideSites("mjc:sideSites", TfToken::Immortal),
|
||||
mjcSideSitesIndices("mjc:sideSites:indices", TfToken::Immortal),
|
||||
mjcSliderSite("mjc:sliderSite", TfToken::Immortal),
|
||||
mjcSolimp("mjc:solimp", TfToken::Immortal),
|
||||
mjcSolimpfriction("mjc:solimpfriction", TfToken::Immortal),
|
||||
@@ -160,10 +170,13 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcSolreffriction("mjc:solreffriction", TfToken::Immortal),
|
||||
mjcSolreflimit("mjc:solreflimit", TfToken::Immortal),
|
||||
mjcSpringdamper("mjc:springdamper", TfToken::Immortal),
|
||||
mjcSpringlength("mjc:springlength", TfToken::Immortal),
|
||||
mjcSpringref("mjc:springref", TfToken::Immortal),
|
||||
mjcStiffness("mjc:stiffness", TfToken::Immortal),
|
||||
mjcTarget("mjc:target", TfToken::Immortal),
|
||||
mjcTorsionalfriction("mjc:torsionalfriction", TfToken::Immortal),
|
||||
mjcType("mjc:type", TfToken::Immortal),
|
||||
mjcWidth("mjc:width", TfToken::Immortal),
|
||||
muscle("muscle", TfToken::Immortal),
|
||||
newton("newton", TfToken::Immortal),
|
||||
none("none", TfToken::Immortal),
|
||||
@@ -173,6 +186,7 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
rk4("rk4", TfToken::Immortal),
|
||||
shell("shell", TfToken::Immortal),
|
||||
sparse("sparse", TfToken::Immortal),
|
||||
spatial("spatial", TfToken::Immortal),
|
||||
true_("true", TfToken::Immortal),
|
||||
user("user", TfToken::Immortal),
|
||||
MjcActuator("MjcActuator", TfToken::Immortal),
|
||||
@@ -184,6 +198,7 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
MjcMeshCollisionAPI("MjcMeshCollisionAPI", TfToken::Immortal),
|
||||
MjcSceneAPI("MjcSceneAPI", TfToken::Immortal),
|
||||
MjcSiteAPI("MjcSiteAPI", TfToken::Immortal),
|
||||
MjcTendon("MjcTendon", TfToken::Immortal),
|
||||
allTokens({affine,
|
||||
auto_,
|
||||
cg,
|
||||
@@ -275,6 +290,7 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcJointInParent,
|
||||
mjcLengthRangeMax,
|
||||
mjcLengthRangeMin,
|
||||
mjcLimited,
|
||||
mjcMargin,
|
||||
mjcMaxhullvert,
|
||||
mjcMpos,
|
||||
@@ -304,13 +320,22 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcOptionTolerance,
|
||||
mjcOptionViscosity,
|
||||
mjcOptionWind,
|
||||
mjcPath,
|
||||
mjcPathCoef,
|
||||
mjcPathDivisors,
|
||||
mjcPathSegments,
|
||||
mjcPriority,
|
||||
mjcQpos,
|
||||
mjcQvel,
|
||||
mjcRangeMax,
|
||||
mjcRangeMin,
|
||||
mjcRef,
|
||||
mjcRefSite,
|
||||
mjcRgba,
|
||||
mjcRollingfriction,
|
||||
mjcShellinertia,
|
||||
mjcSideSites,
|
||||
mjcSideSitesIndices,
|
||||
mjcSliderSite,
|
||||
mjcSolimp,
|
||||
mjcSolimpfriction,
|
||||
@@ -320,10 +345,13 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcSolreffriction,
|
||||
mjcSolreflimit,
|
||||
mjcSpringdamper,
|
||||
mjcSpringlength,
|
||||
mjcSpringref,
|
||||
mjcStiffness,
|
||||
mjcTarget,
|
||||
mjcTorsionalfriction,
|
||||
mjcType,
|
||||
mjcWidth,
|
||||
muscle,
|
||||
newton,
|
||||
none,
|
||||
@@ -333,6 +361,7 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
rk4,
|
||||
shell,
|
||||
sparse,
|
||||
spatial,
|
||||
true_,
|
||||
user,
|
||||
MjcActuator,
|
||||
@@ -343,7 +372,8 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
MjcMaterialAPI,
|
||||
MjcMeshCollisionAPI,
|
||||
MjcSceneAPI,
|
||||
MjcSiteAPI}) {}
|
||||
MjcSiteAPI,
|
||||
MjcTendon}) {}
|
||||
|
||||
TfStaticData<MjcPhysicsTokensType> MjcPhysicsTokens;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
@@ -29,6 +30,7 @@
|
||||
#include <mujoco/experimental/usd/mjcPhysics/meshCollisionAPI.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/sceneAPI.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/siteAPI.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tendon.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <mujoco/experimental/usd/usd.h>
|
||||
#include <mujoco/experimental/usd/utils.h>
|
||||
@@ -919,6 +921,300 @@ void ParseMjcPhysicsMeshCollisionAPI(
|
||||
}
|
||||
}
|
||||
|
||||
void ParseMjcPhysicsTendon(mjSpec* spec,
|
||||
const pxr::MjcPhysicsTendon& tendon) {
|
||||
pxr::UsdPrim prim = tendon.GetPrim();
|
||||
pxr::UsdStageRefPtr stage = prim.GetStage();
|
||||
mjsTendon* mj_tendon = mjs_addTendon(spec, nullptr);
|
||||
mjs_setName(mj_tendon->element, prim.GetPath().GetAsString().c_str());
|
||||
|
||||
pxr::TfToken type;
|
||||
tendon.GetTypeAttr().Get(&type);
|
||||
|
||||
pxr::SdfPathVector wrap_targets;
|
||||
tendon.GetMjcPathRel().GetTargets(&wrap_targets);
|
||||
|
||||
pxr::SdfPathVector side_site_paths;
|
||||
tendon.GetMjcSideSitesRel().GetTargets(&side_site_paths);
|
||||
|
||||
pxr::VtIntArray side_site_indices;
|
||||
tendon.GetMjcSideSitesIndicesAttr().Get(&side_site_indices);
|
||||
|
||||
pxr::VtIntArray segments;
|
||||
tendon.GetMjcPathSegmentsAttr().Get(&segments);
|
||||
|
||||
pxr::VtDoubleArray divisors;
|
||||
tendon.GetMjcPathDivisorsAttr().Get(&divisors);
|
||||
|
||||
pxr::VtDoubleArray coefs;
|
||||
tendon.GetMjcPathCoefAttr().Get(&coefs);
|
||||
|
||||
if (type == MjcPhysicsTokens->spatial) {
|
||||
// Check that for N targets we have 0 or N elements in segments.
|
||||
if (!segments.empty() && segments.size() != wrap_targets.size()) {
|
||||
mju_warning(
|
||||
"Spatial tendon %s has %lu segments but %lu wrap targets, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), segments.size(),
|
||||
wrap_targets.size());
|
||||
return;
|
||||
}
|
||||
// Check that if we have >1 segments that the user has specified how much each segment
|
||||
// contributes to the total segment length.
|
||||
if (!segments.empty() && divisors.empty()) {
|
||||
mju_warning(
|
||||
"Spatial tendon %s has >1 segments (%d) but does not specify divisors, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), *std::max_element(segments.begin(), segments.end()) + 1);
|
||||
return;
|
||||
}
|
||||
// Check that if we side site indices that we have N of them.
|
||||
if (!side_site_indices.empty() && side_site_indices.size() != wrap_targets.size()) {
|
||||
mju_warning(
|
||||
"Spatial tendon %s has %lu sideSite indices but %lu wrap targets, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), side_site_indices.size(), wrap_targets.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!side_site_indices.empty() && side_site_paths.empty()) {
|
||||
mju_warning(
|
||||
"Spatial tendon %s has %lu sideSite indices but no side sites, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), side_site_indices.size());
|
||||
return;
|
||||
}
|
||||
} else { // Fixed tendon.
|
||||
// Check that for N targets we have 0 or N elements in coef:
|
||||
if (!coefs.empty() && coefs.size() != wrap_targets.size()) {
|
||||
mju_warning(
|
||||
"Spatial tendon %s has %lu coefs but %lu wrap targets, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), coefs.size(), wrap_targets.size());
|
||||
}
|
||||
}
|
||||
|
||||
int last_segment = 0;
|
||||
for (int i = 0; i < wrap_targets.size(); ++i) {
|
||||
auto wrap_target = wrap_targets[i];
|
||||
auto wrap_prim = stage->GetPrimAtPath(wrap_target);
|
||||
// Important to check site before Imageable here because some Imageable prims are sites.
|
||||
|
||||
if (!segments.empty()) {
|
||||
int segment = segments[i];
|
||||
if (segment >= divisors.size()) {
|
||||
mju_warning("Tendon %s has at least %d segments but only %lu divisors, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), segment + 1, divisors.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if (segment > last_segment) {
|
||||
mjsWrap* pulley_wrap = mjs_wrapPulley(mj_tendon, divisors[segment]);
|
||||
mjs_setString(pulley_wrap->info, ("Pulley between segments: " +
|
||||
std::to_string(last_segment) + " and " +
|
||||
std::to_string(segment)).c_str());
|
||||
}
|
||||
last_segment = segment;
|
||||
}
|
||||
|
||||
mjsWrap* wrap = nullptr;
|
||||
if (wrap_prim.HasAPI<pxr::MjcPhysicsSiteAPI>()) {
|
||||
wrap = mjs_wrapSite(mj_tendon, wrap_target.GetAsString().c_str());
|
||||
} else if (wrap_prim.IsA<pxr::UsdPhysicsJoint>()) {
|
||||
double coef = 1.0;
|
||||
if (!coefs.empty()) {
|
||||
coef = coefs[i];
|
||||
}
|
||||
wrap = mjs_wrapJoint(mj_tendon, wrap_target.GetAsString().c_str(), coef);
|
||||
} else if (wrap_prim.IsA<pxr::UsdGeomImageable>()) {
|
||||
std::string side_site_name = "";
|
||||
if (!side_site_indices.empty()) {
|
||||
int side_site_index = side_site_indices[i];
|
||||
if (side_site_index >= side_site_paths.size()) {
|
||||
mju_warning("Tendon %s has side site index %d but only %lu side sites, skipping.",
|
||||
prim.GetPath().GetAsString().c_str(), side_site_index, side_site_paths.size());
|
||||
return;
|
||||
}
|
||||
side_site_name = side_site_paths[side_site_index].GetAsString();
|
||||
}
|
||||
wrap = mjs_wrapGeom(mj_tendon, wrap_target.GetAsString().c_str(), side_site_name.c_str());
|
||||
} else {
|
||||
mju_warning("Tendon %s has an invalid wrap target type, skipping.",
|
||||
prim.GetPath().GetAsString().c_str());
|
||||
return;
|
||||
}
|
||||
mjs_setString(mj_tendon->info, ("Prim: " + wrap_target.GetAsString()).c_str());
|
||||
}
|
||||
|
||||
auto group_attr = tendon.GetGroupAttr();
|
||||
if (group_attr.HasAuthoredValue()) {
|
||||
group_attr.Get(&mj_tendon->group);
|
||||
}
|
||||
|
||||
auto limited_attr = tendon.GetLimitedAttr();
|
||||
if (limited_attr.HasAuthoredValue()) {
|
||||
pxr::TfToken limited;
|
||||
limited_attr.Get(&limited);
|
||||
if (limited == MjcPhysicsTokens->true_) {
|
||||
mj_tendon->limited = mjLIMITED_TRUE;
|
||||
} else if (limited == MjcPhysicsTokens->false_) {
|
||||
mj_tendon->limited = mjLIMITED_FALSE;
|
||||
} else {
|
||||
mj_tendon->limited = mjLIMITED_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
auto actuatorfrclimited_attr = tendon.GetActuatorFrcLimitedAttr();
|
||||
if (actuatorfrclimited_attr.HasAuthoredValue()) {
|
||||
pxr::TfToken actuatorfrclimited;
|
||||
actuatorfrclimited_attr.Get(&actuatorfrclimited);
|
||||
if (actuatorfrclimited == MjcPhysicsTokens->true_) {
|
||||
mj_tendon->actfrclimited = mjLIMITED_TRUE;
|
||||
} else if (actuatorfrclimited == MjcPhysicsTokens->false_) {
|
||||
mj_tendon->actfrclimited = mjLIMITED_FALSE;
|
||||
} else {
|
||||
mj_tendon->actfrclimited = mjLIMITED_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
auto range_min_attr = tendon.GetRangeMinAttr();
|
||||
if (range_min_attr.HasAuthoredValue()) {
|
||||
range_min_attr.Get(&mj_tendon->range[0]);
|
||||
}
|
||||
|
||||
auto range_max_attr = tendon.GetRangeMaxAttr();
|
||||
if (range_max_attr.HasAuthoredValue()) {
|
||||
range_max_attr.Get(&mj_tendon->range[1]);
|
||||
}
|
||||
|
||||
auto actuatorfrcrange_min_attr = tendon.GetActuatorFrcRangeMinAttr();
|
||||
if (actuatorfrcrange_min_attr.HasAuthoredValue()) {
|
||||
actuatorfrcrange_min_attr.Get(&mj_tendon->actfrcrange[0]);
|
||||
}
|
||||
|
||||
auto actuatorfrcrange_max_attr = tendon.GetActuatorFrcRangeMaxAttr();
|
||||
if (actuatorfrcrange_max_attr.HasAuthoredValue()) {
|
||||
actuatorfrcrange_max_attr.Get(&mj_tendon->actfrcrange[1]);
|
||||
}
|
||||
|
||||
auto solreflimit_attr = tendon.GetSolRefLimitAttr();
|
||||
if (solreflimit_attr.HasAuthoredValue()) {
|
||||
pxr::VtDoubleArray solreflimit;
|
||||
solreflimit_attr.Get(&solreflimit);
|
||||
if (solreflimit.size() == mjNREF) {
|
||||
for (int i = 0; i < mjNREF; ++i) {
|
||||
mj_tendon->solref_limit[i] = solreflimit[i];
|
||||
}
|
||||
} else {
|
||||
mju_warning(
|
||||
"solreflimit attribute for tendon %s has incorrect size %zu, "
|
||||
"expected %d.",
|
||||
prim.GetPath().GetAsString().c_str(), solreflimit.size(), mjNREF);
|
||||
}
|
||||
}
|
||||
|
||||
auto solimplimit_attr = tendon.GetSolImpLimitAttr();
|
||||
if (solimplimit_attr.HasAuthoredValue()) {
|
||||
pxr::VtDoubleArray solimplimit;
|
||||
solimplimit_attr.Get(&solimplimit);
|
||||
if (solimplimit.size() == mjNIMP) {
|
||||
for (int i = 0; i < mjNIMP; ++i) {
|
||||
mj_tendon->solimp_limit[i] = solimplimit[i];
|
||||
}
|
||||
} else {
|
||||
mju_warning(
|
||||
"solimplimit attribute for tendon %s has incorrect size %zu, "
|
||||
"expected %d.",
|
||||
prim.GetPath().GetAsString().c_str(), solimplimit.size(), mjNIMP);
|
||||
}
|
||||
}
|
||||
|
||||
auto solreffriction_attr = tendon.GetSolRefFrictionAttr();
|
||||
if (solreffriction_attr.HasAuthoredValue()) {
|
||||
pxr::VtDoubleArray solreffriction;
|
||||
solreffriction_attr.Get(&solreffriction);
|
||||
if (solreffriction.size() == mjNREF) {
|
||||
for (int i = 0; i < mjNREF; ++i) {
|
||||
mj_tendon->solref_friction[i] = solreffriction[i];
|
||||
}
|
||||
} else {
|
||||
mju_warning(
|
||||
"solreffriction attribute for tendon %s has incorrect size %zu, "
|
||||
"expected %d.",
|
||||
prim.GetPath().GetAsString().c_str(), solreffriction.size(), mjNREF);
|
||||
}
|
||||
}
|
||||
|
||||
auto solimpfriction_attr = tendon.GetSolImpFrictionAttr();
|
||||
if (solimpfriction_attr.HasAuthoredValue()) {
|
||||
pxr::VtDoubleArray solimpfriction;
|
||||
solimpfriction_attr.Get(&solimpfriction);
|
||||
if (solimpfriction.size() == mjNIMP) {
|
||||
for (int i = 0; i < mjNIMP; ++i) {
|
||||
mj_tendon->solimp_friction[i] = solimpfriction[i];
|
||||
}
|
||||
} else {
|
||||
mju_warning(
|
||||
"solimpfriction attribute for tendon %s has incorrect size %zu, "
|
||||
"expected %d.",
|
||||
prim.GetPath().GetAsString().c_str(), solimpfriction.size(), mjNIMP);
|
||||
}
|
||||
}
|
||||
|
||||
auto margin_attr = tendon.GetMarginAttr();
|
||||
if (margin_attr.HasAuthoredValue()) {
|
||||
margin_attr.Get(&mj_tendon->margin);
|
||||
}
|
||||
|
||||
auto frictionloss_attr = tendon.GetFrictionLossAttr();
|
||||
if (frictionloss_attr.HasAuthoredValue()) {
|
||||
frictionloss_attr.Get(&mj_tendon->frictionloss);
|
||||
}
|
||||
|
||||
auto width_attr = tendon.GetWidthAttr();
|
||||
if (width_attr.HasAuthoredValue()) {
|
||||
width_attr.Get(&mj_tendon->width);
|
||||
}
|
||||
|
||||
auto rgba_attr = tendon.GetRgbaAttr();
|
||||
if (rgba_attr.HasAuthoredValue()) {
|
||||
pxr::GfVec4f rgba;
|
||||
rgba_attr.Get(&rgba);
|
||||
mj_tendon->rgba[0] = rgba[0];
|
||||
mj_tendon->rgba[1] = rgba[1];
|
||||
mj_tendon->rgba[2] = rgba[2];
|
||||
mj_tendon->rgba[3] = rgba[3];
|
||||
}
|
||||
|
||||
auto springlength_attr = tendon.GetSpringLengthAttr();
|
||||
if (springlength_attr.HasAuthoredValue()) {
|
||||
pxr::VtDoubleArray springlength;
|
||||
springlength_attr.Get(&springlength);
|
||||
if (springlength.size() == 1) {
|
||||
mj_tendon->springlength[0] = springlength[0];
|
||||
mj_tendon->springlength[1] = springlength[0];
|
||||
} else if (springlength.size() == 2) {
|
||||
mj_tendon->springlength[0] = springlength[0];
|
||||
mj_tendon->springlength[1] = springlength[1];
|
||||
} else {
|
||||
mju_warning(
|
||||
"springlength attribute for tendon %s has incorrect size %zu, "
|
||||
"expected 1 or 2.",
|
||||
prim.GetPath().GetAsString().c_str(), springlength.size());
|
||||
}
|
||||
}
|
||||
|
||||
auto stiffness_attr = tendon.GetStiffnessAttr();
|
||||
if (stiffness_attr.HasAuthoredValue()) {
|
||||
stiffness_attr.Get(&mj_tendon->stiffness);
|
||||
}
|
||||
|
||||
auto damping_attr = tendon.GetDampingAttr();
|
||||
if (damping_attr.HasAuthoredValue()) {
|
||||
damping_attr.Get(&mj_tendon->damping);
|
||||
}
|
||||
|
||||
auto armature_attr = tendon.GetArmatureAttr();
|
||||
if (armature_attr.HasAuthoredValue()) {
|
||||
armature_attr.Get(&mj_tendon->armature);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseMjcPhysicsActuator(mjSpec* spec,
|
||||
const pxr::MjcPhysicsActuator& tran) {
|
||||
pxr::UsdPrim prim = tran.GetPrim();
|
||||
@@ -1797,6 +2093,13 @@ mjSpec* mj_parseUSDStage(const pxr::UsdStageRefPtr stage) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!root->tendons.empty()) {
|
||||
for (const auto& tendon : root->tendons) {
|
||||
mujoco::usd::ParseMjcPhysicsTendon(
|
||||
spec, pxr::MjcPhysicsTendon::Get(stage, tendon));
|
||||
}
|
||||
}
|
||||
|
||||
// Set of caches to use for all queries when parsing.
|
||||
mujoco::usd::UsdCaches caches;
|
||||
// Then populate the kinematic tree.
|
||||
|
||||
Reference in New Issue
Block a user