HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
joint.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef USDPHYSICS_GENERATED_JOINT_H
25 #define USDPHYSICS_GENERATED_JOINT_H
26 
27 /// \file usdPhysics/joint.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdPhysics/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
35 
36 #include "pxr/base/vt/value.h"
37 
38 #include "pxr/base/gf/vec3d.h"
39 #include "pxr/base/gf/vec3f.h"
40 #include "pxr/base/gf/matrix4d.h"
41 
42 #include "pxr/base/tf/token.h"
43 #include "pxr/base/tf/type.h"
44 
46 
47 class SdfAssetPath;
48 
49 // -------------------------------------------------------------------------- //
50 // PHYSICSJOINT //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdPhysicsJoint
54 ///
55 /// A joint constrains the movement of rigid bodies. Joint can be
56 /// created between two rigid bodies or between one rigid body and world.
57 /// By default joint primitive defines a D6 joint where all degrees of
58 /// freedom are free. Three linear and three angular degrees of freedom.
59 /// Note that default behavior is to disable collision between jointed bodies.
60 ///
61 ///
63 {
64 public:
65  /// Compile time constant representing what kind of schema this class is.
66  ///
67  /// \sa UsdSchemaKind
69 
70  /// Construct a UsdPhysicsJoint on UsdPrim \p prim .
71  /// Equivalent to UsdPhysicsJoint::Get(prim.GetStage(), prim.GetPath())
72  /// for a \em valid \p prim, but will not immediately throw an error for
73  /// an invalid \p prim
74  explicit UsdPhysicsJoint(const UsdPrim& prim=UsdPrim())
75  : UsdGeomImageable(prim)
76  {
77  }
78 
79  /// Construct a UsdPhysicsJoint on the prim held by \p schemaObj .
80  /// Should be preferred over UsdPhysicsJoint(schemaObj.GetPrim()),
81  /// as it preserves SchemaBase state.
82  explicit UsdPhysicsJoint(const UsdSchemaBase& schemaObj)
83  : UsdGeomImageable(schemaObj)
84  {
85  }
86 
87  /// Destructor.
89  virtual ~UsdPhysicsJoint();
90 
91  /// Return a vector of names of all pre-declared attributes for this schema
92  /// class and all its ancestor classes. Does not include attributes that
93  /// may be authored by custom/extended methods of the schemas involved.
95  static const TfTokenVector &
96  GetSchemaAttributeNames(bool includeInherited=true);
97 
98  /// Return a UsdPhysicsJoint holding the prim adhering to this
99  /// schema at \p path on \p stage. If no prim exists at \p path on
100  /// \p stage, or if the prim at that path does not adhere to this schema,
101  /// return an invalid schema object. This is shorthand for the following:
102  ///
103  /// \code
104  /// UsdPhysicsJoint(stage->GetPrimAtPath(path));
105  /// \endcode
106  ///
108  static UsdPhysicsJoint
109  Get(const UsdStagePtr &stage, const SdfPath &path);
110 
111  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
112  /// is defined (according to UsdPrim::IsDefined()) on this stage.
113  ///
114  /// If a prim adhering to this schema at \p path is already defined on this
115  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
116  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
117  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
118  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
119  /// current EditTarget for any nonexistent, or existing but not \a Defined
120  /// ancestors.
121  ///
122  /// The given \a path must be an absolute prim path that does not contain
123  /// any variant selections.
124  ///
125  /// If it is impossible to author any of the necessary PrimSpecs, (for
126  /// example, in case \a path cannot map to the current UsdEditTarget's
127  /// namespace) issue an error and return an invalid \a UsdPrim.
128  ///
129  /// Note that this method may return a defined prim whose typeName does not
130  /// specify this schema class, in case a stronger typeName opinion overrides
131  /// the opinion at the current EditTarget.
132  ///
134  static UsdPhysicsJoint
135  Define(const UsdStagePtr &stage, const SdfPath &path);
136 
137 protected:
138  /// Returns the kind of schema this class belongs to.
139  ///
140  /// \sa UsdSchemaKind
142  UsdSchemaKind _GetSchemaKind() const override;
143 
144 private:
145  // needs to invoke _GetStaticTfType.
146  friend class UsdSchemaRegistry;
148  static const TfType &_GetStaticTfType();
149 
150  static bool _IsTypedSchema();
151 
152  // override SchemaBase virtuals.
154  const TfType &_GetTfType() const override;
155 
156 public:
157  // --------------------------------------------------------------------- //
158  // LOCALPOS0
159  // --------------------------------------------------------------------- //
160  /// Relative position of the joint frame to body0's frame.
161  ///
162  /// | ||
163  /// | -- | -- |
164  /// | Declaration | `point3f physics:localPos0 = (0, 0, 0)` |
165  /// | C++ Type | GfVec3f |
166  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Point3f |
169 
170  /// See GetLocalPos0Attr(), and also
171  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
172  /// If specified, author \p defaultValue as the attribute's default,
173  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
174  /// the default for \p writeSparsely is \c false.
176  UsdAttribute CreateLocalPos0Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
177 
178 public:
179  // --------------------------------------------------------------------- //
180  // LOCALROT0
181  // --------------------------------------------------------------------- //
182  /// Relative orientation of the joint frame to body0's frame.
183  ///
184  /// | ||
185  /// | -- | -- |
186  /// | Declaration | `quatf physics:localRot0 = (1, 0, 0, 0)` |
187  /// | C++ Type | GfQuatf |
188  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Quatf |
191 
192  /// See GetLocalRot0Attr(), and also
193  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
194  /// If specified, author \p defaultValue as the attribute's default,
195  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
196  /// the default for \p writeSparsely is \c false.
198  UsdAttribute CreateLocalRot0Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
199 
200 public:
201  // --------------------------------------------------------------------- //
202  // LOCALPOS1
203  // --------------------------------------------------------------------- //
204  /// Relative position of the joint frame to body1's frame.
205  ///
206  /// | ||
207  /// | -- | -- |
208  /// | Declaration | `point3f physics:localPos1 = (0, 0, 0)` |
209  /// | C++ Type | GfVec3f |
210  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Point3f |
213 
214  /// See GetLocalPos1Attr(), and also
215  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
216  /// If specified, author \p defaultValue as the attribute's default,
217  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
218  /// the default for \p writeSparsely is \c false.
220  UsdAttribute CreateLocalPos1Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
221 
222 public:
223  // --------------------------------------------------------------------- //
224  // LOCALROT1
225  // --------------------------------------------------------------------- //
226  /// Relative orientation of the joint frame to body1's frame.
227  ///
228  /// | ||
229  /// | -- | -- |
230  /// | Declaration | `quatf physics:localRot1 = (1, 0, 0, 0)` |
231  /// | C++ Type | GfQuatf |
232  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Quatf |
235 
236  /// See GetLocalRot1Attr(), and also
237  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
238  /// If specified, author \p defaultValue as the attribute's default,
239  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
240  /// the default for \p writeSparsely is \c false.
242  UsdAttribute CreateLocalRot1Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
243 
244 public:
245  // --------------------------------------------------------------------- //
246  // JOINTENABLED
247  // --------------------------------------------------------------------- //
248  /// Determines if the joint is enabled.
249  ///
250  /// | ||
251  /// | -- | -- |
252  /// | Declaration | `bool physics:jointEnabled = 1` |
253  /// | C++ Type | bool |
254  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
257 
258  /// See GetJointEnabledAttr(), and also
259  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
260  /// If specified, author \p defaultValue as the attribute's default,
261  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
262  /// the default for \p writeSparsely is \c false.
264  UsdAttribute CreateJointEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
265 
266 public:
267  // --------------------------------------------------------------------- //
268  // COLLISIONENABLED
269  // --------------------------------------------------------------------- //
270  /// Determines if the jointed subtrees should collide or not.
271  ///
272  /// | ||
273  /// | -- | -- |
274  /// | Declaration | `bool physics:collisionEnabled = 0` |
275  /// | C++ Type | bool |
276  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
279 
280  /// See GetCollisionEnabledAttr(), and also
281  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
282  /// If specified, author \p defaultValue as the attribute's default,
283  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
284  /// the default for \p writeSparsely is \c false.
286  UsdAttribute CreateCollisionEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
287 
288 public:
289  // --------------------------------------------------------------------- //
290  // EXCLUDEFROMARTICULATION
291  // --------------------------------------------------------------------- //
292  /// Determines if the joint can be included in an Articulation.
293  ///
294  /// | ||
295  /// | -- | -- |
296  /// | Declaration | `uniform bool physics:excludeFromArticulation = 0` |
297  /// | C++ Type | bool |
298  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
299  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
302 
303  /// See GetExcludeFromArticulationAttr(), and also
304  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
305  /// If specified, author \p defaultValue as the attribute's default,
306  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
307  /// the default for \p writeSparsely is \c false.
309  UsdAttribute CreateExcludeFromArticulationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
310 
311 public:
312  // --------------------------------------------------------------------- //
313  // BREAKFORCE
314  // --------------------------------------------------------------------- //
315  /// Joint break force. If set, joint is to break when this force
316  /// limit is reached. (Used for linear DOFs.)
317  /// Units: mass * distance / second / second
318  ///
319  /// | ||
320  /// | -- | -- |
321  /// | Declaration | `float physics:breakForce = inf` |
322  /// | C++ Type | float |
323  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
326 
327  /// See GetBreakForceAttr(), and also
328  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
329  /// If specified, author \p defaultValue as the attribute's default,
330  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
331  /// the default for \p writeSparsely is \c false.
333  UsdAttribute CreateBreakForceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
334 
335 public:
336  // --------------------------------------------------------------------- //
337  // BREAKTORQUE
338  // --------------------------------------------------------------------- //
339  /// Joint break torque. If set, joint is to break when this torque
340  /// limit is reached. (Used for angular DOFs.)
341  /// Units: mass * distance * distance / second / second
342  ///
343  /// | ||
344  /// | -- | -- |
345  /// | Declaration | `float physics:breakTorque = inf` |
346  /// | C++ Type | float |
347  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
350 
351  /// See GetBreakTorqueAttr(), and also
352  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
353  /// If specified, author \p defaultValue as the attribute's default,
354  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
355  /// the default for \p writeSparsely is \c false.
357  UsdAttribute CreateBreakTorqueAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
358 
359 public:
360  // --------------------------------------------------------------------- //
361  // BODY0
362  // --------------------------------------------------------------------- //
363  /// Relationship to any UsdGeomXformable.
364  ///
367 
368  /// See GetBody0Rel(), and also
369  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
372 
373 public:
374  // --------------------------------------------------------------------- //
375  // BODY1
376  // --------------------------------------------------------------------- //
377  /// Relationship to any UsdGeomXformable.
378  ///
381 
382  /// See GetBody1Rel(), and also
383  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
386 
387 public:
388  // ===================================================================== //
389  // Feel free to add custom code below this line, it will be preserved by
390  // the code generator.
391  //
392  // Just remember to:
393  // - Close the class declaration with };
394  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
395  // - Close the include guard with #endif
396  // ===================================================================== //
397  // --(BEGIN CUSTOM CODE)--
398 };
399 
401 
402 #endif
USDPHYSICS_API UsdAttribute GetLocalPos1Attr() const
USDPHYSICS_API UsdAttribute CreateBreakForceAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDPHYSICS_API UsdRelationship CreateBody1Rel() const
USDPHYSICS_API UsdAttribute GetBreakTorqueAttr() const
USDPHYSICS_API UsdAttribute GetExcludeFromArticulationAttr() const
static USDPHYSICS_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDPHYSICS_API UsdAttribute CreateBreakTorqueAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdSchemaKind
Definition: common.h:127
USDPHYSICS_API UsdAttribute CreateLocalPos1Attr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static USDPHYSICS_API UsdPhysicsJoint Define(const UsdStagePtr &stage, const SdfPath &path)
USDPHYSICS_API UsdRelationship GetBody0Rel() const
static USDPHYSICS_API UsdPhysicsJoint Get(const UsdStagePtr &stage, const SdfPath &path)
Represents a concrete typed schema.
Definition: prim.h:132
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDPHYSICS_API UsdAttribute CreateLocalRot1Attr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDPHYSICS_API UsdAttribute CreateExcludeFromArticulationAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: path.h:290
USDPHYSICS_API UsdAttribute CreateLocalPos0Attr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
#define USDPHYSICS_API
Definition: api.h:40
USDPHYSICS_API UsdAttribute CreateCollisionEnabledAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDPHYSICS_API UsdAttribute GetBreakForceAttr() const
USDPHYSICS_API UsdAttribute GetLocalRot0Attr() const
USDPHYSICS_API UsdSchemaKind _GetSchemaKind() const override
USDPHYSICS_API UsdRelationship GetBody1Rel() const
USDPHYSICS_API UsdAttribute GetCollisionEnabledAttr() const
USDPHYSICS_API UsdAttribute GetLocalRot1Attr() const
static const UsdSchemaKind schemaKind
Definition: joint.h:68
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
USDPHYSICS_API UsdAttribute GetJointEnabledAttr() const
UsdPhysicsJoint(const UsdPrim &prim=UsdPrim())
Definition: joint.h:74
Definition: type.h:64
UsdPhysicsJoint(const UsdSchemaBase &schemaObj)
Definition: joint.h:82
USDPHYSICS_API UsdAttribute GetLocalPos0Attr() const
USDPHYSICS_API UsdAttribute CreateJointEnabledAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
virtual USDPHYSICS_API ~UsdPhysicsJoint()
Destructor.
USDPHYSICS_API UsdRelationship CreateBody0Rel() const
USDPHYSICS_API UsdAttribute CreateLocalRot0Attr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: value.h:166