diff --git a/data/kuka_iiwa/meshes/coarse/link_0.stl b/data/kuka_iiwa/meshes/coarse/link_0.stl new file mode 100644 index 000000000..84b8ea5d2 Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_0.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_1.stl b/data/kuka_iiwa/meshes/coarse/link_1.stl new file mode 100644 index 000000000..ffe3ec981 Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_1.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_2.stl b/data/kuka_iiwa/meshes/coarse/link_2.stl new file mode 100644 index 000000000..4a51b27ef Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_2.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_3.stl b/data/kuka_iiwa/meshes/coarse/link_3.stl new file mode 100644 index 000000000..32d6d5282 Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_3.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_4.stl b/data/kuka_iiwa/meshes/coarse/link_4.stl new file mode 100644 index 000000000..35d192181 Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_4.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_5.stl b/data/kuka_iiwa/meshes/coarse/link_5.stl new file mode 100644 index 000000000..35aa1245d Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_5.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_6.stl b/data/kuka_iiwa/meshes/coarse/link_6.stl new file mode 100644 index 000000000..bce349eb2 Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_6.stl differ diff --git a/data/kuka_iiwa/meshes/coarse/link_7.stl b/data/kuka_iiwa/meshes/coarse/link_7.stl new file mode 100644 index 000000000..2d5d6ecfb Binary files /dev/null and b/data/kuka_iiwa/meshes/coarse/link_7.stl differ diff --git a/data/kuka_iiwa/meshes/link_0.stl b/data/kuka_iiwa/meshes/link_0.stl new file mode 100644 index 000000000..84b8ea5d2 Binary files /dev/null and b/data/kuka_iiwa/meshes/link_0.stl differ diff --git a/data/kuka_iiwa/meshes/link_1.stl b/data/kuka_iiwa/meshes/link_1.stl new file mode 100644 index 000000000..e8e37de9f Binary files /dev/null and b/data/kuka_iiwa/meshes/link_1.stl differ diff --git a/data/kuka_iiwa/meshes/link_2.stl b/data/kuka_iiwa/meshes/link_2.stl new file mode 100644 index 000000000..47c7885fc Binary files /dev/null and b/data/kuka_iiwa/meshes/link_2.stl differ diff --git a/data/kuka_iiwa/meshes/link_3.stl b/data/kuka_iiwa/meshes/link_3.stl new file mode 100644 index 000000000..027eb2211 Binary files /dev/null and b/data/kuka_iiwa/meshes/link_3.stl differ diff --git a/data/kuka_iiwa/meshes/link_4.stl b/data/kuka_iiwa/meshes/link_4.stl new file mode 100644 index 000000000..c0c1213c1 Binary files /dev/null and b/data/kuka_iiwa/meshes/link_4.stl differ diff --git a/data/kuka_iiwa/meshes/link_5.stl b/data/kuka_iiwa/meshes/link_5.stl new file mode 100644 index 000000000..82a9337a6 Binary files /dev/null and b/data/kuka_iiwa/meshes/link_5.stl differ diff --git a/data/kuka_iiwa/meshes/link_6.stl b/data/kuka_iiwa/meshes/link_6.stl new file mode 100644 index 000000000..10b558dc5 Binary files /dev/null and b/data/kuka_iiwa/meshes/link_6.stl differ diff --git a/data/kuka_iiwa/meshes/link_7.stl b/data/kuka_iiwa/meshes/link_7.stl new file mode 100644 index 000000000..5909e7e01 Binary files /dev/null and b/data/kuka_iiwa/meshes/link_7.stl differ diff --git a/data/kuka_iiwa/model.urdf b/data/kuka_iiwa/model.urdf new file mode 100644 index 000000000..0b290946a --- /dev/null +++ b/data/kuka_iiwa/model.urdf @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp index b934d9000..d2be60000 100644 --- a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp +++ b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp @@ -219,11 +219,10 @@ void ConvertURDF2BulletInternal(const URDFImporterInterface& u2b, MultiBodyCreat color.setValue(visual->material->color.r,visual->material->color.g,visual->material->color.b);//,visual->material->color.a); } */ - //btVector3 localInertiaDiagonal(0, 0, 0); - //if (mass) - //{ - // shape->calculateLocalInertia(mass, localInertiaDiagonal); - //} + if (mass) + { + compoundShape->calculateLocalInertia(mass, localInertiaDiagonal); + } btRigidBody* linkRigidBody = 0; btTransform inertialFrameInWorldSpace = linkTransformInWorldSpace*localInertialFrame; diff --git a/examples/SharedMemory/PhysicsClientExample.cpp b/examples/SharedMemory/PhysicsClientExample.cpp index 7e9c0119c..7169450fb 100644 --- a/examples/SharedMemory/PhysicsClientExample.cpp +++ b/examples/SharedMemory/PhysicsClientExample.cpp @@ -41,7 +41,7 @@ protected: public: //@todo, add accessor methods - MyMotorInfo2 m_motorTargetVelocities[MAX_NUM_MOTORS]; + // MyMotorInfo2 m_motorTargetVelocities[MAX_NUM_MOTORS]; MyMotorInfo2 m_motorTargetPositions[MAX_NUM_MOTORS]; int m_numMotors; @@ -140,12 +140,15 @@ public: for (int i=0;i=0) { b3SharedMemoryCommandHandle commandHandle = b3RequestActualStateCommandInit(m_physicsClientHandle,m_selectedBody); + b3SharedMemoryStatusHandle statusHandle = b3SubmitClientCommandAndWaitStatus(m_physicsClientHandle, commandHandle); b3SubmitClientCommand(m_physicsClientHandle, commandHandle); + + int numJoints = b3GetNumJoints(m_physicsClientHandle, m_selectedBody); + for (int i = 0; i < numJoints; ++i) { + struct b3JointSensorState sensorState; + b3GetJointState(m_physicsClientHandle, statusHandle, i, &sensorState); + b3Printf("Joint %d: %f", i, sensorState.m_jointMotorTorque); + } } break; }; @@ -315,7 +326,8 @@ void PhysicsClientExample::prepareAndSubmitCommand(int commandId) } case CMD_SEND_DESIRED_STATE: { - b3SharedMemoryCommandHandle command = b3JointControlCommandInit( m_physicsClientHandle, CONTROL_MODE_VELOCITY); + // b3SharedMemoryCommandHandle command = b3JointControlCommandInit( m_physicsClientHandle, CONTROL_MODE_VELOCITY); + b3SharedMemoryCommandHandle command = b3JointControlCommandInit( m_physicsClientHandle, CONTROL_MODE_POSITION_VELOCITY_PD); prepareControlCommand(command); b3SubmitClientCommand(m_physicsClientHandle, command); break; @@ -337,6 +349,12 @@ void PhysicsClientExample::prepareAndSubmitCommand(int commandId) break; } + case CMD_SEND_PHYSICS_SIMULATION_PARAMETERS: { + b3SharedMemoryCommandHandle commandHandle = b3InitPhysicsParamCommand(m_physicsClientHandle); + b3PhysicsParamSetGravity(commandHandle, 0.0, 0.0, -9.8); + b3SubmitClientCommandAndWaitStatus(m_physicsClientHandle, commandHandle); + break; + } default: { b3Error("Unknown buttonId"); @@ -394,6 +412,7 @@ void PhysicsClientExample::createButtons() createButton("Create Cylinder Body",CMD_CREATE_RIGID_BODY,isTrigger); createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger); createButton("Initialize Pose",CMD_INIT_POSE, isTrigger); + createButton("Set gravity", CMD_SEND_PHYSICS_SIMULATION_PARAMETERS, isTrigger); if (m_physicsClientHandle && m_selectedBody>=0) @@ -410,15 +429,20 @@ void PhysicsClientExample::createButtons() if (m_numMotorsm_velTarget = 0.f; + motorInfo->m_posTarget = 0.f; motorInfo->m_uIndex = info.m_uIndex; motorInfo->m_qIndex = info.m_qIndex; - SliderParams slider(motorName,&motorInfo->m_velTarget); - slider.m_minVal=-4; - slider.m_maxVal=4; + // SliderParams slider(motorName,&motorInfo->m_velTarget); + // slider.m_minVal=-4; + // slider.m_maxVal=4; + SliderParams slider(motorName,&motorInfo->m_posTarget); + slider.m_minVal=-4; + slider.m_maxVal=4; if (m_guiHelper && m_guiHelper->getParameterInterface()) { m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);