180 mPathToRootElements(NULL), mNumPathToRootElements(0), mLinksData(NULL), mJointData(NULL), mJointTranData(NULL),
181 mSpatialTendons(NULL), mNumSpatialTendons(0), mNumTotalAttachments(0),
182 mFixedTendons(NULL), mNumFixedTendons(0), mSensors(NULL), mSensorForces(NULL),
183 mNbSensors(0), mDt(0.f), mDofs(0xffffffff),
186 mRootPreMotionVelocity = Cm::SpatialVectorF::Zero();
192 void resizeLinkData(
const PxU32 linkCount);
193 void resizeJointData(
const PxU32 dofs);
196 PX_FORCE_INLINE const PxReal* getJointAccelerations()
const {
return mJointAcceleration.
begin(); }
200 PX_FORCE_INLINE const PxReal* getJointNewVelocities()
const {
return mJointNewVelocity.
begin(); }
206 PX_FORCE_INLINE const PxReal* getJointConstraintForces()
const {
return mJointConstraintForces.
begin(); }
252 PX_FORCE_INLINE PxU32 getSpatialTendonCount()
const {
return mNumSpatialTendons; }
256 PX_FORCE_INLINE PxU32 getFixedTendonCount()
const {
return mNumFixedTendons; }
283 PX_FORCE_INLINE void setDataDirty(
const bool dirty) { mDataDirty = dirty; }
299 PX_FORCE_INLINE JointSpaceSpatialZ* getJointSpaceDeltaV() {
return mJointSpaceDeltaVMatrix.
begin(); }
300 PX_FORCE_INLINE const JointSpaceSpatialZ* getJointSpaceDeltaV()
const {
return mJointSpaceDeltaVMatrix.
begin(); }
317 PX_FORCE_INLINE const SpatialMatrix& getWorldSpatialArticulatedInertia(
const PxU32 linkID)
const {
return mWorldSpatialArticulatedInertia[linkID]; }
341 PX_FORCE_INLINE PxU32* getPathToRootElements()
const {
return mPathToRootElements; }
342 PX_FORCE_INLINE PxU32 getPathToRootElementCount()
const {
return mNumPathToRootElements; }
406 PxU32* mPathToRootElements;
407 PxU32 mNumPathToRootElements;
412 PxU32 mNumSpatialTendons;
413 PxU32 mNumTotalAttachments;
415 PxU32 mNumFixedTendons;
527 eDIRTY_JOINTS = 1 << 0,
528 eDIRTY_POSITIONS = 1 << 1,
529 eDIRTY_VELOCITIES = 1 << 2,
530 eDIRTY_ACCELERATIONS = 1 << 3,
531 eDIRTY_FORCES = 1 << 4,
532 eDIRTY_ROOT_TRANSFORM = 1 << 5,
533 eDIRTY_ROOT_VELOCITIES = 1 << 6,
534 eDIRTY_LINKS = 1 << 7,
535 eIN_DIRTY_LIST = 1 << 8,
536 eDIRTY_WAKECOUNTER = 1 << 9,
537 eDIRTY_EXT_ACCEL = 1 << 10,
538 eDIRTY_LINK_FORCE = 1 << 11,
539 eDIRTY_LINK_TORQUE = 1 << 12,
540 eDIRTY_JOINT_TARGET_VEL = 1 << 13,
541 eDIRTY_JOINT_TARGET_POS = 1 << 14,
542 ePENDING_INSERTION = 1 << 15,
543 eDIRTY_SPATIAL_TENDON = 1 << 16,
544 eDIRTY_SPATIAL_TENDON_ATTACHMENT = 1 << 17,
545 eDIRTY_FIXED_TENDON = 1 << 18,
546 eDIRTY_FIXED_TENDON_JOINT = 1 << 19,
547 eDIRTY_SENSOR = 1 << 20,
548 eDIRTY_VELOCITY_LIMITS = 1 << 21,
549 eDIRTY_DOFS = (eDIRTY_POSITIONS | eDIRTY_VELOCITIES | eDIRTY_ACCELERATIONS | eDIRTY_FORCES),
599 void getDataSizes(PxU32 linkCount, PxU32& solverDataSize, PxU32& totalSize, PxU32& scratchSize);
601 bool resize(
const PxU32 linkCount);
611 PxU32 getDof(
const PxU32 linkID);
617 void packJointData(
const PxReal* maximum, PxReal* reduced);
619 void unpackJointData(
const PxReal* reduced, PxReal* maximum);
621 void initializeCommonData();
648 const PxReal* jointTorque,
const PxVec3& gravity,
const PxU32 maxIter,
const PxReal invLengthScale);
656 bool willStoreStaticConstraint() {
return DY_STATIC_CONTACTS_IN_INTERNAL_SOLVER; }
658 void setRootLinearVelocity(
const PxVec3& velocity);
659 void setRootAngularVelocity(
const PxVec3& velocity);
660 void teleportRootLink();
662 void getImpulseResponse(
668 void getImpulseResponse(
674 void getImpulseSelfResponse(
694 void fillIndexType(
const PxU32 linkId, PxU8& indexType);
696 PxReal getLinkMaxPenBias(
const PxU32 linkID)
const;
698 PxReal getCfm(
const PxU32 linkID)
const;
700 static PxU32 computeUnconstrainedVelocities(
707 static void computeUnconstrainedVelocitiesTGS(
709 PxReal dt,
const PxVec3& gravity,
711 const PxReal invLengthScale);
717 const PxReal biasCoefficient,
735 void pxcFsApplyImpulse(PxU32 linkID,
aos::Vec3V linear,
738 void pxcFsApplyImpulses(PxU32 linkID,
const aos::Vec3V& linear,
750 const PxTransform& getCurrentTransform(PxU32 linkID)
const;
752 const PxQuat& getDeltaQ(PxU32 linkID)
const;
767 static void propagateAccelerationW(
const PxVec3& c2p,
782 const PxU32 dofCount);
796 PxReal* jVelocities, PxReal* jAcceleration, PxReal* jPosition, PxReal* jointForce,
804 mGPUDirtyFlags |= flag;
826 bool raiseGPUDirtyFlag(ArticulationDirtyFlag::Enum flag)
828 bool nothingRaised = !(mGPUDirtyFlags);
829 mGPUDirtyFlags |= flag;
830 return nothingRaised;
833 void clearGPUDirtyFlags()
847 const PxReal invLengthScale);
849 void computeUnconstrainedVelocitiesInternal(
854 void copyJointData(
ArticulationData& data, PxReal* toJointData,
const PxReal* fromJointData);
872 bool velocityIteration,
bool isTGS,
const PxReal elapsedTime,
const PxReal biasCoefficient);
876 bool velocityIteration,
bool isTGS,
const PxReal elapsedTime,
const PxReal biasCoefficient);
881 void solveInternalSpatialTendonConstraints(
bool isTGS);
883 void solveInternalFixedTendonConstraints(
bool isTGS);
885 void writebackInternalConstraints(
bool isTGS);
887 void concludeInternalConstraints(
bool isTGS);
939 static void computeLinkStates(
940 const PxF32 dt,
const PxReal invLengthScale,
const PxVec3& gravity,
942 const PxU32 linkCount,
947 PxMat33* worldIsolatedSpatialArticulatedInertias, PxF32* linkMasses,
Dy::SpatialMatrix* worldSpatialArticulatedInertias,
948 const PxU32 jointDofCount,
949 PxReal* jointVelocities,
991 const PxReal* qstZIc);
1003 static Cm::SpatialVectorF getDeltaVWithDeltaJV(
const bool fixBase,
const PxU32 linkID,
1005 PxReal* jointVelocities);
1027 PxReal* jointVelocities);
1029 void getImpulseSelfResponseInv(
const bool fixBase,
1037 PxReal* jointVelocities);
1047 PxReal* jointVelocities,
1053 PxReal* jointVelocites);
1073 void calculateMassMatrixColInv(
ScratchData& scratchData);
1088 mUpdateSolverData =
true;
1093 mUpdateSolverData =
true;
1099 PX_FORCE_INLINE void setMaxDepth(
const PxU32 depth) { mMaxDepth = depth; }
1102 PX_FORCE_INLINE PxU32 getBodyCount()
const {
return mSolverDesc.linkCount; }
1107 PX_FORCE_INLINE PxU16 getIterationCounts()
const {
return mSolverDesc.core->solverIterationCounts; }
1114 void allocatePathToRootElements(
const PxU32 totalPathToRootElements);
1115 void initPathToRoot();
1137 PxU32 setupSolverConstraints(
1139 const PxU32 linkCount,
1145 void setupInternalConstraints(
1147 const PxU32 linkCount,
1157 void setupInternalConstraintsRecursive(
1159 const PxU32 linkCount,
1163 const PxReal stepDt,
1167 const bool isTGSSolver,
1169 const PxReal maxForceScale);
1171 void setupInternalSpatialTendonConstraintsRecursive(
1174 const PxU32 attachmentCount,
1175 const PxVec3& parentAttachmentPoint,
1179 const PxReal stepDt,
1180 const bool isTGSSolver,
1181 const PxU32 attachmentID,
1182 const PxReal stiffness,
1183 const PxReal damping,
1184 const PxReal limitStiffness,
1186 const PxU32 startLink,
1188 const PxVec3& startRaXn);
1191 void setupInternalFixedTendonConstraintsRecursive(
1197 const PxReal stepDt,
1198 const bool isTGSSolver,
1199 const PxU32 tendonJointID,
1200 const PxReal stiffness,
1201 const PxReal damping,
1202 const PxReal limitStiffness,
1203 const PxU32 startLink,
1205 const PxVec3& startRaXn);
1209 const PxVec3& parentAttachmentPoint);
1217 const PxU32 tendonJointID);
1220 Dy::ThreadContext& threadContext, PxReal correlationDist, PxReal bounceThreshold, PxReal frictionOffsetThreshold,
1224 void prepareStaticConstraintsTGS(
const PxReal stepDt,
const PxReal totalDt,
const PxReal invStepDt,
const PxReal invTotalDt,
1228 const PxReal biasCoefficient,
const PxReal lengthScale);
1232 void propagateLinksDown(
ArticulationData& data, PxReal* jointVelocities, PxReal* jointPositions,
1235 void updateJointProperties(
1236 PxReal* jointNewVelocities,
1237 PxReal* jointVelocities,
1238 PxReal* jointAccelerations);
1240 void recomputeAccelerations(
const PxReal dt);
1241 Cm::SpatialVector recomputeAcceleration(
const PxU32 linkID,
const PxReal dt)
const;
1251 const PxU32 linkCount,
ScratchData& scratchData,
bool fallBackToHeap =
false);
1263 PxU16 maxSolverFrictionProgress;
1264 PxU16 maxSolverNormalProgress;
1265 PxU32 solverProgress;
1266 PxU16 mArticulationIndex;
1267 PxU8 numTotalConstraints;
1275 bool mUpdateSolverData;
1282 PxU32 mGPUDirtyFlags;
1285 } PX_ALIGN_SUFFIX(64);
Struct that the solver uses to store the state and other properties of a body.
Definition PxSolverDefs.h:74
Struct that the solver uses to store velocity updates for a body.
Definition PxSolverDefs.h:55