Skip to content

Commit 19542b6

Browse files
ayoub-belarbipreist-nvidia
authored andcommitted
Update PhysX to 5.4.2 at 9950ad0d
1 parent 44667a2 commit 19542b6

18 files changed

+263
-186
lines changed

physx/CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# v5.4.2-106.1
2+
3+
## Articulations
4+
5+
### Fixed
6+
7+
* A bug in the GPU pipeline where setting the maximum joint velocity to zero resulted in a crash.
8+
9+
### Changed
10+
11+
* In the CPU codepath, constraints involving the root link of a fixed-base articulation are now resolved simultaneously with constraints that couple pairs of dynamic rigid bodies and/or articulation links. As a consequence of this change, the CPU and GPU codepaths now resolve constraints and contacts involving the root link of an articulation in the same order. This historic inconsistency, which has now been resolved, may have caused a difference in behavior between CPU and GPU simulation.
12+
13+
## Rigid Body
14+
15+
### Fixed
16+
17+
* In cases where TGS was used with a non-zero number of velocity iterations on CPU, an incorrect timestep was used in part of the rigid-body and articulation solver pipeline.
18+
* A bug in collision resolution where a sphere could fall through a flat triangle mesh when it landed precisely on a mesh vertex.
19+
* Acceleration computation for rigid bodies was incorrect for both CPU and GPU APIs if velocities were updated by the user in-between simulation steps. This is fixed now. Affected API: PxRigidBody::getLinearAcceleration(), PxRigidBody::getAngularAcceleration(), PxDirectGPUAPI::getRigidDynamicData().
20+
* The CPU-side computations of accelerations (controlled with eENABLE_BODY_ACCELERATIONS) have been disabled when eENABLE_DIRECT_GPU_API is enabled. Previously both the CPU and GPU computations happened, which was redundant.
21+
122
# v5.4.1-106.0
223

324
## General

physx/buildtools/steps/build_all_win_x86_64_vc16.bat

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
:: Setup VS2019 build environment
2-
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" SET PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\Installer
1+
@echo off
2+
SETLOCAL EnableDelayedExpansion
33

4-
for /f "usebackq tokens=*" %%i in (`vswhere -version "[16.0,17.0)" -latest -property installationPath`) do (
5-
SET "COMNTOOLS=%%i\Common7\Tools\"
4+
:: Locate Visual Studio using vswhere
5+
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" (
6+
SET "VS_INSTALLER_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
7+
echo VS_INSTALLER_DIR: "!VS_INSTALLER_DIR!"
8+
9+
:: Check if VS_INSTALLER_DIR is already in PATH
10+
echo !PATH! | findstr /i /c:"!VS_INSTALLER_DIR!" >nul
11+
if !errorlevel! neq 0 (
12+
SET PATH=!PATH!;!VS_INSTALLER_DIR!
13+
echo Updated PATH: !PATH!
14+
) else (
15+
echo VS_INSTALLER_DIR is already in PATH
16+
)
617
)
718

8-
@call "%COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
19+
:: Use vswhere to locate the latest Visual Studio installation
20+
for /f "usebackq tokens=*" %%i in (`vswhere -version "[16.0,17.0)" -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
21+
SET "VSINSTALLPATH=%%i"
22+
echo VSINSTALLPATH: "!VSINSTALLPATH!"
23+
)
24+
25+
:: Set COMNTOOLS to point to the correct path
26+
SET "COMNTOOLS=!VSINSTALLPATH!\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
27+
echo COMNTOOLS: "!COMNTOOLS!"
28+
@call "!COMNTOOLS!"
929

1030
:: When run with no arguments we always perform a rebuild (clean & build)
1131
@if [%1] == [] (

physx/buildtools/steps/build_all_win_x86_64_vc17.bat

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
1-
:: Setup VS2022 build environment
1+
@echo off
2+
SETLOCAL EnableDelayedExpansion
23

3-
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" SET PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\Installer
4+
:: Locate Visual Studio using vswhere
5+
IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" (
6+
SET "VS_INSTALLER_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
7+
echo VS_INSTALLER_DIR: "!VS_INSTALLER_DIR!"
8+
9+
:: Check if VS_INSTALLER_DIR is already in PATH
10+
echo !PATH! | findstr /i /c:"!VS_INSTALLER_DIR!" >nul
11+
if !errorlevel! neq 0 (
12+
SET PATH=!PATH!;!VS_INSTALLER_DIR!
13+
echo Updated PATH: !PATH!
14+
) else (
15+
echo VS_INSTALLER_DIR is already in PATH
16+
)
17+
)
418

5-
for /f "usebackq tokens=*" %%i in (`vswhere -version "[17.0,18.0)" -latest -property installationPath`) do (
6-
SET "COMNTOOLS=%%i\Common7\Tools\"
19+
:: Use vswhere to locate the latest Visual Studio installation
20+
for /f "usebackq tokens=*" %%i in (`vswhere -version "[17.0,18.0)" -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
21+
SET "VSINSTALLPATH=%%i"
22+
echo VSINSTALLPATH: "!VSINSTALLPATH!"
723
)
824

