diff --git a/build3/premake4.lua b/build3/premake4.lua index 45ff4560b..797e5c4f4 100644 --- a/build3/premake4.lua +++ b/build3/premake4.lua @@ -121,7 +121,6 @@ include "../examples/HelloWorld" include "../examples/BasicDemo" - include "../examples/MultiBody" diff --git a/examples/ExampleBrowser/CMakeLists.txt b/examples/ExampleBrowser/CMakeLists.txt index c6c183003..ecf803d47 100644 --- a/examples/ExampleBrowser/CMakeLists.txt +++ b/examples/ExampleBrowser/CMakeLists.txt @@ -74,8 +74,6 @@ SET(App_ExampleBrowser_SRCS ../MultiBody/TestJointTorqueSetup.h ../MultiBody/MultiDofDemo.cpp ../MultiBody/MultiDofDemo.h - ../MultiBody/MultiBodyCustomURDFDemo.cpp - ../MultiBody/MultiBodyCustomURDFDemo.h ../Constraints/ConstraintDemo.cpp ../Constraints/ConstraintDemo.h ../Constraints/Dof6Spring2Setup.cpp diff --git a/examples/ExampleBrowser/ExampleEntries.cpp b/examples/ExampleBrowser/ExampleEntries.cpp index 3c42780c5..65cc9a449 100644 --- a/examples/ExampleBrowser/ExampleEntries.cpp +++ b/examples/ExampleBrowser/ExampleEntries.cpp @@ -21,7 +21,6 @@ #include "../Constraints/ConstraintPhysicsSetup.h" #include "../MultiBody/TestJointTorqueSetup.h" #include "../MultiBody/MultiDofDemo.h" -#include "../MultiBody/MultiBodyCustomURDFDemo.h" #include "../VoronoiFracture/VoronoiFractureDemo.h" #include "../SoftDemo/SoftDemo.h" #include "../Constraints/ConstraintDemo.h" @@ -68,7 +67,6 @@ static ExampleEntry gDefaultExamples[]= ExampleEntry(0,"MultiBody"), ExampleEntry(1,"MultiDofCreateFunc","Create a basic btMultiBody.", MultiDofCreateFunc), ExampleEntry(1,"TestJointTorque","Apply a torque to a btMultiBody.", TestJointTorqueCreateFunc), - ExampleEntry(1,"Custom URDF","Load a URDF file to allow creation of custom data structures.", MultiBodyCustomURDFDemoCreateFunc), #ifdef INCLUDE_CLOTH_DEMOS diff --git a/examples/ExampleBrowser/premake4.lua b/examples/ExampleBrowser/premake4.lua index db8537ebd..e6bc81ce7 100644 --- a/examples/ExampleBrowser/premake4.lua +++ b/examples/ExampleBrowser/premake4.lua @@ -32,7 +32,6 @@ "../SoftDemo/*", "../Constraints/*", "../Vehicles/*", - "../MultiBody/MultiBodyCustomURDFDemo.cpp", "../MultiBody/MultiDofDemo.cpp", "../MultiBody/TestJointTorqueSetup.cpp", "../ThirdPartyLibs/Wavefront/tiny_obj_loader.*", diff --git a/examples/MultiBody/CustomMultiBodyCreationCallback.h b/examples/MultiBody/CustomMultiBodyCreationCallback.h deleted file mode 100644 index 7e013d38f..000000000 --- a/examples/MultiBody/CustomMultiBodyCreationCallback.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 2015 Google - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef CUSTOM_MULTIBODY_CALLBACK_H -#define CUSTOM_MULTIBODY_CALLBACK_H - -#ifdef USE_EIGEN - typedef Eigen::Quaternion QuaternionType; - typedef Eigen::Vector3d Vector3dType; - typedef double ScalarType; -#else - typedef btQuaternion QuaternionType; - typedef btVector3 Vector3dType; - typedef btScalar ScalarType; -#endif - -class CustomMultiBodyCreationCallback -{ - -public: - - virtual ~CustomMultiBodyCreationCallback() {} - - enum { - RevoluteJoint=1, - PrismaticJoint, - FixedJoint, - }; - - virtual int allocateMultiBodyBase(int urdfLinkIndex, int totalNumJoints,ScalarType baseMass, const Vector3dType& localInertiaDiagonal, bool isFixedBase) const =0; - - virtual void addLinkAndJoint(int jointType, int linkIndex, // 0 to num_links-1 - int parentIndex, - double mass, - const Vector3dType& inertia, - const QuaternionType &rotParentFrameToLinkFrame, // rotate points in parent frame to this frame, when q = 0 - const Vector3dType& jointAxisInLinkFrame, // in Link frame - const Vector3dType& parentComToThisJointOffset, // vector from parent COM to joint frame, in Parent frame - const Vector3dType& thisJointToThisComOffset) = 0; // vector from joint frame to my COM, in Link frame); - -// @todo: Decide if we need this link mapping? -// virtual void addLinkMapping(int urdfLinkIndex, int mbLinkIndex) const = 0; -}; - -#endif //CUSTOM_MULTIBODY_CALLBACK_H diff --git a/examples/MultiBody/MultiBodyCustomURDFDemo.cpp b/examples/MultiBody/MultiBodyCustomURDFDemo.cpp deleted file mode 100644 index 8c41d0b06..000000000 --- a/examples/MultiBody/MultiBodyCustomURDFDemo.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (C) 2015 Google - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "MultiBodyCustomURDFDemo.h" - -#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h" - -#include "../CommonInterfaces/CommonMultiBodyBase.h" - -#include "../Importers/ImportURDFDemo/URDF2Bullet.h" -#include "../Importers/ImportURDFDemo/MyURDFImporter.h" -#include "../Importers/ImportURDFDemo/MyMultiBodyCreator.h" - -#include "CustomMultiBodyCreationCallback.h" - - -struct MultiBodyCustomURDFDemo : public CommonMultiBodyBase -{ - btMultiBody* m_multiBody; - -public: - - MultiBodyCustomURDFDemo(struct GUIHelperInterface* helper); - virtual ~MultiBodyCustomURDFDemo(); - - virtual void initPhysics(); - - virtual void stepSimulation(float deltaTime); - -}; - -MultiBodyCustomURDFDemo::MultiBodyCustomURDFDemo(struct GUIHelperInterface* helper) -:CommonMultiBodyBase(helper) -{ -} - -MultiBodyCustomURDFDemo::~MultiBodyCustomURDFDemo() -{ - -} - - -static void myPrintTree(const URDFImporterInterface& u2b, int linkIndex, int indentationLevel) -{ - btAlignedObjectArray childIndices; - u2b.getLinkChildIndices(linkIndex,childIndices); - - int numChildren = childIndices.size(); - - indentationLevel+=2; - int count = 0; - for (int i=0;isetUpAxis(upAxis); - createEmptyDynamicsWorld(); - btVector3 grav(0,0,0); - //grav[upAxis] = -10.f; - - m_dynamicsWorld->setGravity(grav); - - m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld); - - - - MyURDFImporter u2b(m_guiHelper); - bool loadOk = u2b.loadURDF("r2d2.urdf"); - - if (loadOk) - { - u2b.printTree(); - int urdfRootLinkIndex = u2b.getRootLinkIndex(); - myPrintTree(u2b,urdfRootLinkIndex,0); - - btTransform identityTrans; - identityTrans.setIdentity(); - - btMultiBody* mb = 0; - - - //todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user - int rootLinkIndex = u2b.getRootLinkIndex(); - printf("urdf root link index = %d\n",rootLinkIndex); - MyMultiBodyCreator creation(m_guiHelper); - - bool useMultiBody = true; - - ConvertURDF2Bullet(u2b,creation, identityTrans,m_dynamicsWorld,useMultiBody,u2b.getPathPrefix()); - mb = creation.getBulletMultiBody(); - - } -} - -void MultiBodyCustomURDFDemo::stepSimulation(float deltaTime) -{ - m_dynamicsWorld->stepSimulation(deltaTime); -} - - -class CommonExampleInterface* MultiBodyCustomURDFDemoCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option) -{ - return new MultiBodyCustomURDFDemo(helper); -} \ No newline at end of file diff --git a/examples/MultiBody/MultiBodyCustomURDFDemo.h b/examples/MultiBody/MultiBodyCustomURDFDemo.h deleted file mode 100644 index c84f2aa14..000000000 --- a/examples/MultiBody/MultiBodyCustomURDFDemo.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (C) 2015 Google - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef MULTI_DOF_CUSTOM_URDF_DEMO_H -#define MULTI_DOF_CUSTOM_URDF_DEMO_H - -class CommonExampleInterface* MultiBodyCustomURDFDemoCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option); - -#endif //MULTI_DOF_CUSTOM_URDF_DEMO_H diff --git a/examples/MultiBody/main.cpp b/examples/MultiBody/main.cpp deleted file mode 100644 index 54ee65a2a..000000000 --- a/examples/MultiBody/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2015 Google Inc. http://bulletphysics.org - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "MultiBodyCustomURDFDemo.h" - -#include "../CommonInterfaces/CommonExampleInterface.h" -#include "../CommonInterfaces/CommonGUIHelperInterface.h" - - - - -int main(int argc, char* argv[]) -{ - struct PhysicsInterface* pint = 0; - - DummyGUIHelper noGfx; - - int option = 0; - - CommonExampleInterface* example = MultiBodyCustomURDFDemoCreateFunc(pint, &noGfx, option); - - example->initPhysics(); - example->stepSimulation(1.f/60.f); - example->exitPhysics(); - - delete example; - - return 0; -} - diff --git a/examples/MultiBody/premake4.lua b/examples/MultiBody/premake4.lua deleted file mode 100644 index 9959f7c65..000000000 --- a/examples/MultiBody/premake4.lua +++ /dev/null @@ -1,40 +0,0 @@ - -project "App_CustomMultiBodyCreation" - -if _OPTIONS["ios"] then - kind "WindowedApp" -else - kind "ConsoleApp" -end - -includedirs {".", "../../src", "../ThirdPartyLibs"} - -links { - "Bullet3Common", "BulletDynamics","BulletCollision", "LinearMath" -} - -language "C++" - -files { - "MultiBodyCustomURDFDemo.cpp", - "main.cpp", - "../Importers/ImportURDFDemo/URDF2Bullet.cpp", - "../Importers/ImportURDFDemo/MyURDFImporter.cpp", - "../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp", - "../Importers/ImportObjDemo/LoadMeshFromObj.cpp", - "../Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp", - "../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp", - "../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp", - "../ThirdPartyLibs/tinyxml/tinystr.cpp", - "../ThirdPartyLibs/tinyxml/tinyxml.cpp", - "../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp", - "../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp", - "../ThirdPartyLibs/urdf/boost_replacement/printf_console.cpp", - "../ThirdPartyLibs/urdf/boost_replacement/string_split.cpp", - "../ThirdPartyLibs/urdf/urdfdom/urdf_parser/src/pose.cpp", - "../ThirdPartyLibs/urdf/urdfdom/urdf_parser/src/model.cpp", - "../ThirdPartyLibs/urdf/urdfdom/urdf_parser/src/link.cpp", - "../ThirdPartyLibs/urdf/urdfdom/urdf_parser/src/joint.cpp", - -} -