Skip to content

Commit

Permalink
premake add enable_stable_pd option, so Bullet can be compiled withou…
Browse files Browse the repository at this point in the history
…t C++11 (Visual Studio 2010 etc)

PyBullet: improve sleeping: if the base is static and all joints in the chain between this link and the base are fixed, then this link is static too (doesn't merge islands)
Fix PyBullet compilation of Visual Studion 2010
  • Loading branch information
erwincoumans committed Aug 8, 2019
1 parent 098cde5 commit 226819b
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 157 deletions.
7 changes: 7 additions & 0 deletions build3/premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)"
}

newoption
{
trigger = "enable_stable_pd",
description = "Enable Stable PD control in PyBullet"
}


newoption
{
trigger = "enable_static_vr_plugin",
Expand Down
21 changes: 21 additions & 0 deletions examples/Importers/ImportURDFDemo/URDF2Bullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,27 @@ btTransform ConvertURDF2BulletInternal(

if (mbLinkIndex >= 0) //???? double-check +/- 1
{
//if the base is static and all joints in the chain between this link and the base are fixed,
//then this link is static too (doesn't merge islands)
if (cache.m_bulletMultiBody->getBaseMass() == 0)
{
bool allJointsFixed = true;
int testLinkIndex = mbLinkIndex;
do
{
if (cache.m_bulletMultiBody->getLink(testLinkIndex).m_jointType != btMultibodyLink::eFixed)
{
allJointsFixed = false;
break;
}
testLinkIndex = cache.m_bulletMultiBody->getLink(testLinkIndex).m_parent;
} while (testLinkIndex> 0);
if (allJointsFixed)
{
col->setCollisionFlags(btCollisionObject::CF_STATIC_OBJECT);
}

}
cache.m_bulletMultiBody->getLink(mbLinkIndex).m_collider = col;
if (flags & CUF_USE_SELF_COLLISION_INCLUDE_PARENT)
{
Expand Down
13 changes: 11 additions & 2 deletions examples/pybullet/premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ project ("pybullet")

includedirs {"../../src", "../../examples",
"../../examples/ThirdPartyLibs"}
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER", "STATIC_LINK_SPD_PLUGIN"}
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER"}



hasCL = findOpenCL("clew")
Expand Down Expand Up @@ -181,6 +182,12 @@ if not _OPTIONS["no-enet"] then
"../../examples/SharedMemory/plugins/collisionFilterPlugin/collisionFilterPlugin.cpp",
"../../examples/SharedMemory/plugins/pdControlPlugin/pdControlPlugin.cpp",
"../../examples/SharedMemory/plugins/pdControlPlugin/pdControlPlugin.h",



if _OPTIONS["enable_stable_pd"] then
defines {"STATIC_LINK_SPD_PLUGIN"}
files {
"../../examples/SharedMemory/plugins/stablePDPlugin/SpAlg.cpp",
"../../examples/SharedMemory/plugins/stablePDPlugin/SpAlg.h",
"../../examples/SharedMemory/plugins/stablePDPlugin/Shape.cpp",
Expand All @@ -196,7 +203,9 @@ if not _OPTIONS["no-enet"] then
"../../examples/SharedMemory/plugins/stablePDPlugin/BulletConversion.cpp",
"../../examples/SharedMemory/plugins/stablePDPlugin/BulletConversion.h",
}

end


if _OPTIONS["enable_physx"] then
defines {"BT_ENABLE_PHYSX","PX_PHYSX_STATIC_LIB", "PX_FOUNDATION_DLL=0"}

Expand Down
Loading

0 comments on commit 226819b

Please sign in to comment.