9-
@call "%COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
25+
:: Set COMNTOOLS to point to the correct path
26+
SET "COMNTOOLS=!VSINSTALLPATH!\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
27+
echo COMNTOOLS: "!COMNTOOLS!"
28+
@call "!COMNTOOLS!"
1029

1130
:: When run with no arguments we always perform a rebuild (clean & build)
1231
@if [%1] == [] (

physx/dependencies.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
</dependency>
1717

1818
<dependency name="PhysXGpu">
19-
<package name="PhysXGpu" version="5.4.1.86cd1749-release-106.0-windows-public" platforms="vc15win64 vc16win64 vc17win64"/>
20-
<package name="PhysXGpu" version="5.4.1.86cd1749-release-106.0-linux-x86_64-public" platforms="linux"/>
21-
<package name="PhysXGpu" version="5.4.1.86cd1749-release-106.0-linux-aarch64-public" platforms="linux-aarch64"/>
19+
<package name="PhysXGpu" version="5.4.2.e5f54faf-release-106.1-windows-public" platforms="vc15win64 vc16win64 vc17win64"/>
20+
<package name="PhysXGpu" version="5.4.2.e5f54faf-release-106.1-linux-x86_64-public" platforms="linux"/>
21+
<package name="PhysXGpu" version="5.4.2.e5f54faf-release-106.1-linux-aarch64-public" platforms="linux-aarch64"/>
2222
</dependency>
2323

2424
<dependency name="opengllinux" tags="requiredForDistro">

physx/include/extensions/PxSerialization.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
PX_BINARY_SERIAL_VERSION is used to version the PhysX binary data and meta data. The global unique identifier of the PhysX SDK needs to match
4242
the one in the data and meta data, otherwise they are considered incompatible. A 32 character wide GUID can be generated with https://www.guidgenerator.com/ for example.
4343
*/
44-
#define PX_BINARY_SERIAL_VERSION "B57177A5EF424885A73E41854E472FC4"
44+
#define PX_BINARY_SERIAL_VERSION "3B794FCE39C34CE58F6065FA172B0A36"
4545

4646

4747
#if !PX_DOXYGEN

physx/include/foundation/PxPhysicsVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ sometimes they are stored in a byte.
4747

4848
#define PX_PHYSICS_VERSION_MAJOR 5
4949
#define PX_PHYSICS_VERSION_MINOR 4
50-
#define PX_PHYSICS_VERSION_BUGFIX 1
50+
#define PX_PHYSICS_VERSION_BUGFIX 2
5151

5252
/**
5353
The constant PX_PHYSICS_VERSION is used when creating certain PhysX module objects.

physx/source/lowleveldynamics/include/DyFeatherstoneArticulation.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,6 @@ namespace Dy
713713

714714
Cm::SpatialVector getMotionAcceleration(const PxU32 linkID, const bool isGpuSimEnabled) const;
715715

716-
void fillIndexType(const PxU32 linkId, PxU8& indexType);
717-
718716
PxReal getLinkMaxPenBias(const PxU32 linkID) const;
719717

720718
PxReal getCfm(const PxU32 linkID) const;

physx/source/lowleveldynamics/shared/DyCpuGpuArticulation.h

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,124 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal computeDriveImpulse
178178
return unclampedForce;
179179
}
180180

181+
/**
182+
\brief Apply limit constraints to an articulation joint dof.
183+
1) Compute the delta impulse required to maintain limit constraints.
184+
2) Individually accumulate the impulses that have been applied to maintain both the lower and upper limit.
185+
3) Compute the updated joint speed after applying the delta impulse.
186+
\param[in] dt is the timestep of the simulation
187+
\param[in] recipDt has value 1/dt
188+
\param[in] isVelIter is true if we are performing a velocity iteration, false if performing a position iteration.
189+
\param[in] response is the deltaSpeed response of the joint dof to a unit impulse.
190+
\param[in] recipResponse has value 1/response.
191+
\param[in] erp is the Baumgarte multiplier used to resolve a fraction of the limit error.
192+
\param[in] errorLow is the lower bound of the limit.
193+
\param[in] errorHigh is the upper bound of the limit.
194+
\param[in] jointPDelta is the change to the joint position that has accumulated over solver iterations.
195+
\param[in,out] lowImpulse_ is the accumulated impulse that has been applied to maintain the limit's lower bound.
196+
\param[in,out] highImpulse_ is the accumulated impulse that has applied to maintain the limit's upper bound.
197+
\param[in,out] jointV_ is the joint speed before and after applying the limit impulses.
198+
\return deltaImpulse required to enforce the upper and lower limits.
199+
*/
200+
PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal computeLimitImpulse
201+
(const PxReal dt, const PxReal recipDt, const bool isVelIter,
202+
const PxReal response, const PxReal recipResponse, const PxReal erp,
203+
const PxReal errorLow, const PxReal errorHigh,
204+
const PxReal jointPDelta,
205+
PxReal& lowImpulse_, PxReal& highImpulse_, PxReal& jointV_)
206+
{
207+
// PT: avoid aliasing
208+
PxReal jointV = jointV_;
209+
PxReal lowImpulse = lowImpulse_;
210+
PxReal highImpulse = highImpulse_;
211+
212+
const PxReal futureDeltaJointP = jointPDelta + jointV * dt;
213+
214+
// for all errors: Negative means violated
215+
const PxReal currErrLow = errorLow + jointPDelta;
216+
const PxReal nextErrLow = errorLow + futureDeltaJointP;
217+
const PxReal currErrHigh = errorHigh - jointPDelta;
218+
const PxReal nextErrHigh = errorHigh - futureDeltaJointP;
219+
220+
bool limited = false;
221+
222+
const PxReal tolerance = 0.f;
223+
224+
PxReal deltaF = 0.f;
225+
if (currErrLow < tolerance || nextErrLow < tolerance)
226+
{
227+
PxReal newJointV = jointV;
228+
limited = true;
229+
if (currErrLow < tolerance)
230+
{
231+
if (!isVelIter)
232+
newJointV = -currErrLow * recipDt * erp;
233+
}
234+
else
235+
{
236+
// Currently we're not in violation of the limit but would be after this time step given the current velocity.
237+
// To prevent that future violation, we want the current velocity to only take us right to the limit, not across it
238+
newJointV = -currErrLow * recipDt;
239+
}
240+
241+
// In position iterations, the newJointV is now such that we end up exactly on the limit after this time step (ignoring erp)
242+
// However, we ignored the current velocity, which may already take us further away from the limit than the newJointV.
243+
// Therefore, we additionally have to check now that the impulse we're applying is only repulsive overall.
244+
245+
const PxReal deltaV = newJointV - jointV;
246+
deltaF = PxMax(lowImpulse + deltaV * recipResponse, 0.f) - lowImpulse; // accumulated limit impulse must be repulsive
247+
lowImpulse += deltaF;
248+
}
249+
else if (currErrHigh < tolerance || nextErrHigh < tolerance)
250+
{
251+
PxReal newJointV = jointV;
252+
limited = true;
253+
if (currErrHigh < tolerance)
254+
{
255+
if (!isVelIter)
256+
newJointV = currErrHigh * recipDt * erp;
257+
}
258+
else
259+
newJointV = currErrHigh * recipDt;
260+
261+
const PxReal deltaV = newJointV - jointV;
262+
deltaF = PxMin(highImpulse + deltaV * recipResponse, 0.f) - highImpulse;
263+
highImpulse += deltaF;
264+
}
265+
266+
if (!limited)
267+
{
268+
// If no limit is violated right now, it could still be that a limit was active in an earlier iteration and
269+
// overshot. Therefore, we give that limit from which the joint position is currently moving away a chance to
270+
// pull back and correct the overshoot.
271+
// The pull-back impulse is the smaller of
272+
// a) The impulse needed to bring the joint velocity to zero.
273+
// b) The opposite impulse of the already applied joint limit impulse, thereby cancelling out the accumulated effect of the limit.
274+
275+
const PxReal impulseForZeroVel = -jointV * recipResponse;
276+
if (jointV > 0.f) // moving away from the lower limit
277+
{
278+
deltaF = PxMax(impulseForZeroVel, -lowImpulse);
279+
lowImpulse += deltaF;
280+
281+
}
282+
else // moving away from the higher limit
283+
{
284+
deltaF = PxMin(impulseForZeroVel, -highImpulse);
285+
highImpulse += deltaF;
286+
}
287+
}
288+
289+
jointV += deltaF * response;
290+
291+
lowImpulse_ = lowImpulse;
292+
highImpulse_ = highImpulse;
293+
jointV_ = jointV;
294+
295+
return deltaF;
296+
}
297+
298+
181299
/**
182300
\brief Translate a spatial vector from the frame of one link (the source link) to the frame of another link (the target link).
183301
\param[in] offset is the vector from the source link to the target link (== posTargetLink - posSourceLlink)

physx/source/lowleveldynamics/src/DyDynamics.cpp

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,8 @@ void DynamicsContext::setDescFromIndices(PxSolverConstraintDesc& desc, IG::EdgeI
269269
{
270270
Dy::FeatherstoneArticulation* a = islandSim.getLLArticulation(node1);
271271

272-
PxU8 type;
273-
274-
a->fillIndexType(node1.articulationLinkId(), type);
275-
276-
if (type == PxsIndexedInteraction::eARTICULATION)
277-
{
278-
desc.articulationA = a;
279-
desc.linkIndexA = node1.articulationLinkId();
280-
}
281-
else
282-
{
283-
desc.bodyA = &mWorldSolverBody;
284-
desc.bodyADataIndex = 0;
285-
desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY;
286-
}
272+
desc.articulationA = a;
273+
desc.linkIndexA = node1.articulationLinkId();
287274
}
288275
else
289276
{
@@ -308,21 +295,9 @@ void DynamicsContext::setDescFromIndices(PxSolverConstraintDesc& desc, IG::EdgeI
308295
if (node.getNodeType() == IG::Node::eARTICULATION_TYPE)
309296
{
310297
Dy::FeatherstoneArticulation* b = islandSim.getLLArticulation(node2);
311-
PxU8 type;
312298

313-
b->fillIndexType(node2.articulationLinkId(), type);
314-
315-
if (type == PxsIndexedInteraction::eARTICULATION)
316-
{
317-
desc.articulationB = b;
318-
desc.linkIndexB = node2.articulationLinkId();
319-
}
320-
else
321-
{
322-
desc.bodyB = &mWorldSolverBody;
323-
desc.bodyBDataIndex = 0;
324-
desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY;
325-
}
299+
desc.articulationB = b;
300+
desc.linkIndexB = node2.articulationLinkId();
326301
}
327302
else
328303
{
@@ -941,8 +916,7 @@ class PxsSolverStartTask : public Cm::Task
941916
if(node1.getNodeType() == IG::Node::eARTICULATION_TYPE)
942917
{
943918
indexedManager.articulation0 = nodeIndex1.getInd();
944-
const PxU32 linkId = nodeIndex1.articulationLinkId();
945-
node1.getArticulation()->fillIndexType(linkId, indexedManager.indexType0);
919+
indexedManager.indexType0 = PxsIndexedInteraction::eARTICULATION;
946920
}
947921
else
948922
{
@@ -972,8 +946,7 @@ class PxsSolverStartTask : public Cm::Task
972946
if(node2.getNodeType() == IG::Node::eARTICULATION_TYPE)
973947
{
974948
indexedManager.articulation1 = nodeIndex2.getInd();
975-
const PxU32 linkId = nodeIndex2.articulationLinkId();
976-
node2.getArticulation()->fillIndexType(linkId, indexedManager.indexType1);
949+
indexedManager.indexType1 = PxsIndexedInteraction::eARTICULATION;
977950
}
978951
else
979952
{

physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -936,17 +936,6 @@ namespace Dy
936936
return a;
937937
}
938938

939-
void FeatherstoneArticulation::fillIndexType(const PxU32 linkId, PxU8& indexType)
940-
{
941-
ArticulationLink& link = mArticulationData.getLink(linkId);
942-
943-
//turn the fixed-base links to static for the solver
944-
if(link.bodyCore->fixedBaseLink)
945-
indexType = PxsIndexedInteraction::eWORLD;
946-
else
947-
indexType = PxsIndexedInteraction::eARTICULATION;
948-
}
949-
950939
PxReal FeatherstoneArticulation::getLinkMaxPenBias(const PxU32 linkID) const
951940
{
952941
return mArticulationData.getLinkData(linkID).maxPenBias;

0 commit comments

Comments
 (0)