_scenario.addBody(createSingleBody('sphere_' + str(i), 'sphere')) for i in range(NUM_CYLINDERS): _scenario.addBody(createSingleBody('cylinder_' + str(i), 'cylinder')) for i in range(NUM_CAPSULES): _scenario.addBody(createSingleBody('capsule_' + str(i), 'capsule')) for i in range(NUM_MESHES): _scenario.addBody(createSingleBody('mesh_' + str(i), 'mesh')) _agent = tysoc_bindings.PyCoreAgent('agent0', [-1, 0, 3], 'urdf', 'dogbot') _scenario.addAgent(_agent) _runtime = pytysoc.createRuntime( physicsBackend=pytysoc.BACKENDS.PHYSICS.MUJOCO, renderingBackend=pytysoc.BACKENDS.RENDERING.GLVIZ) _simulation = _runtime.createSimulation(_scenario) _visualizer = _runtime.createVisualizer(_scenario) _simulation.initialize() _visualizer.initialize() _simulation.step() _visualizer.render() _running = False while _visualizer.isActive():
""" Basic task sample: Here we create a task which contains a group of ... agent(s), terrain generator(s) and sensor(s). """ import time import numpy as np import pytysoc _runtime = pytysoc.createRuntime(physicsBackend='mujoco', renderingBackend='custom', renderingMode='interactive', renderingConfigParams={}) _task = _runtime.createTask( taskType=pytysoc.tasks.SINGLE_WALK_FORWARD, agentType=pytysoc.agents.HUMANOID, terrainType=pytysoc.terrain.SIMPLE_PROCEDURAL_FORWARD, terrainConfigParams={'sectionDepth': 1.0}, agentSensors=[ pytysoc.sensors.INTRINSIC, pytysoc.sensors.TERRAIN_PROFILE, pytysoc.sensors.FRONT_CAMERA ]) ## _task = _runtime.createTask( taskType = pytysoc.tasks.SINGLE_WALK_FORWARD, ## agentType = pytysoc.agents.HUMANOID, ## terrainType = pytysoc.terrain.SIMPLE_PROCEDURAL_FORWARD, ## terrainConfigFile = 'procedural_forward.json', ## agentSensors = [ pytysoc.sensors.INTRINSIC, ## pytysoc.sensors.TERRAIN_PROFILE,