Add support for actuators to Mujoco USD interop.
PiperOrigin-RevId: 764740692 Change-Id: Ib045653fee840087bc3891ee7e770bdaac08548c
This commit is contained in:
committed by
Copybara-Service
parent
6b919162d1
commit
b2e8589e7a
@@ -0,0 +1,391 @@
|
||||
// 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 "./actuatorAPI.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<MjcPhysicsActuatorAPI, TfType::Bases<UsdAPISchemaBase> >();
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
MjcPhysicsActuatorAPI::~MjcPhysicsActuatorAPI() {}
|
||||
|
||||
/* static */
|
||||
MjcPhysicsActuatorAPI MjcPhysicsActuatorAPI::Get(const UsdStagePtr &stage,
|
||||
const SdfPath &path) {
|
||||
if (!stage) {
|
||||
TF_CODING_ERROR("Invalid stage");
|
||||
return MjcPhysicsActuatorAPI();
|
||||
}
|
||||
return MjcPhysicsActuatorAPI(stage->GetPrimAtPath(path));
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
UsdSchemaKind MjcPhysicsActuatorAPI::_GetSchemaKind() const {
|
||||
return MjcPhysicsActuatorAPI::schemaKind;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool MjcPhysicsActuatorAPI::CanApply(const UsdPrim &prim, std::string *whyNot) {
|
||||
return prim.CanApplyAPI<MjcPhysicsActuatorAPI>(whyNot);
|
||||
}
|
||||
|
||||
/* static */
|
||||
MjcPhysicsActuatorAPI MjcPhysicsActuatorAPI::Apply(const UsdPrim &prim) {
|
||||
if (prim.ApplyAPI<MjcPhysicsActuatorAPI>()) {
|
||||
return MjcPhysicsActuatorAPI(prim);
|
||||
}
|
||||
return MjcPhysicsActuatorAPI();
|
||||
}
|
||||
|
||||
/* static */
|
||||
const TfType &MjcPhysicsActuatorAPI::_GetStaticTfType() {
|
||||
static TfType tfType = TfType::Find<MjcPhysicsActuatorAPI>();
|
||||
return tfType;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool MjcPhysicsActuatorAPI::_IsTypedSchema() {
|
||||
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
|
||||
return isTyped;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
const TfType &MjcPhysicsActuatorAPI::_GetTfType() const {
|
||||
return _GetStaticTfType();
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcCtrlLimitedAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcCtrlLimited);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcCtrlLimitedAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcCtrlLimited, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcForceLimitedAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcForceLimited);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcForceLimitedAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcForceLimited, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcActLimitedAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActLimited);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcActLimitedAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActLimited, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcCtrlRangeMinAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcCtrlRangeMin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcCtrlRangeMinAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcCtrlRangeMin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcCtrlRangeMaxAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcCtrlRangeMax);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcCtrlRangeMaxAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcCtrlRangeMax, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcForceRangeMinAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcForceRangeMin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcForceRangeMinAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcForceRangeMin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcForceRangeMaxAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcForceRangeMax);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcForceRangeMaxAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcForceRangeMax, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcActRangeMinAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActRangeMin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcActRangeMinAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActRangeMin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcActRangeMaxAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActRangeMax);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcActRangeMaxAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActRangeMax, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcLengthRangeMinAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcLengthRangeMin);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcLengthRangeMinAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcLengthRangeMin, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcLengthRangeMaxAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcLengthRangeMax);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcLengthRangeMaxAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcLengthRangeMax, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcGearAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcGear);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcGearAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcGear, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcCrankLengthAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcCrankLength);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcCrankLengthAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcCrankLength, SdfValueTypeNames->Double,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcJointInParentAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcJointInParent);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcJointInParentAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcJointInParent, SdfValueTypeNames->Bool,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcActDimAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActDim);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcActDimAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActDim, SdfValueTypeNames->Int,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcDynTypeAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcDynType);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcDynTypeAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcDynType, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcGainTypeAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcGainType);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcGainTypeAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcGainType, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcBiasTypeAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcBiasType);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcBiasTypeAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcBiasType, SdfValueTypeNames->Token,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcDynPrmAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcDynPrm);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcDynPrmAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcDynPrm, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcGainPrmAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcGainPrm);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcGainPrmAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcGainPrm, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcBiasPrmAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcBiasPrm);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcBiasPrmAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcBiasPrm, SdfValueTypeNames->DoubleArray,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::GetMjcActEarlyAttr() const {
|
||||
return GetPrim().GetAttribute(MjcPhysicsTokens->mjcActEarly);
|
||||
}
|
||||
|
||||
UsdAttribute MjcPhysicsActuatorAPI::CreateMjcActEarlyAttr(
|
||||
VtValue const &defaultValue, bool writeSparsely) const {
|
||||
return UsdSchemaBase::_CreateAttr(
|
||||
MjcPhysicsTokens->mjcActEarly, SdfValueTypeNames->Bool,
|
||||
/* custom = */ false, SdfVariabilityUniform, defaultValue, writeSparsely);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsActuatorAPI::GetMjcRefSiteRel() const {
|
||||
return GetPrim().GetRelationship(MjcPhysicsTokens->mjcRefSite);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsActuatorAPI::CreateMjcRefSiteRel() const {
|
||||
return GetPrim().CreateRelationship(MjcPhysicsTokens->mjcRefSite,
|
||||
/* custom = */ false);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsActuatorAPI::GetMjcCrankSiteRel() const {
|
||||
return GetPrim().GetRelationship(MjcPhysicsTokens->mjcCrankSite);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsActuatorAPI::CreateMjcCrankSiteRel() const {
|
||||
return GetPrim().CreateRelationship(MjcPhysicsTokens->mjcCrankSite,
|
||||
/* custom = */ false);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsActuatorAPI::GetMjcSliderSiteRel() const {
|
||||
return GetPrim().GetRelationship(MjcPhysicsTokens->mjcSliderSite);
|
||||
}
|
||||
|
||||
UsdRelationship MjcPhysicsActuatorAPI::CreateMjcSliderSiteRel() const {
|
||||
return GetPrim().CreateRelationship(MjcPhysicsTokens->mjcSliderSite,
|
||||
/* 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 &MjcPhysicsActuatorAPI::GetSchemaAttributeNames(
|
||||
bool includeInherited) {
|
||||
static TfTokenVector localNames = {
|
||||
MjcPhysicsTokens->mjcCtrlLimited, MjcPhysicsTokens->mjcForceLimited,
|
||||
MjcPhysicsTokens->mjcActLimited, MjcPhysicsTokens->mjcCtrlRangeMin,
|
||||
MjcPhysicsTokens->mjcCtrlRangeMax, MjcPhysicsTokens->mjcForceRangeMin,
|
||||
MjcPhysicsTokens->mjcForceRangeMax, MjcPhysicsTokens->mjcActRangeMin,
|
||||
MjcPhysicsTokens->mjcActRangeMax, MjcPhysicsTokens->mjcLengthRangeMin,
|
||||
MjcPhysicsTokens->mjcLengthRangeMax, MjcPhysicsTokens->mjcGear,
|
||||
MjcPhysicsTokens->mjcCrankLength, MjcPhysicsTokens->mjcJointInParent,
|
||||
MjcPhysicsTokens->mjcActDim, MjcPhysicsTokens->mjcDynType,
|
||||
MjcPhysicsTokens->mjcGainType, MjcPhysicsTokens->mjcBiasType,
|
||||
MjcPhysicsTokens->mjcDynPrm, MjcPhysicsTokens->mjcGainPrm,
|
||||
MjcPhysicsTokens->mjcBiasPrm, MjcPhysicsTokens->mjcActEarly,
|
||||
};
|
||||
static TfTokenVector allNames = _ConcatenateAttributeNames(
|
||||
UsdAPISchemaBase::GetSchemaAttributeNames(true), localNames);
|
||||
|
||||
if (includeInherited)
|
||||
return allNames;
|
||||
else
|
||||
return localNames;
|
||||
}
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line. It will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to wrap code in the appropriate delimiters:
|
||||
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
@@ -0,0 +1,828 @@
|
||||
// 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_ACTUATORAPI_H
|
||||
#define MJCPHYSICS_GENERATED_ACTUATORAPI_H
|
||||
|
||||
/// \file mjcPhysics/actuatorAPI.h
|
||||
|
||||
#include "./api.h"
|
||||
#include "./tokens.h"
|
||||
#include "pxr/base/gf/matrix4d.h"
|
||||
#include "pxr/base/gf/vec3d.h"
|
||||
#include "pxr/base/gf/vec3f.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/tf/type.h"
|
||||
#include "pxr/base/vt/value.h"
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usd/apiSchemaBase.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// PHYSICSACTUATORAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsActuatorAPI
|
||||
///
|
||||
/// API describing a Mujoco actuator.
|
||||
///
|
||||
/// 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 MjcPhysicsActuatorAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsActuatorAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsActuatorAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsActuatorAPI(const UsdPrim &prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsActuatorAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsActuatorAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsActuatorAPI(const UsdSchemaBase &schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsActuatorAPI();
|
||||
|
||||
/// 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 MjcPhysicsActuatorAPI 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
|
||||
/// MjcPhysicsActuatorAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsActuatorAPI Get(const UsdStagePtr &stage,
|
||||
const SdfPath &path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim &prim, std::string *whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "PhysicsActuatorAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsActuatorAPI object is returned upon success.
|
||||
/// An invalid (or empty) MjcPhysicsActuatorAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsActuatorAPI Apply(const UsdPrim &prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType &_GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType &_GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRLLIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the control input to this actuator is automatically clamped to
|
||||
/// ctrlrange at runtime. If false, control input clamping is disabled. If
|
||||
/// 'auto' and autolimits is set in compiler, control clamping will
|
||||
/// automatically be set to true if ctrlrange is defined without explicitly
|
||||
/// setting this attribute to 'true'. Note that control input clamping can
|
||||
/// also be globally disabled with the clampctrl attribute of option/flag.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:ctrlLimited = "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 GetMjcCtrlLimitedAttr() const;
|
||||
|
||||
/// See GetMjcCtrlLimitedAttr(), 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 CreateMjcCtrlLimitedAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFORCELIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the force output of this actuator is automatically clamped to
|
||||
/// forcerange at runtime. If false, force clamping is disabled. If 'auto' and
|
||||
/// autolimits is set in compiler, force clamping will automatically be set to
|
||||
/// true if forcerange is defined without explicitly setting this attribute to
|
||||
/// 'true'.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:forceLimited = "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 GetMjcForceLimitedAttr() const;
|
||||
|
||||
/// See GetMjcForceLimitedAttr(), 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 CreateMjcForceLimitedAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTLIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the internal state (activation) associated with this actuator is
|
||||
/// automatically clamped to actrange at runtime. If false, activation
|
||||
/// clamping is disabled. If 'auto' and autolimits is set in compiler,
|
||||
/// activation clamping will automatically be set to true if actrange is
|
||||
/// defined without explicitly setting this attribute to 'true'. See the
|
||||
/// Activation clamping section for more details.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:actLimited = "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 GetMjcActLimitedAttr() const;
|
||||
|
||||
/// See GetMjcActLimitedAttr(), 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 CreateMjcActLimitedAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRLRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping the control input. The first value must be
|
||||
/// smaller than the second value. Setting this attribute without specifying
|
||||
/// ctrllimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:ctrlRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCtrlRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcCtrlRangeMinAttr(), 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 CreateMjcCtrlRangeMinAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRLRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping the control input. The first value must be
|
||||
/// smaller than the second value. Setting this attribute without specifying
|
||||
/// ctrllimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:ctrlRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCtrlRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcCtrlRangeMaxAttr(), 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 CreateMjcCtrlRangeMaxAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFORCERANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping the force output. The first value must be no
|
||||
/// greater than the second value. Setting this attribute without specifying
|
||||
/// forcelimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:forceRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcForceRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcForceRangeMinAttr(), 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 CreateMjcForceRangeMinAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFORCERANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping the force output. The first value must be no
|
||||
/// greater than the second value. Setting this attribute without specifying
|
||||
/// forcelimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:forceRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcForceRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcForceRangeMaxAttr(), 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 CreateMjcForceRangeMaxAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping the activation state. The first value must be
|
||||
/// no greater than the second value. See the Activation clamping section for
|
||||
/// more details. Setting this attribute without specifying actlimited is an
|
||||
/// error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcActRangeMinAttr(), 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 CreateMjcActRangeMinAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping the activation state. The first value must be
|
||||
/// no greater than the second value. See the Activation clamping section for
|
||||
/// more details. Setting this attribute without specifying actlimited is an
|
||||
/// error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcActRangeMaxAttr(), 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 CreateMjcActRangeMaxAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCLENGTHRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range of feasible lengths of the actuator’s transmission.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:lengthRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcLengthRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcLengthRangeMinAttr(), 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 CreateMjcLengthRangeMinAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCLENGTHRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range of feasible lengths of the actuator’s transmission.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:lengthRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcLengthRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcLengthRangeMaxAttr(), 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 CreateMjcLengthRangeMaxAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCGEAR
|
||||
// --------------------------------------------------------------------- //
|
||||
/// This attribute scales the length (and consequently moment arms, velocity
|
||||
/// and force) of the actuator, for all transmission types. It is different
|
||||
/// from the gain in the force generation mechanism, because the gain only
|
||||
/// scales the force output and does not affect the length, moment arms and
|
||||
/// velocity. For actuators with scalar transmission, only the first element
|
||||
/// of this vector is used. The remaining elements are needed for joint,
|
||||
/// jointinparent and site transmissions where this attribute is used to
|
||||
/// specify 3D force and torque axes.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:gear = [1, 0, 0, 0, 0, 0]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcGearAttr() const;
|
||||
|
||||
/// See GetMjcGearAttr(), 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 CreateMjcGearAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCRANKLENGTH
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Used only for the slider-crank transmission type. Specifies the length of
|
||||
/// the connecting rod. The compiler expects this value to be positive when a
|
||||
/// slider-crank transmission is present.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:crankLength = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCrankLengthAttr() const;
|
||||
|
||||
/// See GetMjcCrankLengthAttr(), 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 CreateMjcCrankLengthAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCJOINTINPARENT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true and applied to ball and free joints, the 3d rotation axis given by
|
||||
/// gear is defined in the parent frame (which is the world frame for free
|
||||
/// joints) rather than the child frame.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform bool mjc:jointInParent = 0` |
|
||||
/// | C++ Type | bool |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcJointInParentAttr() const;
|
||||
|
||||
/// See GetMjcJointInParentAttr(), 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 CreateMjcJointInParentAttr(
|
||||
VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTDIM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Dimension of the activation state. The default value of -1 instructs the
|
||||
/// compiler to set the dimension according to the dyntype. Values larger than
|
||||
/// 1 are only allowed for user-defined activation dynamics, as native types
|
||||
/// require dimensions of only 0 or 1. For activation dimensions bigger than
|
||||
/// 1, the last element is used to generate force.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:actDim = -1` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActDimAttr() const;
|
||||
|
||||
/// See GetMjcActDimAttr(), 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 CreateMjcActDimAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCDYNTYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Activation dynamics type for the actuator. The available dynamics types
|
||||
/// were already described in the Actuation model section.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:dynType = "none"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | none, integrator, filter,
|
||||
/// filterexact, muscle, user |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcDynTypeAttr() const;
|
||||
|
||||
/// See GetMjcDynTypeAttr(), 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 CreateMjcDynTypeAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCGAINTYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The gain and bias together determine the output of the force generation
|
||||
/// mechanism, which is currently assumed to be affine.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:gainType = "fixed"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | fixed, affine, muscle, user |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcGainTypeAttr() const;
|
||||
|
||||
/// See GetMjcGainTypeAttr(), 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 CreateMjcGainTypeAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCBIASTYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The gain and bias together determine the output of the force generation
|
||||
/// mechanism, which is currently assumed to be affine.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:biasType = "none"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | none, affine, muscle, user |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcBiasTypeAttr() const;
|
||||
|
||||
/// See GetMjcBiasTypeAttr(), 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 CreateMjcBiasTypeAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCDYNPRM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Activation dynamics parameters. The built-in activation types (except for
|
||||
/// muscle) use only the first parameter, but we provide additional parameters
|
||||
/// in case user callbacks implement a more elaborate model. The length of
|
||||
/// this array is not enforced by the parser, so the user can enter as many
|
||||
/// parameters as needed. These defaults are not compatible with muscle
|
||||
/// actuators.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:dynPrm = [1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/// 0]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcDynPrmAttr() const;
|
||||
|
||||
/// See GetMjcDynPrmAttr(), 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 CreateMjcDynPrmAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCGAINPRM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Gain parameters. The built-in gain types (except for muscle) use only the
|
||||
/// first parameter, but we provide additional parameters in case user
|
||||
/// callbacks implement a more elaborate model. The length of this array is
|
||||
/// not enforced by the parser, so the user can enter as many parameters as
|
||||
/// needed. These defaults are not compatible with muscle actuators.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:gainPrm = [1, 0, 0, 0, 0, 0, 0, 0,
|
||||
/// 0, 0]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcGainPrmAttr() const;
|
||||
|
||||
/// See GetMjcGainPrmAttr(), 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 CreateMjcGainPrmAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCBIASPRM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Bias parameters. The affine bias type uses three parameters. The length of
|
||||
/// this array is not enforced by the parser, so the user can enter as many
|
||||
/// parameters as needed. These defaults are not compatible with muscle
|
||||
/// actuators.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:biasPrm = [0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/// 0, 0]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcBiasPrmAttr() const;
|
||||
|
||||
/// See GetMjcBiasPrmAttr(), 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 CreateMjcBiasPrmAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTEARLY
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, force computation will use the next value of the activation
|
||||
/// variable rather than the current one. Setting this flag reduces the delay
|
||||
/// between the control and accelerations by one time-step.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform bool mjc:actEarly = 0` |
|
||||
/// | C++ Type | bool |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActEarlyAttr() const;
|
||||
|
||||
/// See GetMjcActEarlyAttr(), 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 CreateMjcActEarlyAttr(VtValue const &defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCREFSITE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// When applied to a site, measure the translation and rotation w.r.t the
|
||||
/// frame of the refsite. In this case the actuator does have length and
|
||||
/// position actuators can be used to directly control an end effector, see
|
||||
/// refsite.xml example model. As above, the length is the dot product of the
|
||||
/// gear vector and the frame difference. So gear='0 1 0 0 0 0' means
|
||||
/// 'Y-offset of site in the refsite frame', while gear='0 0 0 0 0 1' means
|
||||
/// rotation 'Z- rotation of site in the refsite frame'. It is recommended to
|
||||
/// use a normalized gear vector with nonzeros in only the first 3 or the last
|
||||
/// 3 elements of gear, so the actuator length will be in either length units
|
||||
/// or radians, respectively. As with ball joints (see joint above), for
|
||||
/// rotations which exceed a total angle of pi will wrap around, so tighter
|
||||
/// limits are recommended.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcRefSiteRel() const;
|
||||
|
||||
/// See GetMjcRefSiteRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcRefSiteRel() const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCRANKSITE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If specified, the actuator acts on a slider-crank mechanism which is
|
||||
/// implicitly determined by the actuator (i.e., it is not a separate model
|
||||
/// element). The target site corresponds to the pin joining the crank and the
|
||||
/// connecting rod.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcCrankSiteRel() const;
|
||||
|
||||
/// See GetMjcCrankSiteRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcCrankSiteRel() const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSLIDERSITE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Used only for the slider-crank transmission type. The target site is the
|
||||
/// pin joining the slider and the connecting rod. The slider moves along the
|
||||
/// z-axis of the slidersite frame. Therefore the site should be oriented as
|
||||
/// needed when it is defined in the kinematic tree; its orientation cannot be
|
||||
/// changed in the actuator definition.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcSliderSiteRel() const;
|
||||
|
||||
/// See GetMjcSliderSiteRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcSliderSiteRel() 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
|
||||
@@ -247,3 +247,90 @@ class "MeshCollisionAPI" (
|
||||
)
|
||||
}
|
||||
|
||||
class "PhysicsActuatorAPI" (
|
||||
doc = "API describing a Mujoco actuator."
|
||||
)
|
||||
{
|
||||
uniform int mjc:actDim = -1 (
|
||||
doc = "Dimension of the activation state. The default value of -1 instructs the compiler to set the dimension according to the dyntype. Values larger than 1 are only allowed for user-defined activation dynamics, as native types require dimensions of only 0 or 1. For activation dimensions bigger than 1, the last element is used to generate force."
|
||||
)
|
||||
uniform bool mjc:actEarly = 0 (
|
||||
doc = "If true, force computation will use the next value of the activation variable rather than the current one. Setting this flag reduces the delay between the control and accelerations by one time-step."
|
||||
)
|
||||
uniform token mjc:actLimited = "auto" (
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
doc = "If true, the internal state (activation) associated with this actuator is automatically clamped to actrange at runtime. If false, activation clamping is disabled. If 'auto' and autolimits is set in compiler, activation clamping will automatically be set to true if actrange is defined without explicitly setting this attribute to 'true'. See the Activation clamping section for more details."
|
||||
)
|
||||
uniform double mjc:actRange:max = 0 (
|
||||
doc = "Maximum range for clamping the activation state. The first value must be no greater than the second value. See the Activation clamping section for more details. Setting this attribute without specifying actlimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
uniform double mjc:actRange:min = 0 (
|
||||
doc = "Minimum range for clamping the activation state. The first value must be no greater than the second value. See the Activation clamping section for more details. Setting this attribute without specifying actlimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
uniform double[] mjc:biasPrm = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (
|
||||
doc = "Bias parameters. The affine bias type uses three parameters. The length of this array is not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators."
|
||||
)
|
||||
uniform token mjc:biasType = "none" (
|
||||
allowedTokens = ["none", "affine", "muscle", "user"]
|
||||
doc = "The gain and bias together determine the output of the force generation mechanism, which is currently assumed to be affine."
|
||||
)
|
||||
uniform double mjc:crankLength = 0 (
|
||||
doc = "Used only for the slider-crank transmission type. Specifies the length of the connecting rod. The compiler expects this value to be positive when a slider-crank transmission is present."
|
||||
)
|
||||
rel mjc:crankSite (
|
||||
doc = "If specified, the actuator acts on a slider-crank mechanism which is implicitly determined by the actuator (i.e., it is not a separate model element). The target site corresponds to the pin joining the crank and the connecting rod."
|
||||
)
|
||||
uniform token mjc:ctrlLimited = "auto" (
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
doc = "If true, the control input to this actuator is automatically clamped to ctrlrange at runtime. If false, control input clamping is disabled. If 'auto' and autolimits is set in compiler, control clamping will automatically be set to true if ctrlrange is defined without explicitly setting this attribute to 'true'. Note that control input clamping can also be globally disabled with the clampctrl attribute of option/flag."
|
||||
)
|
||||
uniform double mjc:ctrlRange:max = 0 (
|
||||
doc = "Maximum range for clamping the control input. The first value must be smaller than the second value. Setting this attribute without specifying ctrllimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
uniform double mjc:ctrlRange:min = 0 (
|
||||
doc = "Minimum range for clamping the control input. The first value must be smaller than the second value. Setting this attribute without specifying ctrllimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
uniform double[] mjc:dynPrm = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (
|
||||
doc = "Activation dynamics parameters. The built-in activation types (except for muscle) use only the first parameter, but we provide additional parameters in case user callbacks implement a more elaborate model. The length of this array is not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators."
|
||||
)
|
||||
uniform token mjc:dynType = "none" (
|
||||
allowedTokens = ["none", "integrator", "filter", "filterexact", "muscle", "user"]
|
||||
doc = "Activation dynamics type for the actuator. The available dynamics types were already described in the Actuation model section."
|
||||
)
|
||||
uniform token mjc:forceLimited = "auto" (
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
doc = "If true, the force output of this actuator is automatically clamped to forcerange at runtime. If false, force clamping is disabled. If 'auto' and autolimits is set in compiler, force clamping will automatically be set to true if forcerange is defined without explicitly setting this attribute to 'true'."
|
||||
)
|
||||
uniform double mjc:forceRange:max = 0 (
|
||||
doc = "Maximum range for clamping the force output. The first value must be no greater than the second value. Setting this attribute without specifying forcelimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
uniform double mjc:forceRange:min = 0 (
|
||||
doc = "Minimum range for clamping the force output. The first value must be no greater than the second value. Setting this attribute without specifying forcelimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
uniform double[] mjc:gainPrm = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (
|
||||
doc = "Gain parameters. The built-in gain types (except for muscle) use only the first parameter, but we provide additional parameters in case user callbacks implement a more elaborate model. The length of this array is not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators."
|
||||
)
|
||||
uniform token mjc:gainType = "fixed" (
|
||||
allowedTokens = ["fixed", "affine", "muscle", "user"]
|
||||
doc = "The gain and bias together determine the output of the force generation mechanism, which is currently assumed to be affine."
|
||||
)
|
||||
uniform double[] mjc:gear = [1, 0, 0, 0, 0, 0] (
|
||||
doc = "This attribute scales the length (and consequently moment arms, velocity and force) of the actuator, for all transmission types. It is different from the gain in the force generation mechanism, because the gain only scales the force output and does not affect the length, moment arms and velocity. For actuators with scalar transmission, only the first element of this vector is used. The remaining elements are needed for joint, jointinparent and site transmissions where this attribute is used to specify 3D force and torque axes."
|
||||
)
|
||||
uniform bool mjc:jointInParent = 0 (
|
||||
doc = "If true and applied to ball and free joints, the 3d rotation axis given by gear is defined in the parent frame (which is the world frame for free joints) rather than the child frame."
|
||||
)
|
||||
uniform double mjc:lengthRange:max = 0 (
|
||||
doc = "Maximum range of feasible lengths of the actuator’s transmission."
|
||||
)
|
||||
uniform double mjc:lengthRange:min = 0 (
|
||||
doc = "Minimum range of feasible lengths of the actuator’s transmission."
|
||||
)
|
||||
rel mjc:refSite (
|
||||
doc = "When applied to a site, measure the translation and rotation w.r.t the frame of the refsite. In this case the actuator does have length and position actuators can be used to directly control an end effector, see refsite.xml example model. As above, the length is the dot product of the gear vector and the frame difference. So gear='0 1 0 0 0 0' means 'Y-offset of site in the refsite frame', while gear='0 0 0 0 0 1' means rotation 'Z- rotation of site in the refsite frame'. It is recommended to use a normalized gear vector with nonzeros in only the first 3 or the last 3 elements of gear, so the actuator length will be in either length units or radians, respectively. As with ball joints (see joint above), for rotations which exceed a total angle of pi will wrap around, so tighter limits are recommended."
|
||||
)
|
||||
rel mjc:sliderSite (
|
||||
doc = "Used only for the slider-crank transmission type. The target site is the pin joining the slider and the connecting rod. The slider moves along the z-axis of the slidersite frame. Therefore the site should be oriented as needed when it is defined in the kinematic tree; its orientation cannot be changed in the actuator definition."
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
{
|
||||
"Info": {
|
||||
"Types": {
|
||||
"MjcPhysicsActuatorAPI": {
|
||||
"alias": {
|
||||
"UsdSchemaBase": "PhysicsActuatorAPI"
|
||||
},
|
||||
"autoGenerated": true,
|
||||
"bases": [
|
||||
"UsdAPISchemaBase"
|
||||
],
|
||||
"schemaKind": "singleApplyAPI"
|
||||
},
|
||||
"MjcPhysicsCollisionAPI": {
|
||||
"alias": {
|
||||
"UsdSchemaBase": "CollisionAPI"
|
||||
|
||||
@@ -548,3 +548,118 @@ class "MeshCollisionAPI"
|
||||
)
|
||||
}
|
||||
|
||||
class "PhysicsActuatorAPI"
|
||||
(
|
||||
customData = {
|
||||
string className = "ActuatorAPI"
|
||||
}
|
||||
doc = """API describing a Mujoco actuator."""
|
||||
|
||||
inherits = </APISchemaBase>
|
||||
)
|
||||
{
|
||||
# Control/Force/Activation Limits
|
||||
uniform token mjc:ctrlLimited = "auto" (
|
||||
doc = "If true, the control input to this actuator is automatically clamped to ctrlrange at runtime. If false, control input clamping is disabled. If 'auto' and autolimits is set in compiler, control clamping will automatically be set to true if ctrlrange is defined without explicitly setting this attribute to 'true'. Note that control input clamping can also be globally disabled with the clampctrl attribute of option/flag."
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
)
|
||||
uniform token mjc:forceLimited = "auto" (
|
||||
doc = "If true, the force output of this actuator is automatically clamped to forcerange at runtime. If false, force clamping is disabled. If 'auto' and autolimits is set in compiler, force clamping will automatically be set to true if forcerange is defined without explicitly setting this attribute to 'true'."
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
)
|
||||
uniform token mjc:actLimited = "auto" (
|
||||
doc = "If true, the internal state (activation) associated with this actuator is automatically clamped to actrange at runtime. If false, activation clamping is disabled. If 'auto' and autolimits is set in compiler, activation clamping will automatically be set to true if actrange is defined without explicitly setting this attribute to 'true'. See the Activation clamping section for more details."
|
||||
allowedTokens = ["false", "true", "auto"]
|
||||
)
|
||||
|
||||
uniform double mjc:ctrlRange:min = 0 (
|
||||
doc = "Minimum range for clamping the control input. The first value must be smaller than the second value. Setting this attribute without specifying ctrllimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
|
||||
uniform double mjc:ctrlRange:max = 0 (
|
||||
doc = "Maximum range for clamping the control input. The first value must be smaller than the second value. Setting this attribute without specifying ctrllimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
|
||||
uniform double mjc:forceRange:min = 0 (
|
||||
doc = "Minimum range for clamping the force output. The first value must be no greater than the second value. Setting this attribute without specifying forcelimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
|
||||
uniform double mjc:forceRange:max = 0 (
|
||||
doc = "Maximum range for clamping the force output. The first value must be no greater than the second value. Setting this attribute without specifying forcelimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
|
||||
uniform double mjc:actRange:min = 0 (
|
||||
doc = "Minimum range for clamping the activation state. The first value must be no greater than the second value. See the Activation clamping section for more details. Setting this attribute without specifying actlimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
|
||||
uniform double mjc:actRange:max = 0 (
|
||||
doc = "Maximum range for clamping the activation state. The first value must be no greater than the second value. See the Activation clamping section for more details. Setting this attribute without specifying actlimited is an error if autolimits is 'false' in compiler."
|
||||
)
|
||||
|
||||
uniform double mjc:lengthRange:min = 0 (
|
||||
doc = "Minimum range of feasible lengths of the actuator’s transmission."
|
||||
)
|
||||
|
||||
uniform double mjc:lengthRange:max = 0 (
|
||||
doc = "Maximum range of feasible lengths of the actuator’s transmission."
|
||||
)
|
||||
|
||||
# Transmission Properties
|
||||
uniform double[] mjc:gear = [1, 0, 0, 0, 0, 0] (
|
||||
doc = "This attribute scales the length (and consequently moment arms, velocity and force) of the actuator, for all transmission types. It is different from the gain in the force generation mechanism, because the gain only scales the force output and does not affect the length, moment arms and velocity. For actuators with scalar transmission, only the first element of this vector is used. The remaining elements are needed for joint, jointinparent and site transmissions where this attribute is used to specify 3D force and torque axes."
|
||||
)
|
||||
|
||||
uniform double mjc:crankLength = 0.0 (
|
||||
doc = "Used only for the slider-crank transmission type. Specifies the length of the connecting rod. The compiler expects this value to be positive when a slider-crank transmission is present."
|
||||
)
|
||||
|
||||
uniform bool mjc:jointInParent = False (
|
||||
doc = "If true and applied to ball and free joints, the 3d rotation axis given by gear is defined in the parent frame (which is the world frame for free joints) rather than the child frame."
|
||||
)
|
||||
|
||||
rel mjc:refSite (
|
||||
doc = "When applied to a site, measure the translation and rotation w.r.t the frame of the refsite. In this case the actuator does have length and position actuators can be used to directly control an end effector, see refsite.xml example model. As above, the length is the dot product of the gear vector and the frame difference. So gear='0 1 0 0 0 0' means 'Y-offset of site in the refsite frame', while gear='0 0 0 0 0 1' means rotation 'Z- rotation of site in the refsite frame'. It is recommended to use a normalized gear vector with nonzeros in only the first 3 or the last 3 elements of gear, so the actuator length will be in either length units or radians, respectively. As with ball joints (see joint above), for rotations which exceed a total angle of pi will wrap around, so tighter limits are recommended."
|
||||
)
|
||||
|
||||
rel mjc:sliderSite (
|
||||
doc = "Used only for the slider-crank transmission type. The target site is the pin joining the slider and the connecting rod. The slider moves along the z-axis of the slidersite frame. Therefore the site should be oriented as needed when it is defined in the kinematic tree; its orientation cannot be changed in the actuator definition."
|
||||
)
|
||||
|
||||
# Activation Dynamics and Force Generation
|
||||
uniform int mjc:actDim = -1 (
|
||||
doc = "Dimension of the activation state. The default value of -1 instructs the compiler to set the dimension according to the dyntype. Values larger than 1 are only allowed for user-defined activation dynamics, as native types require dimensions of only 0 or 1. For activation dimensions bigger than 1, the last element is used to generate force."
|
||||
)
|
||||
|
||||
uniform token mjc:dynType = "none" (
|
||||
doc = "Activation dynamics type for the actuator. The available dynamics types were already described in the Actuation model section."
|
||||
allowedTokens = ["none", "integrator", "filter", "filterexact", "muscle", "user"]
|
||||
)
|
||||
|
||||
uniform token mjc:gainType = "fixed" (
|
||||
doc = "The gain and bias together determine the output of the force generation mechanism, which is currently assumed to be affine."
|
||||
allowedTokens = ["fixed", "affine", "muscle", "user"]
|
||||
)
|
||||
|
||||
uniform token mjc:biasType = "none" (
|
||||
doc = "The gain and bias together determine the output of the force generation mechanism, which is currently assumed to be affine."
|
||||
allowedTokens = ["none", "affine", "muscle", "user"]
|
||||
)
|
||||
|
||||
uniform double[] mjc:dynPrm = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (
|
||||
doc = "Activation dynamics parameters. The built-in activation types (except for muscle) use only the first parameter, but we provide additional parameters in case user callbacks implement a more elaborate model. The length of this array is not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators."
|
||||
)
|
||||
|
||||
uniform double[] mjc:gainPrm = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (
|
||||
doc = "Gain parameters. The built-in gain types (except for muscle) use only the first parameter, but we provide additional parameters in case user callbacks implement a more elaborate model. The length of this array is not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators."
|
||||
)
|
||||
|
||||
uniform double[] mjc:biasPrm = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (
|
||||
doc = "Bias parameters. The affine bias type uses three parameters. The length of this array is not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators."
|
||||
)
|
||||
|
||||
uniform bool mjc:actEarly = False (
|
||||
doc = "If true, force computation will use the next value of the activation variable rather than the current one. Setting this flag reduces the delay between the control and accelerations by one time-step."
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,16 +17,36 @@
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
: auto_("auto", TfToken::Immortal),
|
||||
: affine("affine", TfToken::Immortal),
|
||||
auto_("auto", TfToken::Immortal),
|
||||
cg("cg", TfToken::Immortal),
|
||||
convex("convex", TfToken::Immortal),
|
||||
dense("dense", TfToken::Immortal),
|
||||
elliptic("elliptic", TfToken::Immortal),
|
||||
euler("euler", TfToken::Immortal),
|
||||
exact("exact", TfToken::Immortal),
|
||||
false_("false", TfToken::Immortal),
|
||||
filter("filter", TfToken::Immortal),
|
||||
filterexact("filterexact", TfToken::Immortal),
|
||||
fixed("fixed", TfToken::Immortal),
|
||||
implicit("implicit", TfToken::Immortal),
|
||||
implicitfast("implicitfast", TfToken::Immortal),
|
||||
integrator("integrator", TfToken::Immortal),
|
||||
legacy("legacy", TfToken::Immortal),
|
||||
mjcActDim("mjc:actDim", TfToken::Immortal),
|
||||
mjcActEarly("mjc:actEarly", TfToken::Immortal),
|
||||
mjcActLimited("mjc:actLimited", TfToken::Immortal),
|
||||
mjcActRangeMax("mjc:actRange:max", TfToken::Immortal),
|
||||
mjcActRangeMin("mjc:actRange:min", TfToken::Immortal),
|
||||
mjcBiasPrm("mjc:biasPrm", TfToken::Immortal),
|
||||
mjcBiasType("mjc:biasType", TfToken::Immortal),
|
||||
mjcCrankLength("mjc:crankLength", TfToken::Immortal),
|
||||
mjcCrankSite("mjc:crankSite", TfToken::Immortal),
|
||||
mjcCtrlLimited("mjc:ctrlLimited", TfToken::Immortal),
|
||||
mjcCtrlRangeMax("mjc:ctrlRange:max", TfToken::Immortal),
|
||||
mjcCtrlRangeMin("mjc:ctrlRange:min", TfToken::Immortal),
|
||||
mjcDynPrm("mjc:dynPrm", TfToken::Immortal),
|
||||
mjcDynType("mjc:dynType", TfToken::Immortal),
|
||||
mjcFlagActuation("mjc:flag:actuation", TfToken::Immortal),
|
||||
mjcFlagAutoreset("mjc:flag:autoreset", TfToken::Immortal),
|
||||
mjcFlagClampctrl("mjc:flag:clampctrl", TfToken::Immortal),
|
||||
@@ -50,7 +70,16 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcFlagRefsafe("mjc:flag:refsafe", TfToken::Immortal),
|
||||
mjcFlagSensor("mjc:flag:sensor", TfToken::Immortal),
|
||||
mjcFlagWarmstart("mjc:flag:warmstart", TfToken::Immortal),
|
||||
mjcForceLimited("mjc:forceLimited", TfToken::Immortal),
|
||||
mjcForceRangeMax("mjc:forceRange:max", TfToken::Immortal),
|
||||
mjcForceRangeMin("mjc:forceRange:min", TfToken::Immortal),
|
||||
mjcGainPrm("mjc:gainPrm", TfToken::Immortal),
|
||||
mjcGainType("mjc:gainType", TfToken::Immortal),
|
||||
mjcGear("mjc:gear", TfToken::Immortal),
|
||||
mjcInertia("mjc:inertia", TfToken::Immortal),
|
||||
mjcJointInParent("mjc:jointInParent", TfToken::Immortal),
|
||||
mjcLengthRangeMax("mjc:lengthRange:max", TfToken::Immortal),
|
||||
mjcLengthRangeMin("mjc:lengthRange:min", TfToken::Immortal),
|
||||
mjcOptionActuatorgroupdisable("mjc:option:actuatorgroupdisable",
|
||||
TfToken::Immortal),
|
||||
mjcOptionApirate("mjc:option:apirate", TfToken::Immortal),
|
||||
@@ -80,27 +109,54 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcOptionTolerance("mjc:option:tolerance", TfToken::Immortal),
|
||||
mjcOptionViscosity("mjc:option:viscosity", TfToken::Immortal),
|
||||
mjcOptionWind("mjc:option:wind", TfToken::Immortal),
|
||||
mjcRefSite("mjc:refSite", TfToken::Immortal),
|
||||
mjcShellinertia("mjc:shellinertia", TfToken::Immortal),
|
||||
mjcSliderSite("mjc:sliderSite", TfToken::Immortal),
|
||||
muscle("muscle", TfToken::Immortal),
|
||||
newton("newton", TfToken::Immortal),
|
||||
none("none", TfToken::Immortal),
|
||||
pgs("pgs", TfToken::Immortal),
|
||||
pyramidal("pyramidal", TfToken::Immortal),
|
||||
rk4("rk4", TfToken::Immortal),
|
||||
shell("shell", TfToken::Immortal),
|
||||
sparse("sparse", TfToken::Immortal),
|
||||
true_("true", TfToken::Immortal),
|
||||
user("user", TfToken::Immortal),
|
||||
CollisionAPI("CollisionAPI", TfToken::Immortal),
|
||||
MeshCollisionAPI("MeshCollisionAPI", TfToken::Immortal),
|
||||
PhysicsActuatorAPI("PhysicsActuatorAPI", TfToken::Immortal),
|
||||
SceneAPI("SceneAPI", TfToken::Immortal),
|
||||
SiteAPI("SiteAPI", TfToken::Immortal),
|
||||
allTokens({auto_,
|
||||
allTokens({affine,
|
||||
auto_,
|
||||
cg,
|
||||
convex,
|
||||
dense,
|
||||
elliptic,
|
||||
euler,
|
||||
exact,
|
||||
false_,
|
||||
filter,
|
||||
filterexact,
|
||||
fixed,
|
||||
implicit,
|
||||
implicitfast,
|
||||
integrator,
|
||||
legacy,
|
||||
mjcActDim,
|
||||
mjcActEarly,
|
||||
mjcActLimited,
|
||||
mjcActRangeMax,
|
||||
mjcActRangeMin,
|
||||
mjcBiasPrm,
|
||||
mjcBiasType,
|
||||
mjcCrankLength,
|
||||
mjcCrankSite,
|
||||
mjcCtrlLimited,
|
||||
mjcCtrlRangeMax,
|
||||
mjcCtrlRangeMin,
|
||||
mjcDynPrm,
|
||||
mjcDynType,
|
||||
mjcFlagActuation,
|
||||
mjcFlagAutoreset,
|
||||
mjcFlagClampctrl,
|
||||
@@ -124,7 +180,16 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcFlagRefsafe,
|
||||
mjcFlagSensor,
|
||||
mjcFlagWarmstart,
|
||||
mjcForceLimited,
|
||||
mjcForceRangeMax,
|
||||
mjcForceRangeMin,
|
||||
mjcGainPrm,
|
||||
mjcGainType,
|
||||
mjcGear,
|
||||
mjcInertia,
|
||||
mjcJointInParent,
|
||||
mjcLengthRangeMax,
|
||||
mjcLengthRangeMin,
|
||||
mjcOptionActuatorgroupdisable,
|
||||
mjcOptionApirate,
|
||||
mjcOptionCcd_iterations,
|
||||
@@ -151,15 +216,22 @@ MjcPhysicsTokensType::MjcPhysicsTokensType()
|
||||
mjcOptionTolerance,
|
||||
mjcOptionViscosity,
|
||||
mjcOptionWind,
|
||||
mjcRefSite,
|
||||
mjcShellinertia,
|
||||
mjcSliderSite,
|
||||
muscle,
|
||||
newton,
|
||||
none,
|
||||
pgs,
|
||||
pyramidal,
|
||||
rk4,
|
||||
shell,
|
||||
sparse,
|
||||
true_,
|
||||
user,
|
||||
CollisionAPI,
|
||||
MeshCollisionAPI,
|
||||
PhysicsActuatorAPI,
|
||||
SceneAPI,
|
||||
SiteAPI}) {}
|
||||
|
||||
|
||||
@@ -49,14 +49,22 @@ PXR_NAMESPACE_OPEN_SCOPE
|
||||
/// Use MjcPhysicsTokens like so:
|
||||
///
|
||||
/// \code
|
||||
/// gprim.GetMyTokenValuedAttr().Set(MjcPhysicsTokens->auto_);
|
||||
/// gprim.GetMyTokenValuedAttr().Set(MjcPhysicsTokens->affine);
|
||||
/// \endcode
|
||||
struct MjcPhysicsTokensType {
|
||||
MJCPHYSICS_API MjcPhysicsTokensType();
|
||||
/// \brief "affine"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcBiasTypeAttr(), Possible
|
||||
/// value for MjcPhysicsActuatorAPI::GetMjcGainTypeAttr()
|
||||
const TfToken affine;
|
||||
/// \brief "auto"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token
|
||||
/// represents the auto constraint Jacobian and matrices computed from it.
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetJacobianAttr(), Fallback value
|
||||
/// for MjcPhysicsActuatorAPI::GetMjcActLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsActuatorAPI::GetMjcCtrlLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsActuatorAPI::GetMjcForceLimitedAttr(), This token represents
|
||||
/// the auto constraint Jacobian and matrices computed from it.
|
||||
const TfToken auto_;
|
||||
/// \brief "cg"
|
||||
///
|
||||
@@ -86,6 +94,24 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// Possible value for MjcPhysicsMeshCollisionAPI::GetInertiaAttr()
|
||||
const TfToken exact;
|
||||
/// \brief "false"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcActLimitedAttr(), Possible
|
||||
/// value for MjcPhysicsActuatorAPI::GetMjcCtrlLimitedAttr(), Possible value
|
||||
/// for MjcPhysicsActuatorAPI::GetMjcForceLimitedAttr()
|
||||
const TfToken false_;
|
||||
/// \brief "filter"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcDynTypeAttr()
|
||||
const TfToken filter;
|
||||
/// \brief "filterexact"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcDynTypeAttr()
|
||||
const TfToken filterexact;
|
||||
/// \brief "fixed"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsActuatorAPI::GetMjcGainTypeAttr()
|
||||
const TfToken fixed;
|
||||
/// \brief "implicit"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token
|
||||
@@ -96,10 +122,70 @@ struct MjcPhysicsTokensType {
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token
|
||||
/// represents the implicitfast numerical integrator.
|
||||
const TfToken implicitfast;
|
||||
/// \brief "integrator"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcDynTypeAttr()
|
||||
const TfToken integrator;
|
||||
/// \brief "legacy"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsMeshCollisionAPI::GetInertiaAttr()
|
||||
const TfToken legacy;
|
||||
/// \brief "mjc:actDim"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcActDim;
|
||||
/// \brief "mjc:actEarly"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcActEarly;
|
||||
/// \brief "mjc:actLimited"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcActLimited;
|
||||
/// \brief "mjc:actRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcActRangeMax;
|
||||
/// \brief "mjc:actRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcActRangeMin;
|
||||
/// \brief "mjc:biasPrm"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcBiasPrm;
|
||||
/// \brief "mjc:biasType"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcBiasType;
|
||||
/// \brief "mjc:crankLength"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcCrankLength;
|
||||
/// \brief "mjc:crankSite"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcCrankSite;
|
||||
/// \brief "mjc:ctrlLimited"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcCtrlLimited;
|
||||
/// \brief "mjc:ctrlRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcCtrlRangeMax;
|
||||
/// \brief "mjc:ctrlRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcCtrlRangeMin;
|
||||
/// \brief "mjc:dynPrm"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcDynPrm;
|
||||
/// \brief "mjc:dynType"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcDynType;
|
||||
/// \brief "mjc:flag:actuation"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
@@ -192,10 +278,46 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagWarmstart;
|
||||
/// \brief "mjc:forceLimited"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcForceLimited;
|
||||
/// \brief "mjc:forceRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcForceRangeMax;
|
||||
/// \brief "mjc:forceRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcForceRangeMin;
|
||||
/// \brief "mjc:gainPrm"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcGainPrm;
|
||||
/// \brief "mjc:gainType"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcGainType;
|
||||
/// \brief "mjc:gear"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcGear;
|
||||
/// \brief "mjc:inertia"
|
||||
///
|
||||
/// MjcPhysicsMeshCollisionAPI
|
||||
const TfToken mjcInertia;
|
||||
/// \brief "mjc:jointInParent"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcJointInParent;
|
||||
/// \brief "mjc:lengthRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcLengthRangeMax;
|
||||
/// \brief "mjc:lengthRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcLengthRangeMin;
|
||||
/// \brief "mjc:option:actuatorgroupdisable"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
@@ -300,15 +422,34 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionWind;
|
||||
/// \brief "mjc:refSite"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcRefSite;
|
||||
/// \brief "mjc:shellinertia"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcShellinertia;
|
||||
/// \brief "mjc:sliderSite"
|
||||
///
|
||||
/// MjcPhysicsActuatorAPI
|
||||
const TfToken mjcSliderSite;
|
||||
/// \brief "muscle"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcBiasTypeAttr(), Possible
|
||||
/// value for MjcPhysicsActuatorAPI::GetMjcDynTypeAttr(), Possible value for
|
||||
/// MjcPhysicsActuatorAPI::GetMjcGainTypeAttr()
|
||||
const TfToken muscle;
|
||||
/// \brief "newton"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetSolverAttr(), This token
|
||||
/// represents the Newton constraint solver algorithm.
|
||||
const TfToken newton;
|
||||
/// \brief "none"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsActuatorAPI::GetMjcBiasTypeAttr(), Fallback
|
||||
/// value for MjcPhysicsActuatorAPI::GetMjcDynTypeAttr()
|
||||
const TfToken none;
|
||||
/// \brief "pgs"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetSolverAttr(), This token
|
||||
@@ -333,6 +474,18 @@ struct MjcPhysicsTokensType {
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token
|
||||
/// represents the sparse constraint Jacobian and matrices computed from it.
|
||||
const TfToken sparse;
|
||||
/// \brief "true"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcActLimitedAttr(), Possible
|
||||
/// value for MjcPhysicsActuatorAPI::GetMjcCtrlLimitedAttr(), Possible value
|
||||
/// for MjcPhysicsActuatorAPI::GetMjcForceLimitedAttr()
|
||||
const TfToken true_;
|
||||
/// \brief "user"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuatorAPI::GetMjcBiasTypeAttr(), Possible
|
||||
/// value for MjcPhysicsActuatorAPI::GetMjcDynTypeAttr(), Possible value for
|
||||
/// MjcPhysicsActuatorAPI::GetMjcGainTypeAttr()
|
||||
const TfToken user;
|
||||
/// \brief "CollisionAPI"
|
||||
///
|
||||
/// Schema identifer and family for MjcPhysicsCollisionAPI
|
||||
@@ -341,6 +494,10 @@ struct MjcPhysicsTokensType {
|
||||
///
|
||||
/// Schema identifer and family for MjcPhysicsMeshCollisionAPI
|
||||
const TfToken MeshCollisionAPI;
|
||||
/// \brief "PhysicsActuatorAPI"
|
||||
///
|
||||
/// Schema identifer and family for MjcPhysicsActuatorAPI
|
||||
const TfToken PhysicsActuatorAPI;
|
||||
/// \brief "SceneAPI"
|
||||
///
|
||||
/// Schema identifer and family for MjcPhysicsSceneAPI
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/vt/array.h>
|
||||
#include <pxr/base/vt/dictionary.h>
|
||||
#include <pxr/base/vt/types.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/usd/kind/registry.h>
|
||||
#include <pxr/usd/sdf/abstractData.h>
|
||||
@@ -105,7 +106,7 @@ using Arch_PerLibInit = pxr::Arch_PerLibInit<T>;
|
||||
#if defined(ARCH_OS_DARWIN)
|
||||
using Arch_ConstructorEntry = pxr::Arch_ConstructorEntry;
|
||||
#endif
|
||||
enum ErrorCodes { UnsupportedGeomTypeError, MujocoCompilationError };
|
||||
enum ErrorCodes { UnsupportedActuatorTypeError, UnsupportedGeomTypeError, MujocoCompilationError };
|
||||
|
||||
TF_REGISTRY_FUNCTION(pxr::TfEnum) {
|
||||
TF_ADD_ENUM_NAME(UnsupportedGeomTypeError, "UsdGeom type is unsupported.")
|
||||
@@ -155,6 +156,7 @@ class ModelWriter {
|
||||
ModelWriter(mjSpec *spec, mjModel *model, pxr::SdfAbstractDataRefPtr &data)
|
||||
: spec_(spec), model_(model), data_(data), class_path_("/Bad_Path") {
|
||||
body_paths_ = std::vector<pxr::SdfPath>(model->nbody);
|
||||
site_paths_ = std::vector<pxr::SdfPath>(model->nsite);
|
||||
}
|
||||
~ModelWriter() { mj_deleteModel(model_); }
|
||||
|
||||
@@ -187,6 +189,9 @@ class ModelWriter {
|
||||
WriteMeshes();
|
||||
WriteMaterials();
|
||||
WriteBodies();
|
||||
if (write_physics_) {
|
||||
WriteActuators();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -200,6 +205,8 @@ class ModelWriter {
|
||||
pxr::SdfPath class_path_;
|
||||
// Mapping from Mujoco body id to SdfPath.
|
||||
std::vector<pxr::SdfPath> body_paths_;
|
||||
// Mapping from Mujoco site id to SdfPath.
|
||||
std::vector<pxr::SdfPath> site_paths_;
|
||||
// Mapping from mesh names to Mesh prim path.
|
||||
std::unordered_map<std::string, pxr::SdfPath> mesh_paths_;
|
||||
// Whether to write physics data.
|
||||
@@ -764,6 +771,152 @@ class ModelWriter {
|
||||
}
|
||||
}
|
||||
|
||||
void WriteActuator(mjsActuator *actuator) {
|
||||
pxr::SdfPath transmission_path;
|
||||
if (actuator->trntype == mjtTrn::mjTRN_BODY) {
|
||||
int body_id = mj_name2id(model_, mjOBJ_BODY, actuator->target->c_str());
|
||||
transmission_path = body_paths_[body_id];
|
||||
} else if (actuator->trntype == mjtTrn::mjTRN_SITE ||
|
||||
actuator->trntype == mjtTrn::mjTRN_SLIDERCRANK) {
|
||||
int site_id = mj_name2id(model_, mjOBJ_SITE, actuator->target->c_str());
|
||||
transmission_path = site_paths_[site_id];
|
||||
} else {
|
||||
TF_WARN(UnsupportedActuatorTypeError,
|
||||
"Unsupported actuator type for actuator %d",
|
||||
mjs_getId(actuator->element));
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyApiSchema(data_, transmission_path,
|
||||
MjcPhysicsTokens->PhysicsActuatorAPI);
|
||||
|
||||
if (!actuator->refsite->empty()) {
|
||||
int refsite_id = mj_name2id(model_, mjOBJ_SITE, actuator->refsite->c_str());
|
||||
pxr::SdfPath refsite_path = site_paths_[refsite_id];
|
||||
CreateRelationshipSpec(data_, transmission_path,
|
||||
MjcPhysicsTokens->mjcRefSite,
|
||||
refsite_path, pxr::SdfVariabilityUniform);
|
||||
}
|
||||
|
||||
if (!actuator->slidersite->empty()) {
|
||||
int slidersite_id = mj_name2id(model_, mjOBJ_SITE, actuator->slidersite->c_str());
|
||||
pxr::SdfPath slidersite_path = site_paths_[slidersite_id];
|
||||
CreateRelationshipSpec(data_, transmission_path,
|
||||
MjcPhysicsTokens->mjcSliderSite,
|
||||
slidersite_path, pxr::SdfVariabilityUniform);
|
||||
}
|
||||
|
||||
|
||||
const std::vector<std::pair<pxr::TfToken, int>> limited_attributes = {
|
||||
{MjcPhysicsTokens->mjcCtrlLimited, actuator->ctrllimited},
|
||||
{MjcPhysicsTokens->mjcForceLimited, actuator->forcelimited},
|
||||
{MjcPhysicsTokens->mjcActLimited, actuator->actlimited},
|
||||
};
|
||||
for (const auto &[token, value] : limited_attributes) {
|
||||
pxr::TfToken limited_token = pxr::MjcPhysicsTokens->auto_;
|
||||
if (value == mjLIMITED_TRUE) {
|
||||
limited_token = pxr::MjcPhysicsTokens->true_;
|
||||
} else if (value == mjLIMITED_FALSE) {
|
||||
limited_token = pxr::MjcPhysicsTokens->false_;
|
||||
}
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Token,
|
||||
token, limited_token);
|
||||
}
|
||||
|
||||
const std::vector<std::pair<pxr::TfToken, double>>
|
||||
actuator_double_attributes = {
|
||||
{MjcPhysicsTokens->mjcCtrlRangeMin, actuator->ctrlrange[0]},
|
||||
{MjcPhysicsTokens->mjcCtrlRangeMax, actuator->ctrlrange[1]},
|
||||
{MjcPhysicsTokens->mjcForceRangeMin, actuator->forcerange[0]},
|
||||
{MjcPhysicsTokens->mjcForceRangeMax, actuator->forcerange[1]},
|
||||
{MjcPhysicsTokens->mjcActRangeMin, actuator->actrange[0]},
|
||||
{MjcPhysicsTokens->mjcActRangeMax, actuator->actrange[1]},
|
||||
{MjcPhysicsTokens->mjcLengthRangeMin, actuator->lengthrange[0]},
|
||||
{MjcPhysicsTokens->mjcLengthRangeMax, actuator->lengthrange[1]},
|
||||
{MjcPhysicsTokens->mjcCrankLength, actuator->cranklength},
|
||||
};
|
||||
for (const auto &[token, value] : actuator_double_attributes) {
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Double,
|
||||
token, value);
|
||||
}
|
||||
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Int,
|
||||
MjcPhysicsTokens->mjcActDim, actuator->actdim);
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Bool,
|
||||
MjcPhysicsTokens->mjcActEarly,
|
||||
(bool)actuator->actearly);
|
||||
|
||||
WriteUniformAttribute(
|
||||
transmission_path, pxr::SdfValueTypeNames->DoubleArray,
|
||||
MjcPhysicsTokens->mjcGear,
|
||||
pxr::VtDoubleArray(actuator->gear, actuator->gear + 6));
|
||||
|
||||
pxr::TfToken dyn_type;
|
||||
if (actuator->dyntype == mjtDyn::mjDYN_NONE) {
|
||||
dyn_type = MjcPhysicsTokens->none;
|
||||
} else if (actuator->dyntype == mjtDyn::mjDYN_INTEGRATOR) {
|
||||
dyn_type = MjcPhysicsTokens->integrator;
|
||||
} else if (actuator->dyntype == mjtDyn::mjDYN_FILTER) {
|
||||
dyn_type = MjcPhysicsTokens->filter;
|
||||
} else if (actuator->dyntype == mjtDyn::mjDYN_FILTEREXACT) {
|
||||
dyn_type = MjcPhysicsTokens->filterexact;
|
||||
} else if (actuator->dyntype == mjtDyn::mjDYN_MUSCLE) {
|
||||
dyn_type = MjcPhysicsTokens->muscle;
|
||||
} else if (actuator->dyntype == mjtDyn::mjDYN_USER) {
|
||||
dyn_type = MjcPhysicsTokens->user;
|
||||
}
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Token,
|
||||
MjcPhysicsTokens->mjcDynType, dyn_type);
|
||||
WriteUniformAttribute(
|
||||
transmission_path, pxr::SdfValueTypeNames->DoubleArray,
|
||||
MjcPhysicsTokens->mjcDynPrm,
|
||||
pxr::VtDoubleArray(actuator->dynprm, actuator->dynprm + 10));
|
||||
|
||||
|
||||
pxr::TfToken gain_type;
|
||||
if (actuator->gaintype == mjtGain::mjGAIN_FIXED) {
|
||||
gain_type = MjcPhysicsTokens->fixed;
|
||||
} else if (actuator->gaintype == mjtGain::mjGAIN_AFFINE) {
|
||||
gain_type = MjcPhysicsTokens->affine;
|
||||
} else if (actuator->gaintype == mjtGain::mjGAIN_MUSCLE) {
|
||||
gain_type = MjcPhysicsTokens->muscle;
|
||||
} else if (actuator->gaintype == mjtGain::mjGAIN_USER) {
|
||||
gain_type = MjcPhysicsTokens->user;
|
||||
}
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Token,
|
||||
MjcPhysicsTokens->mjcGainType, gain_type);
|
||||
WriteUniformAttribute(
|
||||
transmission_path, pxr::SdfValueTypeNames->DoubleArray,
|
||||
MjcPhysicsTokens->mjcGainPrm,
|
||||
pxr::VtDoubleArray(actuator->gainprm, actuator->gainprm + 10));
|
||||
|
||||
pxr::TfToken bias_type;
|
||||
if (actuator->biastype == mjtBias::mjBIAS_NONE) {
|
||||
bias_type = MjcPhysicsTokens->fixed;
|
||||
} else if (actuator->biastype == mjtBias::mjBIAS_AFFINE) {
|
||||
bias_type = MjcPhysicsTokens->affine;
|
||||
} else if (actuator->biastype == mjtBias::mjBIAS_MUSCLE) {
|
||||
bias_type = MjcPhysicsTokens->muscle;
|
||||
} else if (actuator->biastype == mjtBias::mjBIAS_USER) {
|
||||
bias_type = MjcPhysicsTokens->user;
|
||||
}
|
||||
WriteUniformAttribute(transmission_path, pxr::SdfValueTypeNames->Token,
|
||||
MjcPhysicsTokens->mjcBiasType, bias_type);
|
||||
WriteUniformAttribute(
|
||||
transmission_path, pxr::SdfValueTypeNames->DoubleArray,
|
||||
MjcPhysicsTokens->mjcBiasPrm,
|
||||
pxr::VtDoubleArray(actuator->biasprm, actuator->biasprm + 10));
|
||||
}
|
||||
|
||||
void WriteActuators() {
|
||||
mjsActuator *actuator =
|
||||
mjs_asActuator(mjs_firstElement(spec_, mjOBJ_ACTUATOR));
|
||||
while (actuator) {
|
||||
WriteActuator(actuator);
|
||||
actuator = mjs_asActuator(mjs_nextElement(spec_, actuator->element));
|
||||
}
|
||||
}
|
||||
|
||||
pxr::SdfPath WriteMeshGeom(const mjsGeom *geom,
|
||||
const pxr::SdfPath &body_path) {
|
||||
std::string mj_name = geom->name->empty() ? *geom->meshname : *geom->name;
|
||||
@@ -1018,6 +1171,8 @@ class ModelWriter {
|
||||
|
||||
PrependToXformOpOrder(
|
||||
site_path, pxr::VtArray<pxr::TfToken>{kTokens->xformOpTransform});
|
||||
|
||||
site_paths_[site_id] = site_path;
|
||||
}
|
||||
|
||||
void WriteGeom(mjsGeom *geom, const mjsBody *body) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "src/experimental/usd/mjcPhysics/actuatorAPI.h"
|
||||
#include "src/experimental/usd/mjcPhysics/collisionAPI.h"
|
||||
#include "src/experimental/usd/mjcPhysics/meshCollisionAPI.h"
|
||||
#include "src/experimental/usd/mjcPhysics/sceneAPI.h"
|
||||
@@ -31,6 +32,7 @@
|
||||
#include <pxr/base/tf/staticTokens.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/vt/array.h>
|
||||
#include <pxr/base/vt/types.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/kind/registry.h>
|
||||
#include <pxr/usd/sdf/assetPath.h>
|
||||
@@ -1320,6 +1322,127 @@ TEST_F(MjcfSdfFileFormatPluginTest, TestMassAPIDensity) {
|
||||
ExpectAttributeEqual(stage, "/test/body/box.physics:density", 1234.0f);
|
||||
}
|
||||
|
||||
TEST_F(MjcfSdfFileFormatPluginTest, TestMjcPhysicsActuatorGeneral) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco model="test">
|
||||
<worldbody>
|
||||
<body name="body">
|
||||
<geom name="box" type="box" size=".05 .05 .05" density="1234"/>
|
||||
<site name="site"/>
|
||||
<site name="ref"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
<actuator>
|
||||
<general
|
||||
name="general"
|
||||
site="site"
|
||||
refsite="ref"
|
||||
ctrllimited="true"
|
||||
ctrlrange="0 1"
|
||||
forcelimited="true"
|
||||
forcerange="2 3"
|
||||
actlimited="false"
|
||||
actrange="4 5"
|
||||
lengthrange="6 7"
|
||||
actdim="1"
|
||||
actearly="true"
|
||||
dyntype="filter"
|
||||
gaintype="user"
|
||||
biastype="user"
|
||||
gear="1 2 3 4 5 6"
|
||||
dynprm="0 1 2 3 4 5 6 7 8 9"
|
||||
gainprm="0 1 2 3 4 5 6 7 8 9"
|
||||
biasprm="0 1 2 3 4 5 6 7 8 9"
|
||||
/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
)";
|
||||
auto stage = OpenStageWithPhysics(xml);
|
||||
|
||||
EXPECT_PRIM_API_APPLIED(stage, "/test/body/site", pxr::MjcPhysicsActuatorAPI);
|
||||
EXPECT_REL_HAS_TARGET(stage, "/test/body/site.mjc:refSite", "/test/body/ref");
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:ctrlLimited",
|
||||
pxr::MjcPhysicsTokens->true_);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:ctrlRange:min", 0.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:ctrlRange:max", 1.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:forceLimited",
|
||||
pxr::MjcPhysicsTokens->true_);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:forceRange:min", 2.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:forceRange:max", 3.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:actLimited",
|
||||
pxr::MjcPhysicsTokens->false_);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:actRange:min", 4.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:actRange:max", 5.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:lengthRange:min", 6.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:lengthRange:max", 7.0);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:actDim", 1);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:dynType",
|
||||
MjcPhysicsTokens->filter);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:gainType",
|
||||
MjcPhysicsTokens->user);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:biasType",
|
||||
MjcPhysicsTokens->user);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:actEarly", true);
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:gear",
|
||||
pxr::VtDoubleArray{{1, 2, 3, 4, 5, 6}});
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:dynPrm",
|
||||
pxr::VtDoubleArray{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}});
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:gainPrm",
|
||||
pxr::VtDoubleArray{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}});
|
||||
ExpectAttributeEqual(stage, "/test/body/site.mjc:biasPrm",
|
||||
pxr::VtDoubleArray{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}});
|
||||
}
|
||||
|
||||
TEST_F(MjcfSdfFileFormatPluginTest, TestMjcPhysicsBodyActuator) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco model="test">
|
||||
<worldbody>
|
||||
<body name="body">
|
||||
<geom name="box" type="box" size=".05 .05 .05" density="1234"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
<actuator>
|
||||
<general
|
||||
name="general"
|
||||
body="body"
|
||||
/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
)";
|
||||
auto stage = OpenStageWithPhysics(xml);
|
||||
|
||||
EXPECT_PRIM_API_APPLIED(stage, "/test/body", pxr::MjcPhysicsActuatorAPI);
|
||||
}
|
||||
|
||||
TEST_F(MjcfSdfFileFormatPluginTest, TestMjcPhysicsSliderCrankActuator) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco model="test">
|
||||
<worldbody>
|
||||
<body name="body">
|
||||
<geom name="box" type="box" size=".05 .05 .05" density="1234"/>
|
||||
<site name="crank"/>
|
||||
<site name="slider"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
<actuator>
|
||||
<general
|
||||
name="general"
|
||||
cranksite="crank"
|
||||
slidersite="slider"
|
||||
cranklength="1.23"
|
||||
/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
)";
|
||||
auto stage = OpenStageWithPhysics(xml);
|
||||
|
||||
EXPECT_PRIM_API_APPLIED(stage, "/test/body/crank",
|
||||
pxr::MjcPhysicsActuatorAPI);
|
||||
EXPECT_REL_HAS_TARGET(stage, "/test/body/crank.mjc:sliderSite",
|
||||
"/test/body/slider");
|
||||
ExpectAttributeEqual(stage, "/test/body/crank.mjc:crankLength", 1.23);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace usd
|
||||
} // namespace mujoco
|
||||
|
||||
@@ -66,6 +66,14 @@
|
||||
#define EXPECT_ATTRIBUTE_HAS_NO_VALUE(stage, path) \
|
||||
EXPECT_FALSE((stage)->GetAttributeAtPath(SdfPath(path)).HasValue());
|
||||
|
||||
#define EXPECT_REL_HAS_TARGET(stage, path, target_path) \
|
||||
{ \
|
||||
pxr::SdfPathVector targets; \
|
||||
(stage)->GetRelationshipAtPath(SdfPath(path)).GetTargets(&targets); \
|
||||
EXPECT_TRUE(std::find(targets.begin(), targets.end(), \
|
||||
SdfPath(target_path)) != targets.end()); \
|
||||
}
|
||||
|
||||
namespace mujoco {
|
||||
namespace usd {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user