def _get_gnugo_ref_config(level=1, binary_path=None): """Reference config for GnuGo. Args: level: GnuGo level binary_path: string pointing to GnuGo binary Returns: Config dict that can be passed to gtp engine """ try: gnugo_binary_path = resources.GetResourceFilename(binary_path) except FileNotFoundError: gnugo_binary_path = shutil.which('gnugo') if not gnugo_binary_path: raise FileNotFoundError( 'Not able to locate gnugo library. ', 'Try installing it by: apt install gnugo') gnugo_extra_flags = ['--mode', 'gtp'] gnugo_extra_flags += ['--chinese-rules', '--capture-all-dead'] gtp_player_cfg = { 'name': 'gnugo', 'binary_path': gnugo_binary_path, 'level': level, 'extra_flags': gnugo_extra_flags, } return gtp_player_cfg
def setUp(self): super().setUp() self.walker = walkers.CMUHumanoidPositionControlled def _make_wrong_walker(name): return walkers.CMUHumanoidPositionControlled( include_face=False, model_version='2020', scale_default=True, name=name) self.wrong_walker = _make_wrong_walker self.arena = arenas.Floor() self.test_data = resources.GetResourceFilename(TEST_FILE_PATH)
def test_hdf5_agrees_with_textprotos(self): hdf5_loader = loader.HDF5TrajectoryLoader( resources.GetResourceFilename(HDF5)) for textproto_path in TEXTPROTOS: trajectory_textproto = resources.GetResource(textproto_path) trajectory_from_textproto = mocap_pb2.FittedTrajectory() text_format.Parse(trajectory_textproto, trajectory_from_textproto) trajectory_identifier = ( trajectory_from_textproto.identifier.encode('utf-8')) self.assert_proto_equal( hdf5_loader.get_trajectory(trajectory_identifier)._proto, trajectory.Trajectory(trajectory_from_textproto)._proto)
def _get_full_path(path): expanded_path = os.path.expanduser(os.path.expandvars(path)) return resources.GetResourceFilename(expanded_path)
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os # Internal dependencies. from absl.testing import absltest from local_dm_control_suite import humanoid_CMU from dm_control.suite.utils import parse_amc from dm_control.utils import io as resources _TEST_AMC_PATH = resources.GetResourceFilename( os.path.join(os.path.dirname(__file__), '../demos/zeros.amc')) class ParseAMCTest(absltest.TestCase): def test_sizes_of_parsed_data(self): # Instantiate the humanoid environment. env = humanoid_CMU.stand() # Parse and convert specified clip. converted = parse_amc.convert(_TEST_AMC_PATH, env.physics, env.control_timestep()) self.assertEqual(converted.qpos.shape[0], 63) self.assertEqual(converted.qvel.shape[0], 62) self.assertEqual(converted.time.shape[0], converted.qpos.shape[1])
def get_path(filename): """Returns the path to an asset.""" return resources.GetResourceFilename(os.path.join(_ASSETS_DIR, filename))