Skip to content

Commit

Permalink
add compile guards for aba spd
Browse files Browse the repository at this point in the history
  • Loading branch information
arpspoof committed Sep 28, 2019
1 parent 939e07c commit 9088220
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ set(ALL_MODULE ${ALL_MODULE_NO_RENDERER} renderer_glut)
set(ALL_EXT_LIBS ${PX_LIBS} ${PX_LIBS} ${SYS_LIBS})


set(BUILD_SPD_ABA OFF CACHE BOOL "Choose whether to enable linear time SPD controller")

if(${BUILD_SPD_ABA})

add_compile_definitions(ENABLE_SPD_ABA)

endif()


set(BUILD_EXAMPLES ON CACHE BOOL "Choose whether c++ examples should be built")

if(${BUILD_EXAMPLES})
Expand Down
3 changes: 2 additions & 1 deletion src/articulation/Articulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,14 +560,15 @@ void Articulation::AddSPDForcesABA(const std::vector<float>& targetPositions, fl
}

pxArticulation->applyCache(*mainCache, PxArticulationCache::eFORCE);

#ifdef ENABLE_SPD_ABA
extern float g_SPD_Dt;
extern const float* g_SPD_Kd;
extern const int* g_SPD_LinkIdCacheIndexMap;

g_SPD_Dt = timeStep;
g_SPD_Kd = kds.data();
g_SPD_LinkIdCacheIndexMap = linkIdCacheIndexMap.data();
#endif
}

void Articulation::FetchKinematicData() const
Expand Down
1 change: 1 addition & 0 deletions wiki/SPDABA.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### How to Enable
* Apply resources/spd-aba.patch to PhysX git repo (not this one).
* Re-build PhysX (make && make install).
* Enable `BUILD_SPD_ABA` option when configuring this project.
* Do a **clean** build for this project. See [Build and set up](wiki/Setup.md) for details.
* Use AddSPDForcesABA instead of AddSPDForces to use linear time SPD controller

Expand Down

0 comments on commit 9088220

Please sign in to comment.