Merge remote-tracking branch 'bp/master'
This commit is contained in:
@@ -588,6 +588,10 @@ public:
|
||||
) :
|
||||
btDiscreteDynamicsWorldMt( dispatcher, pairCache, constraintSolver, collisionConfiguration )
|
||||
{
|
||||
#if USE_PARALLEL_ISLAND_SOLVER
|
||||
btSimulationIslandManagerMt* islandMgr = static_cast<btSimulationIslandManagerMt*>( m_islandManager );
|
||||
islandMgr->setIslandDispatchFunction( parallelIslandDispatch );
|
||||
#endif //#if USE_PARALLEL_ISLAND_SOLVER
|
||||
}
|
||||
|
||||
};
|
||||
@@ -762,14 +766,7 @@ void CommonRigidBodyMTBase::createEmptyDynamicsWorld()
|
||||
#endif //#if USE_PARALLEL_ISLAND_SOLVER
|
||||
btDiscreteDynamicsWorld* world = new MyDiscreteDynamicsWorld( m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration );
|
||||
m_dynamicsWorld = world;
|
||||
|
||||
#if USE_PARALLEL_ISLAND_SOLVER
|
||||
if ( btSimulationIslandManagerMt* islandMgr = dynamic_cast<btSimulationIslandManagerMt*>( world->getSimulationIslandManager() ) )
|
||||
{
|
||||
islandMgr->setIslandDispatchFunction( parallelIslandDispatch );
|
||||
m_multithreadedWorld = true;
|
||||
}
|
||||
#endif //#if USE_PARALLEL_ISLAND_SOLVER
|
||||
m_multithreadedWorld = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ SET(SharedMemory_SRCS
|
||||
../Importers/ImportMJCFDemo/BulletMJCFImporter.cpp
|
||||
../Importers/ImportMJCFDemo/BulletMJCFImporter.h
|
||||
../Utils/b3ResourcePath.cpp
|
||||
../Utils/b3Clock.cpp
|
||||
../Utils/b3Clock.cpp
|
||||
../Utils/RobotLoggingUtil.cpp
|
||||
../Utils/RobotLoggingUtil.h
|
||||
../Utils/ChromeTraceUtil.cpp
|
||||
@@ -75,13 +75,13 @@ SET(SharedMemory_SRCS
|
||||
../Importers/ImportSTLDemo/LoadMeshFromSTL.h
|
||||
../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
||||
../Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
||||
../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
||||
../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp
|
||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||
../MultiThreading/b3ThreadSupportInterface.cpp
|
||||
../MultiThreading/b3ThreadSupportInterface.h
|
||||
)
|
||||
@@ -95,6 +95,10 @@ LINK_LIBRARIES(
|
||||
Bullet3Common BulletWorldImporter BulletFileLoader BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK
|
||||
)
|
||||
|
||||
IF (USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD)
|
||||
LINK_LIBRARIES(BulletSoftBody)
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory
|
||||
${SharedMemory_SRCS}
|
||||
@@ -112,7 +116,7 @@ ELSE(WIN32)
|
||||
../MultiThreading/b3PosixThreadSupport.h
|
||||
main.cpp
|
||||
)
|
||||
|
||||
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( pthread ${DL} )
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory
|
||||
@@ -152,7 +156,7 @@ LINK_LIBRARIES(
|
||||
IF (WIN32)
|
||||
ADD_DEFINITIONS(-DGLEW_STATIC)
|
||||
LINK_LIBRARIES( ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
|
||||
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_GUI
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/main_opengl_single_example.cpp
|
||||
@@ -169,23 +173,23 @@ ELSE(WIN32)
|
||||
FIND_LIBRARY(COCOA NAMES Cocoa)
|
||||
MESSAGE(${COCOA})
|
||||
LINK_LIBRARIES(${COCOA} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_GUI
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/main_opengl_single_example.cpp
|
||||
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.cpp
|
||||
../MultiThreading/b3PosixThreadSupport.h
|
||||
)
|
||||
|
||||
|
||||
ELSE(APPLE)
|
||||
LINK_LIBRARIES( pthread ${DL} )
|
||||
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||
ADD_DEFINITIONS("-DGLEW_STATIC")
|
||||
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||
|
||||
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_GUI
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/main_opengl_single_example.cpp
|
||||
@@ -215,7 +219,7 @@ INCLUDE_DIRECTORIES(
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/Glew
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/headers
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared
|
||||
)
|
||||
|
||||
|
||||
@@ -233,7 +237,7 @@ LINK_LIBRARIES(
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/lib/win64)
|
||||
ELSE(CMAKE_CL_64)
|
||||
LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/lib/win32)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory_VR
|
||||
${SharedMemory_SRCS}
|
||||
../StandaloneMain/hellovr_opengl_main.cpp
|
||||
@@ -250,12 +254,12 @@ LINK_LIBRARIES(
|
||||
../ThirdPartyLibs/openvr/samples/shared/pathtools.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/pathtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.cpp
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/strtools.h
|
||||
../ThirdPartyLibs/openvr/samples/shared/Vectors.h
|
||||
../MultiThreading/b3Win32ThreadSupport.cpp
|
||||
../MultiThreading/b3Win32ThreadSupport.h
|
||||
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
@@ -272,7 +276,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll ${CMAKE_CURRENT_BINARY_DIR}/openvr_api.dll
|
||||
)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET App_PhysicsServer_SharedMemory_VR
|
||||
POST_BUILD
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
"""An actor network."""
|
||||
import tensorflow as tf
|
||||
import sonnet as snt
|
||||
|
||||
class ActorNetwork(snt.AbstractModule):
|
||||
"""An actor network as a sonnet Module."""
|
||||
|
||||
def __init__(self, layer_sizes, action_size, name='target_actor'):
|
||||
super(ActorNetwork, self).__init__(name=name)
|
||||
self._layer_sizes = layer_sizes
|
||||
self._action_size = action_size
|
||||
|
||||
def _build(self, inputs):
|
||||
state = inputs
|
||||
for output_size in self._layer_sizes:
|
||||
state = snt.Linear(output_size)(state)
|
||||
state = tf.nn.relu(state)
|
||||
|
||||
action = tf.tanh(
|
||||
snt.Linear(self._action_size, name='action')(state))
|
||||
return action
|
||||
@@ -1,46 +0,0 @@
|
||||
"""Loads a DDPG agent without too much external dependencies
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import collections
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
|
||||
import sonnet as snt
|
||||
from agents import actor_net
|
||||
|
||||
class SimpleAgent():
|
||||
def __init__(
|
||||
self,
|
||||
session,
|
||||
ckpt_path,
|
||||
actor_layer_size,
|
||||
observation_size=(31,),
|
||||
action_size=8,
|
||||
):
|
||||
self._ckpt_path = ckpt_path
|
||||
self._actor_layer_size = actor_layer_size
|
||||
self._observation_size = observation_size
|
||||
self._action_size = action_size
|
||||
self._session = session
|
||||
self._build()
|
||||
|
||||
def _build(self):
|
||||
self._agent_net = actor_net.ActorNetwork(self._actor_layer_size, self._action_size)
|
||||
self._obs = tf.placeholder(tf.float32, (31,))
|
||||
with tf.name_scope('Act'):
|
||||
batch_obs = snt.nest.pack_iterable_as(self._obs,
|
||||
snt.nest.map(lambda x: tf.expand_dims(x, 0),
|
||||
snt.nest.flatten_iterable(self._obs)))
|
||||
self._action = self._agent_net(batch_obs)
|
||||
saver = tf.train.Saver()
|
||||
saver.restore(
|
||||
sess=self._session,
|
||||
save_path=self._ckpt_path)
|
||||
|
||||
def __call__(self, observation):
|
||||
out_action = self._session.run(self._action, feed_dict={self._obs: observation})
|
||||
return out_action[0]
|
||||
36
examples/pybullet/gym/agents/simplerAgent.py
Normal file
36
examples/pybullet/gym/agents/simplerAgent.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Loads a DDPG agent without too much external dependencies
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import collections
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
import pdb
|
||||
|
||||
class SimplerAgent():
|
||||
def __init__(
|
||||
self,
|
||||
session,
|
||||
ckpt_path,
|
||||
observation_dim=31
|
||||
):
|
||||
self._ckpt_path = ckpt_path
|
||||
self._session = session
|
||||
self._observation_dim = observation_dim
|
||||
self._build()
|
||||
|
||||
def _build(self):
|
||||
saver = tf.train.import_meta_graph(self._ckpt_path + '.meta')
|
||||
saver.restore(
|
||||
sess=self._session,
|
||||
save_path=self._ckpt_path)
|
||||
self._action = tf.get_collection('action_op')[0]
|
||||
self._obs = tf.get_collection('observation_placeholder')[0]
|
||||
|
||||
def __call__(self, observation):
|
||||
feed_dict={self._obs: observation}
|
||||
out_action = self._session.run(self._action, feed_dict=feed_dict)
|
||||
return out_action[0]
|
||||
@@ -1,2 +1,2 @@
|
||||
model_checkpoint_path: "/cns/ij-d/home/jietan/persistent/minitaur/minitaur_vizier_3_153645653/Bullet/MinitaurSimEnv/28158/0003600000/agent/tf_graph_data/tf_graph_data.ckpt"
|
||||
all_model_checkpoint_paths: "/cns/ij-d/home/jietan/persistent/minitaur/minitaur_vizier_3_153645653/Bullet/MinitaurSimEnv/28158/0003600000/agent/tf_graph_data/tf_graph_data.ckpt"
|
||||
model_checkpoint_path: "tf_graph_data_converted.ckpt-0"
|
||||
all_model_checkpoint_paths: "tf_graph_data_converted.ckpt-0"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@ import numpy as np
|
||||
import tensorflow as tf
|
||||
|
||||
from envs.bullet.minitaurGymEnv import MinitaurGymEnv
|
||||
from agents import simpleAgent
|
||||
from agents import simplerAgent
|
||||
|
||||
def testSinePolicy():
|
||||
"""Tests sine policy
|
||||
@@ -53,17 +53,14 @@ def testDDPGPolicy():
|
||||
environment = MinitaurGymEnv(render=True)
|
||||
sum_reward = 0
|
||||
steps = 1000
|
||||
ckpt_path = 'data/agent/tf_graph_data/tf_graph_data.ckpt'
|
||||
ckpt_path = 'data/agent/tf_graph_data/tf_graph_data_converted.ckpt-0'
|
||||
observation_shape = (31,)
|
||||
action_size = 8
|
||||
actor_layer_sizes = (100, 181)
|
||||
n_steps = 0
|
||||
tf.reset_default_graph()
|
||||
with tf.Session() as session:
|
||||
agent = simpleAgent.SimpleAgent(session, ckpt_path,
|
||||
actor_layer_sizes,
|
||||
observation_size=observation_shape,
|
||||
action_size=action_size)
|
||||
agent = simplerAgent.SimplerAgent(session, ckpt_path)
|
||||
state = environment.reset()
|
||||
action = agent(state)
|
||||
for _ in range(steps):
|
||||
|
||||
Reference in New Issue
Block a user