29#ifndef NP_ARTICULATION_RC_H
30#define NP_ARTICULATION_RC_H
32#include "PxArticulationReducedCoordinate.h"
34#if PX_ENABLE_DEBUG_VISUALIZATION
35 #include "common/PxRenderOutput.h"
37 PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
40#include "NpArticulationLink.h"
41#include "NpArticulationJointReducedCoordinate.h"
42#include "NpArticulationTendon.h"
43#include "ScArticulationCore.h"
47 class NpArticulationLink;
51 class NpArticulationSpatialTendon;
52 class NpArticulationFixedTendon;
53 class NpArticulationSensor;
69 NpBase(PxEmpty), mCore(PxEmpty),
70 mArticulationLinks(PxEmpty), mLoopJoints(PxEmpty), mSpatialTendons(PxEmpty), mFixedTendons(PxEmpty), mSensors(PxEmpty)
74 void preExportDataReset();
112 virtual PxU32 getLinks(
PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex)
const;
124 virtual void setName(
const char* name);
125 virtual const char*
getName()
const;
148 virtual void packJointData(
const PxReal* maximum, PxReal* reduced)
const;
150 virtual void unpackJointData(
const PxReal* reduced, PxReal* maximum)
const;
218 virtual PxU32 getSensors(
PxArticulationSensor** userBuffer, PxU32 bufferSize, PxU32 startIndex)
const;
227 PX_FORCE_INLINE PxArray<NpArticulationFixedTendon*>& getFixedTendons() {
return mFixedTendons; }
233 NpArticulationReducedCoordinate();
235 virtual bool isKindOf(
const char* name)
const {
return !::strcmp(
"PxArticulationReducedCoordinate", name) ||
PxBase::isKindOf(name); }
242 PX_INLINE void incrementShapeCount() { mNumShapes++; }
243 PX_INLINE void decrementShapeCount() { mNumShapes--; }
249 PX_INLINE void addToLinkList(NpArticulationLink& link) { mArticulationLinks.
pushBack(&link); mNumShapes += link.getNbShapes(); }
250 PX_INLINE bool removeLinkFromList(NpArticulationLink& link)
252 PX_ASSERT(mArticulationLinks.
find(&link) != mArticulationLinks.
end());
253 mTopologyChanged =
true;
258 NpArticulationLink* getRoot();
259 void setAggregate(PxAggregate* a);
261 void wakeUpInternal(
bool forceWakeUp,
bool autowake);
262 void autoWakeInternal();
264 void setGlobalPose();
267 PX_FORCE_INLINE const Sc::ArticulationCore& getCore()
const {
return mCore; }
268 static PX_FORCE_INLINE size_t getCoreOffset() {
return PX_OFFSET_OF_RT(NpArticulationReducedCoordinate, mCore); }
271 PX_INLINE void scSetSolverIterationCounts(PxU16 v)
273 PX_ASSERT(!isAPIWriteForbidden());
274 mCore.setSolverIterationCounts(v);
278 PX_INLINE void scSetSleepThreshold(
const PxReal v)
280 PX_ASSERT(!isAPIWriteForbidden());
281 mCore.setSleepThreshold(v);
285 PX_INLINE void scSetFreezeThreshold(
const PxReal v)
287 PX_ASSERT(!isAPIWriteForbidden());
288 mCore.setFreezeThreshold(v);
292 PX_INLINE void scSetWakeCounter(PxReal counter)
294 PX_ASSERT(!isAPIWriteForbiddenExceptSplitSim());
295 mCore.setWakeCounter(counter);
301 PX_ASSERT(!isAPIWriteForbidden());
302 mCore.setArticulationFlags(flags);
308 PX_ASSERT(getNpScene());
309 PX_ASSERT(!isAPIWriteForbiddenExceptSplitSim());
310 mCore.wakeUp(wakeCounter);
315 PX_ASSERT(!isAPIWriteForbidden());
316 mCore.setMaxLinearVelocity(maxLinearVelocity);
320 PX_FORCE_INLINE void scSetMaxAngularVelocity(PxReal maxAngularVelocity)
322 PX_ASSERT(!isAPIWriteForbidden());
323 mCore.setMaxAngularVelocity(maxAngularVelocity);
327 void recomputeLinkIDs();
330#if PX_ENABLE_DEBUG_VISUALIZATION
332 void visualize(PxRenderOutput& out, NpScene& scene,
float scale)
const;
334 PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
337 Sc::ArticulationCore mCore;
338 NpArticulationLinkArray mArticulationLinks;
340 NpAggregate* mAggregate;
343 bool mTopologyChanged;
347 void removeSpatialTendonInternal(NpArticulationSpatialTendon* tendon);
348 void removeFixedTendonInternal(NpArticulationFixedTendon* tendon);
349 void removeSensorInternal(NpArticulationSensor* sensor);
351 PxArray<NpConstraint*> mLoopJoints;
352 PxArray<NpArticulationSpatialTendon*> mSpatialTendons;
353 PxArray<NpArticulationFixedTendon*> mFixedTendons;
354 PxArray<NpArticulationSensor*> mSensors;
356 friend class NpScene;
Definition NpArticulationTendon.h:258
Definition NpArticulationReducedCoordinate.h:56
virtual void release()
Releases the articulation, and all its links and corresponding joints.
Definition NpArticulationReducedCoordinate.cpp:835
virtual void updateKinematic(PxArticulationKinematicFlags flags)
Update link velocities and/or positions in the articulation.
Definition NpArticulationReducedCoordinate.cpp:664
virtual PxVec3 getRootAngularVelocity() const
Gets the root link angular velocity.
Definition NpArticulationReducedCoordinate.cpp:487
virtual PxU32 getNbShapes() const
Returns the number of shapes in the articulation.
Definition NpArticulationReducedCoordinate.cpp:1150
virtual PxArticulationSensor * createSensor(PxArticulationLink *link, const PxTransform &relativePose)
Creates a force sensor attached to a link of the articulation.
Definition NpArticulationReducedCoordinate.cpp:575
virtual PxArticulationFlags getArticulationFlags() const
Returns the articulation's flags.
Definition NpArticulationReducedCoordinate.cpp:110
virtual void computeGeneralizedExternalForce(PxArticulationCache &cache) const
Computes the joint DOF forces required to counteract external spatial forces applied to articulation ...
Definition NpArticulationReducedCoordinate.cpp:249
virtual void copyInternalStateToCache(PxArticulationCache &cache, const PxArticulationCacheFlags flags) const
Copies internal data of the articulation to the cache.
Definition NpArticulationReducedCoordinate.cpp:191
virtual void computeJointForce(PxArticulationCache &cache) const
Computes the joint forces for the given articulation state and joint accelerations,...
Definition NpArticulationReducedCoordinate.cpp:271
virtual void getSolverIterationCounts(PxU32 &positionIters, PxU32 &velocityIters) const
Returns the solver iteration counts.
Definition NpArticulationReducedCoordinate.cpp:926
virtual PxU32 getNbSensors()
Returns the number of sensors in the articulation.
Definition NpArticulationReducedCoordinate.cpp:624
virtual PxArticulationSpatialTendon * createSpatialTendon()
Creates a spatial tendon to attach to the articulation with default attribute values.
Definition NpArticulationReducedCoordinate.cpp:519
virtual void setArticulationFlags(PxArticulationFlags flags)
Sets flags on the articulation.
Definition NpArticulationReducedCoordinate.cpp:81
virtual void unpackJointData(const PxReal *reduced, PxReal *maximum) const
Converts reduced-coordinate joint DOF data to maximal coordinates.
Definition NpArticulationReducedCoordinate.cpp:209
virtual void setMaxCOMAngularVelocity(const PxReal maxAngularVelocity)
Sets the limit on the magnitude of the angular velocity at the articulation's center of mass.
Definition NpArticulationReducedCoordinate.cpp:1121
virtual void addLoopJoint(PxConstraint *joint)
Adds a loop joint to the articulation system for inverse dynamics.
Definition NpArticulationReducedCoordinate.cpp:333
virtual PxReal getStabilizationThreshold() const
Returns the mass-normalized kinetic energy below which the articulation may participate in stabilizat...
Definition NpArticulationReducedCoordinate.cpp:998
virtual PxScene * getScene() const
Returns the scene which this articulation belongs to.
Definition NpArticulationReducedCoordinate.h:88
virtual void setRootGlobalPose(const PxTransform &pose, bool autowake=true)
Sets the root link transform (world to actor frame).
Definition NpArticulationReducedCoordinate.cpp:419
virtual void setRootAngularVelocity(const PxVec3 &velocity, bool autowake=true)
Sets the root link angular velocity.
Definition NpArticulationReducedCoordinate.cpp:459
virtual void packJointData(const PxReal *maximum, PxReal *reduced) const
Converts maximal-coordinate joint DOF data to reduced coordinates.
Definition NpArticulationReducedCoordinate.cpp:201
virtual void setStabilizationThreshold(PxReal threshold)
Sets the mass-normalized kinetic energy threshold below which the articulation may participate in sta...
Definition NpArticulationReducedCoordinate.cpp:987
virtual void setName(const char *name)
Sets a name string for the articulation that can be retrieved with getName().
Definition NpArticulationReducedCoordinate.cpp:1182
virtual void removeLoopJoint(PxConstraint *constraint)
Removes a loop joint from the articulation for inverse dynamics.
Definition NpArticulationReducedCoordinate.cpp:381
virtual PxTransform getRootGlobalPose() const
Returns the root link transform (world to actor frame).
Definition NpArticulationReducedCoordinate.cpp:431
virtual PxU32 getCacheDataSize() const
Returns the size of the articulation cache in bytes.
Definition NpArticulationReducedCoordinate.cpp:135
virtual PxVec3 getRootLinearVelocity() const
Gets the root link center-of-mass linear velocity.
Definition NpArticulationReducedCoordinate.cpp:476
virtual PxArticulationLink * createLink(PxArticulationLink *parent, const PxTransform &pose)
Adds a link to the articulation with default attribute values.
Definition NpArticulationReducedCoordinate.cpp:875
virtual PxU32 getLinks(PxArticulationLink **userBuffer, PxU32 bufferSize, PxU32 startIndex) const
Returns the set of links in the articulation in the order that they were added to the articulation us...
Definition NpArticulationReducedCoordinate.cpp:1144
virtual void computeCoriolisAndCentrifugalForce(PxArticulationCache &cache) const
Computes the joint DOF forces required to counteract Coriolis and centrifugal forces for the given ar...
Definition NpArticulationReducedCoordinate.cpp:238
virtual void wakeUp()
Wakes up the articulation if it is sleeping.
Definition NpArticulationReducedCoordinate.cpp:1072
virtual void zeroCache(PxArticulationCache &cache) const
Zeroes all data in the articulation cache, except user-provided and scratch memory,...
Definition NpArticulationReducedCoordinate.cpp:142
virtual void computeGeneralizedGravityForce(PxArticulationCache &cache) const
Computes the joint DOF forces required to counteract gravitational forces for the given articulation ...
Definition NpArticulationReducedCoordinate.cpp:227
virtual PxArticulationCache * createCache() const
Creates an articulation cache that can be used to read and write internal articulation data.
Definition NpArticulationReducedCoordinate.cpp:123
virtual void computeCoefficientMatrix(PxArticulationCache &cache) const
Computes the coefficient matrix for contact forces.
Definition NpArticulationReducedCoordinate.cpp:293
virtual void setRootLinearVelocity(const PxVec3 &velocity, bool autowake=true)
Sets the root link linear center-of-mass velocity.
Definition NpArticulationReducedCoordinate.cpp:442
virtual PxReal getMaxCOMAngularVelocity() const
Gets the limit on the magnitude of the angular velocity at the articulation's center of mass.
Definition NpArticulationReducedCoordinate.cpp:1132
virtual void commonInit() const
Prepares common articulation data based on articulation pose for inverse dynamics calculations.
Definition NpArticulationReducedCoordinate.cpp:217
virtual PxReal getWakeCounter() const
Returns the wake counter of the articulation in seconds.
Definition NpArticulationReducedCoordinate.cpp:1020
virtual void applyCache(PxArticulationCache &cache, const PxArticulationCacheFlags flags, bool autowake)
Applies the data in the cache to the articulation.
Definition NpArticulationReducedCoordinate.cpp:152
virtual bool isSleeping() const
Returns true if this articulation is sleeping.
Definition NpArticulationReducedCoordinate.cpp:960
virtual PxU32 getCoefficientMatrixSize() const
Returns the required size of the coefficient matrix in the articulation.
Definition NpArticulationReducedCoordinate.cpp:410
virtual const char * getName() const
Returns the name string set with setName().
Definition NpArticulationReducedCoordinate.cpp:1188
virtual void setWakeCounter(PxReal wakeCounterValue)
Sets the wake counter for the articulation in seconds.
Definition NpArticulationReducedCoordinate.cpp:1004
virtual PxReal getSleepThreshold() const
Returns the mass-normalized energy below which the articulation may go to sleep.
Definition NpArticulationReducedCoordinate.cpp:981
virtual PxU32 getDofs() const
Returns the total number of joint degrees-of-freedom (DOFs) of the articulation.
Definition NpArticulationReducedCoordinate.cpp:116
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition NpArticulationReducedCoordinate.h:196
virtual void computeJointAcceleration(PxArticulationCache &cache) const
Computes the joint accelerations for the given articulation state and joint forces.
Definition NpArticulationReducedCoordinate.cpp:260
virtual PxU32 getNbLoopJoints() const
Returns the number of loop joints in the articulation for inverse dynamics.
Definition NpArticulationReducedCoordinate.cpp:396
virtual PxU32 getNbLinks() const
Returns the number of links in the articulation.
Definition NpArticulationReducedCoordinate.cpp:1138
virtual PxU32 getNbFixedTendons()
Returns the number of fixed tendons in the articulation.
Definition NpArticulationReducedCoordinate.cpp:654
virtual PxU32 getGpuArticulationIndex()
Returns the GPU articulation index.
Definition NpArticulationReducedCoordinate.cpp:509
virtual PxAggregate * getAggregate() const
Returns the aggregate the articulation might be a part of.
Definition NpArticulationReducedCoordinate.cpp:1176
virtual PxU32 getSensors(PxArticulationSensor **userBuffer, PxU32 bufferSize, PxU32 startIndex) const
Returns the sensors attached to the articulation.
Definition NpArticulationReducedCoordinate.cpp:619
virtual PxArticulationFixedTendon * createFixedTendon()
Creates a fixed tendon to attach to the articulation with default attribute values.
Definition NpArticulationReducedCoordinate.cpp:544
virtual void setArticulationFlag(PxArticulationFlag::Enum flag, bool value)
Raises or clears a flag on the articulation.
Definition NpArticulationReducedCoordinate.cpp:92
virtual PxU32 getLoopJoints(PxConstraint **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const
Returns the set of loop constraints (i.e. joints) in the articulation.
Definition NpArticulationReducedCoordinate.cpp:403
virtual void setMaxCOMLinearVelocity(const PxReal maxLinearVelocity)
Sets the limit on the magnitude of the linear velocity of the articulation's center of mass.
Definition NpArticulationReducedCoordinate.cpp:1104
virtual bool computeLambda(PxArticulationCache &cache, PxArticulationCache &rollBackCache, const PxReal *const jointTorque, const PxU32 maxIter) const
Computes the lambda values when the test impulse is 1.
Definition NpArticulationReducedCoordinate.cpp:307
virtual void computeGeneralizedMassMatrix(PxArticulationCache &cache) const
Compute the joint-space inertia matrix that maps joint accelerations to joint forces: forces = M * ac...
Definition NpArticulationReducedCoordinate.cpp:322
virtual void setSleepThreshold(PxReal threshold)
Sets the mass-normalized energy threshold below which the articulation may go to sleep.
Definition NpArticulationReducedCoordinate.cpp:970
virtual void computeDenseJacobian(PxArticulationCache &cache, PxU32 &nRows, PxU32 &nCols) const
Compute the dense Jacobian for the articulation in world space, including the DOFs of a potentially f...
Definition NpArticulationReducedCoordinate.cpp:282
virtual PxBounds3 getWorldBounds(float inflation=1.01f) const
Returns the axis-aligned bounding box enclosing the articulation.
Definition NpArticulationReducedCoordinate.cpp:1156
virtual void putToSleep()
Forces the articulation to sleep.
Definition NpArticulationReducedCoordinate.cpp:1088
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition NpArticulationReducedCoordinate.h:235
virtual PxReal getMaxCOMLinearVelocity() const
Gets the limit on the magnitude of the linear velocity of the articulation's center of mass.
Definition NpArticulationReducedCoordinate.cpp:1115
virtual PxSpatialVelocity getLinkAcceleration(const PxU32 linkId)
Returns the (classical) link acceleration in world space for the given low-level link index.
Definition NpArticulationReducedCoordinate.cpp:498
virtual void setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters)
Sets the solver iteration counts for the articulation.
Definition NpArticulationReducedCoordinate.cpp:911
virtual PxU32 getNbSpatialTendons()
Returns the number of spatial tendons in the articulation.
Definition NpArticulationReducedCoordinate.cpp:639
Definition NpArticulationSensor.h:44
Definition NpArticulationTendon.h:150
Class to aggregate actors into a single broad-phase entry.
Definition PxAggregate.h:98
PX_INLINE Iterator find(const T &a)
Definition PxArray.h:272
PX_FORCE_INLINE ConstIterator end() const
Definition PxArray.h:192
PX_FORCE_INLINE ConstIterator begin() const
Definition PxArray.h:176
PX_FORCE_INLINE T & pushBack(const T &a)
Definition PxArray.h:296
PX_INLINE bool findAndReplaceWithLast(const T &a)
Definition PxArray.h:368
Data structure used to read and write internal articulation data.
Definition PxArticulationReducedCoordinate.h:99
A fixed tendon that can be used to link multiple degrees of freedom of multiple articulation joints v...
Definition PxArticulationTendon.h:478
A joint between two links in an articulation.
Definition PxArticulationJointReducedCoordinate.h:49
A component of an articulation that represents a rigid body.
Definition PxArticulationLink.h:54
A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver....
Definition PxArticulationReducedCoordinate.h:448
A force sensor that can be attached to articulation links to measure spatial force.
Definition PxArticulationReducedCoordinate.h:313
A spatial tendon that attaches to an articulation.
Definition PxArticulationTendon.h:413
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition PxBase.h:179
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
A plugin class for implementing constraints.
Definition PxConstraint.h:100
Binary deserialization context class.
Definition PxSerialFramework.h:174
Output stream class for I/O.
Definition PxIO.h:114
Callback class used to process PxBase objects.
Definition PxSerialFramework.h:81
A scene is a collection of bodies and constraints which can interact.
Definition PxScene.h:178
Binary serialization context class.
Definition PxSerialFramework.h:99
3 Element vector class.
Definition PxVec3.h:50
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Enum
Definition PxSolverDefs.h:294
Data structure to represent spatial velocities.
Definition PxArticulationReducedCoordinate.h:66