clean test scripts
This commit is contained in:
@@ -143,6 +143,8 @@ struct TinyRendererVisualShapeConverterInternalData
|
|||||||
ci.m_title = "Title";
|
ci.m_title = "Title";
|
||||||
ci.m_width = m_swWidth;
|
ci.m_width = m_swWidth;
|
||||||
ci.m_height = m_swHeight;
|
ci.m_height = m_swHeight;
|
||||||
|
ci.m_renderDevice = 0;
|
||||||
|
|
||||||
m_window->createWindow(ci);
|
m_window->createWindow(ci);
|
||||||
m_window->setWindowTitle(ci.m_title);
|
m_window->setWindowTitle(ci.m_title);
|
||||||
b3Assert(glGetError() ==GL_NO_ERROR);
|
b3Assert(glGetError() ==GL_NO_ERROR);
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ pitch = -10.0
|
|||||||
roll=0
|
roll=0
|
||||||
upAxisIndex = 2
|
upAxisIndex = 2
|
||||||
camDistance = 4
|
camDistance = 4
|
||||||
pixelWidth = 320
|
pixelWidth = 84 # 320
|
||||||
pixelHeight = 200
|
pixelHeight = 84 # 200
|
||||||
nearPlane = 0.01
|
nearPlane = 0.01
|
||||||
farPlane = 100
|
farPlane = 100
|
||||||
fov = 60
|
fov = 60
|
||||||
@@ -57,7 +57,7 @@ class BulletSim():
|
|||||||
def __exit__(self,*_,**__):
|
def __exit__(self,*_,**__):
|
||||||
pybullet.disconnect()
|
pybullet.disconnect()
|
||||||
|
|
||||||
def test(num_runs=100, shadow=1, log=True, plot=False):
|
def test(num_runs=300, shadow=1, log=True, plot=False):
|
||||||
if log:
|
if log:
|
||||||
logId = pybullet.startStateLogging(pybullet.STATE_LOGGING_PROFILE_TIMINGS, "renderTimings")
|
logId = pybullet.startStateLogging(pybullet.STATE_LOGGING_PROFILE_TIMINGS, "renderTimings")
|
||||||
|
|
||||||
@@ -102,33 +102,45 @@ def test(num_runs=100, shadow=1, log=True, plot=False):
|
|||||||
#plt.show()
|
#plt.show()
|
||||||
plt.pause(0.01)
|
plt.pause(0.01)
|
||||||
|
|
||||||
print("mean: {0} for {1} runs".format(np.mean(times), num_runs))
|
mean_time = float(np.mean(times))
|
||||||
|
print("mean: {0} for {1} runs".format(mean_time, num_runs))
|
||||||
print("")
|
print("")
|
||||||
if log:
|
if log:
|
||||||
pybullet.stopStateLogging(logId)
|
pybullet.stopStateLogging(logId)
|
||||||
|
return mean_time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
|
||||||
|
res = []
|
||||||
|
|
||||||
with BulletSim(pybullet.DIRECT):
|
with BulletSim(pybullet.DIRECT):
|
||||||
print("\nTesting DIRECT")
|
print("\nTesting DIRECT")
|
||||||
test(log=False)
|
mean_time = test(log=False,plot=True)
|
||||||
|
res.append(("tiny",mean_time))
|
||||||
|
|
||||||
|
|
||||||
with BulletSim(pybullet.DIRECT):
|
with BulletSim(pybullet.DIRECT):
|
||||||
plugin_fn = '/home/argusm/lang/bullet3/build/lib.linux-x86_64-3.5/eglRenderer.cpython-35m-x86_64-linux-gnu.so'
|
plugin_fn = os.path.join(pybullet.__file__.split("bullet3")[0],"bullet3/build/lib.linux-x86_64-3.5/eglRenderer.cpython-35m-x86_64-linux-gnu.so")
|
||||||
plugin = pybullet.loadPlugin(plugin_fn,"_tinyRendererPlugin")
|
plugin = pybullet.loadPlugin(plugin_fn,"_tinyRendererPlugin")
|
||||||
if plugin < 0:
|
if plugin < 0:
|
||||||
print("\nPlugin Failed to load!\n")
|
print("\nPlugin Failed to load!\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
print("\nTesting DIRECT+OpenGL")
|
print("\nTesting DIRECT+OpenGL")
|
||||||
test()
|
mean_time = test(log=True)
|
||||||
|
res.append(("plugin",mean_time))
|
||||||
|
|
||||||
with BulletSim(pybullet.GUI):
|
with BulletSim(pybullet.GUI):
|
||||||
print("\nTesting GUI")
|
print("\nTesting GUI")
|
||||||
test(log=False)
|
mean_time = test(log=False)
|
||||||
|
res.append(("egl",mean_time))
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("rendertest.py")
|
||||||
|
print("back nenv fps fps_tot")
|
||||||
|
for r in res:
|
||||||
|
print(r[0],"\t",1,round(r[1]),"\t",round(r[1]))
|
||||||
|
|
||||||
|
|||||||
@@ -42,18 +42,22 @@ class TestEnv(gym.Env):
|
|||||||
self._render_width = 84
|
self._render_width = 84
|
||||||
self._render_height = 84
|
self._render_height = 84
|
||||||
# connecting
|
# connecting
|
||||||
if self._renderer == "tiny":
|
if self._renderer == "tiny" or self._renderer == "plugin":
|
||||||
optionstring='--width={} --height={}'.format(self._render_width,self._render_height)
|
optionstring='--width={} --height={}'.format(self._render_width,self._render_height)
|
||||||
p.connect(p.DIRECT, options=optionstring)
|
p.connect(p.DIRECT, options=optionstring)
|
||||||
|
|
||||||
|
if self._renderer == "plugin":
|
||||||
|
plugin_fn = os.path.join(p.__file__.split("bullet3")[0],"bullet3/build/lib.linux-x86_64-3.5/eglRenderer.cpython-35m-x86_64-linux-gnu.so")
|
||||||
|
plugin = p.loadPlugin(plugin_fn,"_tinyRendererPlugin")
|
||||||
|
if plugin < 0:
|
||||||
|
print("\nPlugin Failed to load! Try installing via `pip install -e .`\n")
|
||||||
|
sys.exit()
|
||||||
|
print("plugin =",plugin)
|
||||||
|
|
||||||
elif self._renderer == "egl":
|
elif self._renderer == "egl":
|
||||||
optionstring='--width={} --height={}'.format(self._render_width,self._render_height)
|
optionstring='--width={} --height={}'.format(self._render_width,self._render_height)
|
||||||
optionstring += ' --window_backend=2 --render_device=0'
|
optionstring += ' --window_backend=2 --render_device=0'
|
||||||
p.connect(p.GUI, options=optionstring)
|
p.connect(p.GUI, options=optionstring)
|
||||||
p.configureDebugVisualizer(p.COV_ENABLE_GUI,0)
|
|
||||||
p.configureDebugVisualizer(p.COV_ENABLE_SEGMENTATION_MARK_PREVIEW,0)
|
|
||||||
p.configureDebugVisualizer(p.COV_ENABLE_DEPTH_BUFFER_PREVIEW,0)
|
|
||||||
p.configureDebugVisualizer(p.COV_ENABLE_RGB_BUFFER_PREVIEW,0)
|
|
||||||
|
|
||||||
elif self._renderer == "debug":
|
elif self._renderer == "debug":
|
||||||
#print("Connection: SHARED_MEMORY")
|
#print("Connection: SHARED_MEMORY")
|
||||||
@@ -62,14 +66,11 @@ class TestEnv(gym.Env):
|
|||||||
cid = p.connect(p.GUI)
|
cid = p.connect(p.GUI)
|
||||||
p.resetDebugVisualizerCamera(1.3,180,-41,[0.52,-0.2,-0.33])
|
p.resetDebugVisualizerCamera(1.3,180,-41,[0.52,-0.2,-0.33])
|
||||||
|
|
||||||
elif self._renderer == "plugin":
|
p.configureDebugVisualizer(p.COV_ENABLE_GUI,0)
|
||||||
p.connect(p.DIRECT)
|
p.configureDebugVisualizer(p.COV_ENABLE_SEGMENTATION_MARK_PREVIEW,0)
|
||||||
plugin_fn = os.path.join(p.__file__.split("bullet3")[0],"bullet3/build/lib.linux-x86_64-3.5/eglRenderer.cpython-35m-x86_64-linux-gnu.so")
|
p.configureDebugVisualizer(p.COV_ENABLE_DEPTH_BUFFER_PREVIEW,0)
|
||||||
plugin = p.loadPlugin(plugin_fn,"_tinyRendererPlugin")
|
p.configureDebugVisualizer(p.COV_ENABLE_RGB_BUFFER_PREVIEW,0)
|
||||||
if plugin < 0:
|
|
||||||
print("\nPlugin Failed to load! Try installing via `pip install -e .`\n")
|
|
||||||
sys.exit()
|
|
||||||
print("plugin =",plugin)
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
p.disconnect()
|
p.disconnect()
|
||||||
@@ -129,11 +130,13 @@ if __name__ == "__main__":
|
|||||||
env_id = "TestEnv"
|
env_id = "TestEnv"
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
for renderer in ('plugin', 'tiny', 'egl'):
|
for renderer in ('tiny','plugin', 'egl'):
|
||||||
for i in (1,8):
|
for i in (1,8):
|
||||||
tmp = train(env_id,num_env=i,renderer=renderer)
|
tmp = train(env_id,num_env=i,renderer=renderer)
|
||||||
print(renderer,tmp)
|
print(renderer,tmp)
|
||||||
res.append((renderer,tmp))
|
res.append((renderer,tmp))
|
||||||
print()
|
print()
|
||||||
|
print("rendertest_sync.py")
|
||||||
|
print("back nenv fps fps_tot")
|
||||||
for renderer,i in res:
|
for renderer,i in res:
|
||||||
print(renderer, i,i[0]*i[1])
|
print(renderer,'\t', i[0],round(i[1]),'\t',round(i[0]*i[1]))
|
||||||
|
|||||||
Reference in New Issue
Block a user