diff options
author | Erwin Coumans <erwincoumans@google.com> | 2019-03-26 15:07:55 -0700 |
---|---|---|
committer | Erwin Coumans <erwincoumans@google.com> | 2019-03-26 15:07:55 -0700 |
commit | 48988872653cd4082ce3217abd6822eab6b58440 (patch) | |
tree | 69f825147ed7065638f8af0207bbe195915f7465 | |
parent | 2ba8c2239709d449c7dd650cc7357aeffe3f1d4d (diff) | |
download | bullet3-48988872653cd4082ce3217abd6822eab6b58440.tar.gz |
temporary disable experimental BulletRobotics examples
-rw-r--r-- | examples/ExampleBrowser/ExampleEntries.cpp | 10 | ||||
-rw-r--r-- | examples/SharedMemory/BodyJointInfoUtility.h | 8 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsClient.h | 2 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsClientC_API.cpp | 11 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsClientC_API.h | 4 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsClientSharedMemory.cpp | 11 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsClientSharedMemory.h | 2 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsDirect.cpp | 16 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsDirect.h | 4 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsLoopBack.cpp | 9 | ||||
-rw-r--r-- | examples/SharedMemory/PhysicsLoopBack.h | 4 | ||||
-rw-r--r-- | examples/pybullet/gym/pybullet_envs/agents/utility.py | 2 | ||||
-rw-r--r-- | examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py | 2 |
13 files changed, 64 insertions, 21 deletions
diff --git a/examples/ExampleBrowser/ExampleEntries.cpp b/examples/ExampleBrowser/ExampleEntries.cpp index 15080e4dc..a299893f4 100644 --- a/examples/ExampleBrowser/ExampleEntries.cpp +++ b/examples/ExampleBrowser/ExampleEntries.cpp @@ -3,11 +3,6 @@ #include "../BlockSolver/BlockSolverExample.h" #include "LinearMath/btAlignedObjectArray.h" #include "EmptyExample.h" -#include "../BulletRobotics/BoxStack.h" -#include "../BulletRobotics/FixJointBoxes.h" -#include "../BulletRobotics/JointLimit.h" -// #include "../BulletRobotics/GraspBox.h" -#include "../BulletRobotics/FixJointBoxes.h" #include "../RenderingExamples/RenderInstancingDemo.h" #include "../RenderingExamples/CoordinateSystemDemo.h" #include "../RenderingExamples/RaytracerSetup.h" @@ -135,11 +130,6 @@ static ExampleEntry gDefaultExamples[] = ExampleEntry(1, "Soft Contact", "Using the error correction parameter (ERP) and constraint force mixing (CFM) values for contacts to simulate compliant contact.", RigidBodySoftContactCreateFunc), - ExampleEntry(0, "Bullet Robotics"), - ExampleEntry(1, "Box Stack", "Create a stack of boxes of large mass ratio.", BoxStackExampleCreateFunc), - ExampleEntry(1, "Joint Limit", "Create three objects joint together", JointLimitCreateFunc), - // ExampleEntry(1, "Grasp Box", "A robot arm of large mass tries to grasp a box of small mass", GraspBoxCreateFunc), - ExampleEntry(1, "FixJoint Boxes", "FixJoint Boxes", FixJointBoxesCreateFunc), ExampleEntry(0, "MultiBody"), ExampleEntry(1, "MultiDof", "Create a basic btMultiBody with 3-DOF spherical joints (mobilizers). The demo uses a fixed base or a floating base at restart.", MultiDofCreateFunc), diff --git a/examples/SharedMemory/BodyJointInfoUtility.h b/examples/SharedMemory/BodyJointInfoUtility.h index fc688b443..0be4814b2 100644 --- a/examples/SharedMemory/BodyJointInfoUtility.h +++ b/examples/SharedMemory/BodyJointInfoUtility.h @@ -21,6 +21,12 @@ inline char* strDup(const char* const str) template <typename T, typename U> void addJointInfoFromMultiBodyData(const T* mb, U* bodyJoints, bool verboseOutput) { + int numDofs = 0; + if (mb->m_baseMass>0) + { + numDofs = 6; + } + if (mb->m_baseName) { if (verboseOutput) @@ -107,7 +113,9 @@ void addJointInfoFromMultiBodyData(const T* mb, U* bodyJoints, bool verboseOutpu } qOffset += mb->m_links[link].m_posVarCount; uOffset += mb->m_links[link].m_dofCount; + numDofs += mb->m_links[link].m_dofCount; } + bodyJoints->m_numDofs = numDofs; } #endif //BODY_JOINT_INFO_UTILITY_H diff --git a/examples/SharedMemory/PhysicsClient.h b/examples/SharedMemory/PhysicsClient.h index 052f8f100..c09dce2be 100644 --- a/examples/SharedMemory/PhysicsClient.h +++ b/examples/SharedMemory/PhysicsClient.h @@ -33,6 +33,8 @@ public: virtual int getNumJoints(int bodyUniqueId) const = 0; + virtual int getNumDofs(int bodyUniqueId) const = 0; + virtual bool getJointInfo(int bodyUniqueId, int jointIndex, struct b3JointInfo& info) const = 0; virtual int getNumUserConstraints() const = 0; diff --git a/examples/SharedMemory/PhysicsClientC_API.cpp b/examples/SharedMemory/PhysicsClientC_API.cpp index 945ddc552..59285ad68 100644 --- a/examples/SharedMemory/PhysicsClientC_API.cpp +++ b/examples/SharedMemory/PhysicsClientC_API.cpp @@ -2526,6 +2526,12 @@ B3_SHARED_API int b3GetNumJoints(b3PhysicsClientHandle physClient, int bodyUniqu return cl->getNumJoints(bodyUniqueId); } +B3_SHARED_API int b3GetNumDofs(b3PhysicsClientHandle physClient, int bodyUniqueId) +{ + PhysicsClient* cl = (PhysicsClient*)physClient; + return cl->getNumDofs(bodyUniqueId); +} + B3_SHARED_API int b3ComputeDofCount(b3PhysicsClientHandle physClient, int bodyUniqueId) { int nj = b3GetNumJoints(physClient, bodyUniqueId); @@ -4642,8 +4648,9 @@ B3_SHARED_API b3SharedMemoryCommandHandle b3CalculateJacobianCommandInit(b3Physi command->m_calculateJacobianArguments.m_localPosition[0] = localPosition[0]; command->m_calculateJacobianArguments.m_localPosition[1] = localPosition[1]; command->m_calculateJacobianArguments.m_localPosition[2] = localPosition[2]; - int numJoints = cl->getNumJoints(bodyUniqueId); - for (int i = 0; i < numJoints; i++) + + int numDofs = cl->getNumDofs(bodyUniqueId); + for (int i = 0; i < numDofs; i++) { command->m_calculateJacobianArguments.m_jointPositionsQ[i] = jointPositionsQ[i]; command->m_calculateJacobianArguments.m_jointVelocitiesQdot[i] = jointVelocitiesQdot[i]; diff --git a/examples/SharedMemory/PhysicsClientC_API.h b/examples/SharedMemory/PhysicsClientC_API.h index 2b67887f0..6286233a9 100644 --- a/examples/SharedMemory/PhysicsClientC_API.h +++ b/examples/SharedMemory/PhysicsClientC_API.h @@ -118,7 +118,9 @@ extern "C" ///give a unique body index (after loading the body) return the number of joints. B3_SHARED_API int b3GetNumJoints(b3PhysicsClientHandle physClient, int bodyUniqueId); - + ///give a unique body index (after loading the body) return the number of degrees of freedom (DoF). + B3_SHARED_API int b3GetNumDofs(b3PhysicsClientHandle physClient, int bodyUniqueId); + ///compute the number of degrees of freedom for this body. ///Return -1 for unsupported spherical joint, -2 for unsupported planar joint. B3_SHARED_API int b3ComputeDofCount(b3PhysicsClientHandle physClient, int bodyUniqueId); diff --git a/examples/SharedMemory/PhysicsClientSharedMemory.cpp b/examples/SharedMemory/PhysicsClientSharedMemory.cpp index 168d862da..88dfe33cd 100644 --- a/examples/SharedMemory/PhysicsClientSharedMemory.cpp +++ b/examples/SharedMemory/PhysicsClientSharedMemory.cpp @@ -144,6 +144,17 @@ int PhysicsClientSharedMemory::getNumJoints(int bodyUniqueId) const return 0; } +int PhysicsClientSharedMemory::getNumDofs(int bodyUniqueId) const +{ + BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId]; + if (bodyJointsPtr && *bodyJointsPtr) + { + BodyJointInfoCache* bodyJoints = *bodyJointsPtr; + return bodyJoints->m_numDofs; + } + return 0; +} + bool PhysicsClientSharedMemory::getJointInfo(int bodyUniqueId, int jointIndex, b3JointInfo& info) const { BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId]; diff --git a/examples/SharedMemory/PhysicsClientSharedMemory.h b/examples/SharedMemory/PhysicsClientSharedMemory.h index 1ff437603..2b45ababc 100644 --- a/examples/SharedMemory/PhysicsClientSharedMemory.h +++ b/examples/SharedMemory/PhysicsClientSharedMemory.h @@ -45,6 +45,8 @@ public: virtual int getNumJoints(int bodyUniqueId) const; + virtual int getNumDofs(int bodyUniqueId) const; + virtual bool getJointInfo(int bodyUniqueId, int jointIndex, struct b3JointInfo& info) const; virtual int getNumUserConstraints() const; diff --git a/examples/SharedMemory/PhysicsDirect.cpp b/examples/SharedMemory/PhysicsDirect.cpp index fb5cc81e1..e7909e27d 100644 --- a/examples/SharedMemory/PhysicsDirect.cpp +++ b/examples/SharedMemory/PhysicsDirect.cpp @@ -1275,9 +1275,9 @@ bool PhysicsDirect::getBodyInfo(int bodyUniqueId, struct b3BodyInfo& info) const return false; } -int PhysicsDirect::getNumJoints(int bodyIndex) const +int PhysicsDirect::getNumJoints(int bodyUniqueId) const { - BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyIndex]; + BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId]; if (bodyJointsPtr && *bodyJointsPtr) { BodyJointInfoCache2* bodyJoints = *bodyJointsPtr; @@ -1287,6 +1287,18 @@ int PhysicsDirect::getNumJoints(int bodyIndex) const return 0; } +int PhysicsDirect::getNumDofs(int bodyUniqueId) const +{ + BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId]; + if (bodyJointsPtr && *bodyJointsPtr) + { + BodyJointInfoCache2* bodyJoints = *bodyJointsPtr; + return bodyJoints->m_numDofs; + } + btAssert(0); + return 0; +} + bool PhysicsDirect::getJointInfo(int bodyIndex, int jointIndex, struct b3JointInfo& info) const { BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyIndex]; diff --git a/examples/SharedMemory/PhysicsDirect.h b/examples/SharedMemory/PhysicsDirect.h index 128f0570a..9f5680b4d 100644 --- a/examples/SharedMemory/PhysicsDirect.h +++ b/examples/SharedMemory/PhysicsDirect.h @@ -61,7 +61,9 @@ public: virtual bool getBodyInfo(int bodyUniqueId, struct b3BodyInfo& info) const; - virtual int getNumJoints(int bodyIndex) const; + virtual int getNumJoints(int bodyUniqueId) const; + + virtual int getNumDofs(int bodyUniqueId) const; virtual bool getJointInfo(int bodyIndex, int jointIndex, struct b3JointInfo& info) const; diff --git a/examples/SharedMemory/PhysicsLoopBack.cpp b/examples/SharedMemory/PhysicsLoopBack.cpp index 1ad8d43eb..5b9d251df 100644 --- a/examples/SharedMemory/PhysicsLoopBack.cpp +++ b/examples/SharedMemory/PhysicsLoopBack.cpp @@ -107,9 +107,14 @@ bool PhysicsLoopBack::getBodyInfo(int bodyUniqueId, struct b3BodyInfo& info) con return m_data->m_physicsClient->getBodyInfo(bodyUniqueId, info); } -int PhysicsLoopBack::getNumJoints(int bodyIndex) const +int PhysicsLoopBack::getNumJoints(int bodyUniqueId) const { - return m_data->m_physicsClient->getNumJoints(bodyIndex); + return m_data->m_physicsClient->getNumJoints(bodyUniqueId); +} + +int PhysicsLoopBack::getNumDofs(int bodyUniqueId) const +{ + return m_data->m_physicsClient->getNumDofs(bodyUniqueId); } bool PhysicsLoopBack::getJointInfo(int bodyIndex, int jointIndex, struct b3JointInfo& info) const diff --git a/examples/SharedMemory/PhysicsLoopBack.h b/examples/SharedMemory/PhysicsLoopBack.h index cfa9a57ed..293e440bc 100644 --- a/examples/SharedMemory/PhysicsLoopBack.h +++ b/examples/SharedMemory/PhysicsLoopBack.h @@ -42,7 +42,9 @@ public: virtual bool getBodyInfo(int bodyUniqueId, struct b3BodyInfo& info) const; - virtual int getNumJoints(int bodyIndex) const; + virtual int getNumJoints(int bodyUniqueId) const; + + virtual int getNumDofs(int bodyUniqueId) const; virtual bool getJointInfo(int bodyIndex, int jointIndex, struct b3JointInfo& info) const; diff --git a/examples/pybullet/gym/pybullet_envs/agents/utility.py b/examples/pybullet/gym/pybullet_envs/agents/utility.py index 9e45fc127..0836a2ed2 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/utility.py +++ b/examples/pybullet/gym/pybullet_envs/agents/utility.py @@ -149,7 +149,7 @@ def save_config(config, logdir=None): tf.logging.info(message.format(config.logdir)) tf.gfile.MakeDirs(config.logdir) config_path = os.path.join(config.logdir, 'config.yaml') - with tf.gfile.FastGFile(config_path, 'w') as file_: + with tf.gfile.GFile(config_path, 'w') as file_: yaml.dump(config, file_, default_flow_style=False) else: message = ( diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py index 201ea8988..1342977c7 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py @@ -172,7 +172,7 @@ def save_config(config, logdir=None): tf.logging.info(message.format(config.logdir)) tf.gfile.MakeDirs(config.logdir) config_path = os.path.join(config.logdir, 'config.yaml') - with tf.gfile.FastGFile(config_path, 'w') as file_: + with tf.gfile.GFile(config_path, 'w') as file_: yaml.dump(config, file_, default_flow_style=False) else: message = ( |