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 terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef USDPHYSICS_GENERATED_JOINT_H
8 #define USDPHYSICS_GENERATED_JOINT_H
9 
10 /// \file usdPhysics/joint.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdPhysics/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
18 
19 #include "pxr/base/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // PHYSICSJOINT //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdPhysicsJoint
37 ///
38 /// A joint constrains the movement of rigid bodies. Joint can be
39 /// created between two rigid bodies or between one rigid body and world.
40 /// By default joint primitive defines a D6 joint where all degrees of
41 /// freedom are free. Three linear and three angular degrees of freedom.
42 /// Note that default behavior is to disable collision between jointed bodies.
43 ///
44 ///
46 {
47 public:
48  /// Compile time constant representing what kind of schema this class is.
49  ///
50  /// \sa UsdSchemaKind
52 
53  /// Construct a UsdPhysicsJoint on UsdPrim \p prim .
54  /// Equivalent to UsdPhysicsJoint::Get(prim.GetStage(), prim.GetPath())
55  /// for a \em valid \p prim, but will not immediately throw an error for
56  /// an invalid \p prim
57  explicit UsdPhysicsJoint(const UsdPrim& prim=UsdPrim())
58  : UsdGeomImageable(prim)
59  {
60  }
61 
62  /// Construct a UsdPhysicsJoint on the prim held by \p schemaObj .
63  /// Should be preferred over UsdPhysicsJoint(schemaObj.GetPrim()),
64  /// as it preserves SchemaBase state.
65  explicit UsdPhysicsJoint(const UsdSchemaBase& schemaObj)
66  : UsdGeomImageable(schemaObj)
67  {
68  }
69 
70  /// Destructor.
72  virtual ~UsdPhysicsJoint();
73 
74  /// Return a vector of names of all pre-declared attributes for this schema
75  /// class and all its ancestor classes. Does not include attributes that
76  /// may be authored by custom/extended methods of the schemas involved.
78  static const TfTokenVector &
79  GetSchemaAttributeNames(bool includeInherited=true);
80 
81  /// Return a UsdPhysicsJoint holding the prim adhering to this
82  /// schema at \p path on \p stage. If no prim exists at \p path on
83  /// \p stage, or if the prim at that path does not adhere to this schema,
84  /// return an invalid schema object. This is shorthand for the following:
85  ///
86  /// \code
87  /// UsdPhysicsJoint(stage->GetPrimAtPath(path));
88  /// \endcode
89  ///
91  static UsdPhysicsJoint
92  Get(const UsdStagePtr &stage, const SdfPath &path);
93 
94  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
95  /// is defined (according to UsdPrim::IsDefined()) on this stage.
96  ///
97  /// If a prim adhering to this schema at \p path is already defined on this
98  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
99  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
100  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
101  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
102  /// current EditTarget for any nonexistent, or existing but not \a Defined
103  /// ancestors.
104  ///
105  /// The given \a path must be an absolute prim path that does not contain
106  /// any variant selections.
107  ///
108  /// If it is impossible to author any of the necessary PrimSpecs, (for
109  /// example, in case \a path cannot map to the current UsdEditTarget's
110  /// namespace) issue an error and return an invalid \a UsdPrim.
111  ///
112  /// Note that this method may return a defined prim whose typeName does not
113  /// specify this schema class, in case a stronger typeName opinion overrides
114  /// the opinion at the current EditTarget.
115  ///
117  static UsdPhysicsJoint
118  Define(const UsdStagePtr &stage, const SdfPath &path);
119 
120 protected:
121  /// Returns the kind of schema this class belongs to.
122  ///
123  /// \sa UsdSchemaKind
125  UsdSchemaKind _GetSchemaKind() const override;
126 
127 private:
128  // needs to invoke _GetStaticTfType.
129  friend class UsdSchemaRegistry;
131  static const TfType &_GetStaticTfType();
132 
133  static bool _IsTypedSchema();
134 
135  // override SchemaBase virtuals.
137  const TfType &_GetTfType() const override;
138 
139 public:
140  // --------------------------------------------------------------------- //
141  // LOCALPOS0
142  // --------------------------------------------------------------------- //
143  /// Relative position of the joint frame to body0's frame.
144  ///
145  /// | ||
146  /// | -- | -- |
147  /// | Declaration | `point3f physics:localPos0 = (0, 0, 0)` |
148  /// | C++ Type | GfVec3f |
149  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Point3f |
152 
153  /// See GetLocalPos0Attr(), and also
154  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
155  /// If specified, author \p defaultValue as the attribute's default,
156  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
157  /// the default for \p writeSparsely is \c false.
159  UsdAttribute CreateLocalPos0Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
160 
161 public:
162  // --------------------------------------------------------------------- //
163  // LOCALROT0
164  // --------------------------------------------------------------------- //
165  /// Relative orientation of the joint frame to body0's frame.
166  ///
167  /// | ||
168  /// | -- | -- |
169  /// | Declaration | `quatf physics:localRot0 = (1, 0, 0, 0)` |
170  /// | C++ Type | GfQuatf |
171  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Quatf |
174 
175  /// See GetLocalRot0Attr(), and also
176  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
177  /// If specified, author \p defaultValue as the attribute's default,
178  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
179  /// the default for \p writeSparsely is \c false.
181  UsdAttribute CreateLocalRot0Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
182 
183 public:
184  // --------------------------------------------------------------------- //
185  // LOCALPOS1
186  // --------------------------------------------------------------------- //
187  /// Relative position of the joint frame to body1's frame.
188  ///
189  /// | ||
190  /// | -- | -- |
191  /// | Declaration | `point3f physics:localPos1 = (0, 0, 0)` |
192  /// | C++ Type | GfVec3f |
193  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Point3f |
196 
197  /// See GetLocalPos1Attr(), and also
198  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
199  /// If specified, author \p defaultValue as the attribute's default,
200  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
201  /// the default for \p writeSparsely is \c false.
203  UsdAttribute CreateLocalPos1Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
204 
205 public:
206  // --------------------------------------------------------------------- //
207  // LOCALROT1
208  // --------------------------------------------------------------------- //
209  /// Relative orientation of the joint frame to body1's frame.
210  ///
211  /// | ||
212  /// | -- | -- |
213  /// | Declaration | `quatf physics:localRot1 = (1, 0, 0, 0)` |
214  /// | C++ Type | GfQuatf |
215  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Quatf |
218 
219  /// See GetLocalRot1Attr(), and also
220  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
221  /// If specified, author \p defaultValue as the attribute's default,
222  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
223  /// the default for \p writeSparsely is \c false.
225  UsdAttribute CreateLocalRot1Attr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
226 
227 public:
228  // --------------------------------------------------------------------- //
229  // JOINTENABLED
230  // --------------------------------------------------------------------- //
231  /// Determines if the joint is enabled.
232  ///
233  /// | ||
234  /// | -- | -- |
235  /// | Declaration | `bool physics:jointEnabled = 1` |
236  /// | C++ Type | bool |
237  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
240 
241  /// See GetJointEnabledAttr(), and also
242  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
243  /// If specified, author \p defaultValue as the attribute's default,
244  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
245  /// the default for \p writeSparsely is \c false.
247  UsdAttribute CreateJointEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
248 
249 public:
250  // --------------------------------------------------------------------- //
251  // COLLISIONENABLED
252  // --------------------------------------------------------------------- //
253  /// Determines if the jointed subtrees should collide or not.
254  ///
255  /// | ||
256  /// | -- | -- |
257  /// | Declaration | `bool physics:collisionEnabled = 0` |
258  /// | C++ Type | bool |
259  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
262 
263  /// See GetCollisionEnabledAttr(), and also
264  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
265  /// If specified, author \p defaultValue as the attribute's default,
266  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
267  /// the default for \p writeSparsely is \c false.
269  UsdAttribute CreateCollisionEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
270 
271 public:
272  // --------------------------------------------------------------------- //
273  // EXCLUDEFROMARTICULATION
274  // --------------------------------------------------------------------- //
275  /// Determines if the joint can be included in an Articulation.
276  ///
277  /// | ||
278  /// | -- | -- |
279  /// | Declaration | `uniform bool physics:excludeFromArticulation = 0` |
280  /// | C++ Type | bool |
281  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
282  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
285 
286  /// See GetExcludeFromArticulationAttr(), and also
287  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
288  /// If specified, author \p defaultValue as the attribute's default,
289  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
290  /// the default for \p writeSparsely is \c false.
292  UsdAttribute CreateExcludeFromArticulationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
293 
294 public:
295  // --------------------------------------------------------------------- //
296  // BREAKFORCE
297  // --------------------------------------------------------------------- //
298  /// Joint break force. If set, joint is to break when this force
299  /// limit is reached. (Used for linear DOFs.)
300  /// Units: mass * distance / second / second
301  ///
302  /// | ||
303  /// | -- | -- |
304  /// | Declaration | `float physics:breakForce = inf` |
305  /// | C++ Type | float |
306  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
309 
310  /// See GetBreakForceAttr(), and also
311  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
312  /// If specified, author \p defaultValue as the attribute's default,
313  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
314  /// the default for \p writeSparsely is \c false.
316  UsdAttribute CreateBreakForceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
317 
318 public:
319  // --------------------------------------------------------------------- //
320  // BREAKTORQUE
321  // --------------------------------------------------------------------- //
322  /// Joint break torque. If set, joint is to break when this torque
323  /// limit is reached. (Used for angular DOFs.)
324  /// Units: mass * distance * distance / second / second
325  ///
326  /// | ||
327  /// | -- | -- |
328  /// | Declaration | `float physics:breakTorque = inf` |
329  /// | C++ Type | float |
330  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
333 
334  /// See GetBreakTorqueAttr(), and also
335  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
336  /// If specified, author \p defaultValue as the attribute's default,
337  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
338  /// the default for \p writeSparsely is \c false.
340  UsdAttribute CreateBreakTorqueAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
341 
342 public:
343  // --------------------------------------------------------------------- //
344  // BODY0
345  // --------------------------------------------------------------------- //
346  /// Relationship to any UsdGeomXformable.
347  ///
350 
351  /// See GetBody0Rel(), and also
352  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
355 
356 public:
357  // --------------------------------------------------------------------- //
358  // BODY1
359  // --------------------------------------------------------------------- //
360  /// Relationship to any UsdGeomXformable.
361  ///
364 
365  /// See GetBody1Rel(), and also
366  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
369 
370 public:
371  // ===================================================================== //
372  // Feel free to add custom code below this line, it will be preserved by
373  // the code generator.
374  //
375  // Just remember to:
376  // - Close the class declaration with };
377  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
378  // - Close the include guard with #endif
379  // ===================================================================== //
380  // --(BEGIN CUSTOM CODE)--
381 };
382 
384 
385 #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
Represents a concrete typed schema.
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)
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
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:273
USDPHYSICS_API UsdAttribute CreateLocalPos0Attr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
#define USDPHYSICS_API
Definition: api.h:23
USDPHYSICS_API UsdAttribute CreateCollisionEnabledAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdSchemaKind
Definition: common.h:112
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:51
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDPHYSICS_API UsdAttribute GetJointEnabledAttr() const
UsdPhysicsJoint(const UsdPrim &prim=UsdPrim())
Definition: joint.h:57
Definition: type.h:47
UsdPhysicsJoint(const UsdSchemaBase &schemaObj)
Definition: joint.h:65
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:146