Merge pull request #1959 from erwincoumans/master

Use the kF_UseGjkConvexCastRaytest for more accurate picking, tweak tensorflow humanoid_running.py demo to be more robust
This commit is contained in:
erwincoumans
2018-10-28 19:53:01 -07:00
committed by GitHub
7 changed files with 16 additions and 7 deletions

View File

@@ -219,6 +219,7 @@ void convertMultiBody(T* mbd, btMultiBodyWorldImporterInternalData* m_data)
mb->setupPrismatic(i, mbd->m_links[i].m_linkMass, localInertiaDiagonal, mbd->m_links[i].m_parentIndex,
parentRotToThis, jointAxis, parentComToThisPivotOffset, thisPivotToThisComOffset, disableParentCollision);
mb->setJointPos(i, mbd->m_links[i].m_jointPos[0]);
mb->finalizeMultiDof();
mb->setJointVel(i, mbd->m_links[i].m_jointVel[0]);
break;
}
@@ -230,6 +231,7 @@ void convertMultiBody(T* mbd, btMultiBodyWorldImporterInternalData* m_data)
mb->setupRevolute(i, mbd->m_links[i].m_linkMass, localInertiaDiagonal, mbd->m_links[i].m_parentIndex,
parentRotToThis, jointAxis, parentComToThisPivotOffset, thisPivotToThisComOffset, disableParentCollision);
mb->setJointPos(i, mbd->m_links[i].m_jointPos[0]);
mb->finalizeMultiDof();
mb->setJointVel(i, mbd->m_links[i].m_jointVel[0]);
break;
}
@@ -242,6 +244,7 @@ void convertMultiBody(T* mbd, btMultiBodyWorldImporterInternalData* m_data)
btScalar jointPos[4] = {(btScalar)mbd->m_links[i].m_jointPos[0], (btScalar)mbd->m_links[i].m_jointPos[1], (btScalar)mbd->m_links[i].m_jointPos[2], (btScalar)mbd->m_links[i].m_jointPos[3]};
btScalar jointVel[3] = {(btScalar)mbd->m_links[i].m_jointVel[0], (btScalar)mbd->m_links[i].m_jointVel[1], (btScalar)mbd->m_links[i].m_jointVel[2]};
mb->setJointPosMultiDof(i, jointPos);
mb->finalizeMultiDof();
mb->setJointVelMultiDof(i, jointVel);
break;

View File

@@ -13,10 +13,10 @@ struct DrawGridData
int upAxis;
float gridColor[4];
DrawGridData(int upAxis = 1)
DrawGridData(int upAx = 1)
: gridSize(10),
upOffset(0.001f),
upAxis(upAxis)
upAxis(upAx)
{
gridColor[0] = 0.6f;
gridColor[1] = 0.6f;

View File

@@ -10,6 +10,7 @@
#include "CommonGraphicsAppInterface.h"
#include "CommonWindowInterface.h"
#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
struct CommonRigidBodyBase : public CommonExampleInterface
{
@@ -317,6 +318,7 @@ struct CommonRigidBodyBase : public CommonExampleInterface
btCollisionWorld::ClosestRayResultCallback rayCallback(rayFromWorld, rayToWorld);
rayCallback.m_flags |= btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest;
m_dynamicsWorld->rayTest(rayFromWorld, rayToWorld, rayCallback);
if (rayCallback.hasHit())
{

View File

@@ -78,7 +78,7 @@ struct SimpleInternalData
m_ffmpegFile(0),
m_renderTexture(0),
m_userPointer(0),
m_upAxis(0),
m_upAxis(1),
m_customViewPortWidth(-1),
m_customViewPortHeight(-1)
{

View File

@@ -10753,6 +10753,7 @@ bool PhysicsServerCommandProcessor::pickBody(const btVector3& rayFromWorld, cons
//btCollisionWorld::ClosestRayResultCallback rayCallback(rayFromWorld, rayToWorld);
MyResultCallback rayCallback(rayFromWorld, rayToWorld);
rayCallback.m_flags |= btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest;
m_data->m_dynamicsWorld->rayTest(rayFromWorld, rayToWorld, rayCallback);
if (rayCallback.hasHit())
{

View File

@@ -10,7 +10,7 @@ if (cid<0):
cid = p.connect(p.GUI) #DIRECT is much faster, but GUI shows the running gait
p.setGravity(0,0,-9.8)
p.setPhysicsEngineParameter(fixedTimeStep=1.0/60., numSolverIterations=5, numSubSteps=2)
p.setPhysicsEngineParameter(fixedTimeStep=1.0/60.,solverResidualThreshold=1-10, numSolverIterations=50, numSubSteps=4)
#this mp4 recording requires ffmpeg installed
#mp4log = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4,"humanoid.mp4")
@@ -180,11 +180,14 @@ def demo_run():
forces = [0.] * len(motors)
for m in range(len(motors)):
forces[m] = motor_power[m]*actions[m]*0.082
limit=15
ac = np.clip(actions[m],-limit,limit)
#print (ac)
forces[m] = motor_power[m]*ac*0.082
p.setJointMotorControlArray(human, motors,controlMode=p.TORQUE_CONTROL, forces=forces)
p.stepSimulation()
time.sleep(0.01)
#time.sleep(0.01)
distance=5
yaw = 0
humanPos, humanOrn = p.getBasePositionAndOrientation(human)

View File

@@ -582,7 +582,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS:
setup(
name = 'pybullet',
version='2.3.3',
version='2.3.4',
description='Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning',
long_description='pybullet is an easy to use Python module for physics simulation, robotics and deep reinforcement learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.',
url='https://github.com/bulletphysics/bullet3',