From d909448ee3a08ddd4506646ee89303da763fce04 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Wed, 12 Sep 2018 21:03:07 -0700 Subject: [PATCH 1/3] bump up pybullet version again --- examples/pybullet/examples/collisionFilter.py | 3 ++- .../pybullet/examples/mylittleminitaur.py | 21 ------------------- setup.py | 10 ++++----- 3 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 examples/pybullet/examples/mylittleminitaur.py diff --git a/examples/pybullet/examples/collisionFilter.py b/examples/pybullet/examples/collisionFilter.py index ca7108891..e94b1f0f3 100644 --- a/examples/pybullet/examples/collisionFilter.py +++ b/examples/pybullet/examples/collisionFilter.py @@ -14,4 +14,5 @@ p.setCollisionFilterPair(planeId, cubeId,-1,-1,enableCollision ) p.setRealTimeSimulation(1) p.setGravity(0,0,-10) while (p.isConnected()): - time.sleep(1) \ No newline at end of file + time.sleep(1./240.) + p.setGravity(0,0,-10) diff --git a/examples/pybullet/examples/mylittleminitaur.py b/examples/pybullet/examples/mylittleminitaur.py deleted file mode 100644 index fd1ad4718..000000000 --- a/examples/pybullet/examples/mylittleminitaur.py +++ /dev/null @@ -1,21 +0,0 @@ -import pybullet as p -import time -import math -import sys -sys.path.append(".") - -from minitaur import Minitaur -p.connect(p.GUI) -p.setTimeOut(5) -#p.setPhysicsEngineParameter(numSolverIterations=50) -p.setGravity(0,0,-10) -p.setTimeStep(0.01) - -urdfRoot = '' -p.loadURDF("%s/plane.urdf" % urdfRoot) -minitaur = Minitaur(urdfRoot) - -while (True): - p.stepSimulation() - time.sleep(0.01) - \ No newline at end of file diff --git a/setup.py b/setup.py index 075df915e..204e369a6 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,6 @@ CXX_FLAGS += '-DBT_USE_DOUBLE_PRECISION ' CXX_FLAGS += '-DBT_ENABLE_ENET ' CXX_FLAGS += '-DBT_ENABLE_CLSOCKET ' CXX_FLAGS += '-DB3_DUMP_PYTHON_VERSION ' -CXX_FLAGS += '-DBT_USE_EGL ' EGL_CXX_FLAGS = '' @@ -451,6 +450,10 @@ egl_renderer_sources = \ +["examples/OpenGLWindow/LoadShader.cpp"] \ +["src/LinearMath/btQuickprof.cpp"] +if 'BT_USE_EGL' in CXX_FLAGS: + sources += ['examples/ThirdPartyLibs/glad/egl.c'] + sources += ['examples/OpenGLWindow/EGLOpenGLWindow.cpp'] + if _platform == "linux" or _platform == "linux2": libraries = ['dl','pthread'] CXX_FLAGS += '-D_LINUX ' @@ -468,9 +471,6 @@ if _platform == "linux" or _platform == "linux2": +["examples/ThirdPartyLibs/glad/gl.c"]\ +["examples/ThirdPartyLibs/glad/glx.c"] include_dirs += ["examples/ThirdPartyLibs/optionalX11"] - if 'BT_USE_EGL' in CXX_FLAGS: - sources += ['examples/ThirdPartyLibs/glad/egl.c'] - sources += ['examples/OpenGLWindow/EGLOpenGLWindow.cpp'] if 'BT_USE_EGL' in EGL_CXX_FLAGS: egl_renderer_sources = egl_renderer_sources\ @@ -545,7 +545,7 @@ eglRender = Extension("eglRenderer", setup( name = 'pybullet', - version='2.1.5', + version='2.1.6', 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', From b0971b4beb0cd73094ea3cacc0421016a7b752e7 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 13 Sep 2018 10:20:38 -0700 Subject: [PATCH 2/3] fix our internal build --- examples/OpenGLWindow/X11OpenGLWindow.cpp | 4 ---- examples/SharedMemory/grpc/main.cpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/OpenGLWindow/X11OpenGLWindow.cpp b/examples/OpenGLWindow/X11OpenGLWindow.cpp index 645e95b52..ddd3a1311 100644 --- a/examples/OpenGLWindow/X11OpenGLWindow.cpp +++ b/examples/OpenGLWindow/X11OpenGLWindow.cpp @@ -6,11 +6,7 @@ #include #include -#ifdef GLEW_STATIC #include "glad/gl.h" -#else -#include -#endif//GLEW_STATIC #ifdef GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS #include "glad/glx.h" diff --git a/examples/SharedMemory/grpc/main.cpp b/examples/SharedMemory/grpc/main.cpp index 61306c26e..5560abd55 100644 --- a/examples/SharedMemory/grpc/main.cpp +++ b/examples/SharedMemory/grpc/main.cpp @@ -28,7 +28,7 @@ typedef SharedMemoryCommandProcessor MyCommandProcessor; #include #include -#include "proto/pybullet.grpc.pb.h" +#include "SharedMemory/grpc/proto/pybullet.grpc.pb.h" using grpc::Server; From e6d74580c163aa3ece2b368fde5fbd9ffdb95288 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Fri, 14 Sep 2018 17:17:11 -0700 Subject: [PATCH 3/3] add single step rendering feature: while (1): stepSimulation() pybullet.configureDebugVisualizer(pybullet.COV_ENABLE_SINGLE_STEP_RENDERING, 1) disable single step using pybullet.configureDebugVisualizer(pybullet.COV_ENABLE_SINGLE_STEP_RENDERING, 0) --- examples/ExampleBrowser/OpenGLExampleBrowser.cpp | 7 +++++++ examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 2 ++ examples/SharedMemory/SharedMemoryPublic.h | 2 +- examples/pybullet/pybullet.c | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/ExampleBrowser/OpenGLExampleBrowser.cpp b/examples/ExampleBrowser/OpenGLExampleBrowser.cpp index e028efdbf..1d78d8215 100644 --- a/examples/ExampleBrowser/OpenGLExampleBrowser.cpp +++ b/examples/ExampleBrowser/OpenGLExampleBrowser.cpp @@ -390,6 +390,13 @@ void OpenGLExampleBrowserVisualizerFlagCallback(int flag, bool enable) { gEnableRenderLoop = (enable!=0); } + + if (flag == COV_ENABLE_SINGLE_STEP_RENDERING) + { + singleStepSimulation = true; + } + + if (flag == COV_ENABLE_SHADOWS) { useShadowMap = enable; diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index ab9f7fc23..5b32d13a3 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -1824,6 +1824,8 @@ void PhysicsServerCommandProcessor::setGuiHelper(struct GUIHelperInterface* guiH guiHelper->createPhysicsDebugDrawer(m_data->m_dynamicsWorld); } else { + //state loggers use guiHelper, so remove them before the guiHelper is deleted + deleteStateLoggers(); if (m_data->m_guiHelper && m_data->m_dynamicsWorld && m_data->m_dynamicsWorld->getDebugDrawer()) { diff --git a/examples/SharedMemory/SharedMemoryPublic.h b/examples/SharedMemory/SharedMemoryPublic.h index 55135dd22..a563fbad7 100644 --- a/examples/SharedMemory/SharedMemoryPublic.h +++ b/examples/SharedMemory/SharedMemoryPublic.h @@ -793,7 +793,7 @@ enum b3ConfigureDebugVisualizerEnum COV_ENABLE_DEPTH_BUFFER_PREVIEW, COV_ENABLE_SEGMENTATION_MARK_PREVIEW, COV_ENABLE_PLANAR_REFLECTION, - + COV_ENABLE_SINGLE_STEP_RENDERING, }; enum b3AddUserDebugItemEnum diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 9654d48a7..5a500c4ee 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -9815,6 +9815,7 @@ initpybullet(void) PyModule_AddIntConstant(m, "COV_ENABLE_DEPTH_BUFFER_PREVIEW", COV_ENABLE_DEPTH_BUFFER_PREVIEW); PyModule_AddIntConstant(m, "COV_ENABLE_SEGMENTATION_MARK_PREVIEW", COV_ENABLE_SEGMENTATION_MARK_PREVIEW); PyModule_AddIntConstant(m, "COV_ENABLE_PLANAR_REFLECTION", COV_ENABLE_PLANAR_REFLECTION); + PyModule_AddIntConstant(m, "COV_ENABLE_SINGLE_STEP_RENDERING", COV_ENABLE_SINGLE_STEP_RENDERING); PyModule_AddIntConstant(m, "ER_TINY_RENDERER", ER_TINY_RENDERER);