Comments (9)
@huiwenzhang @DanielTakeshi It is really easy, at least for a simple environment:
Create files suite/new_domain.xml and suite/new_domain.py. The .xml file should contain your MuJoCo model in the MJCF format. Have a look at rl/control.py to see what your domain class in suite/new_domain.py must implement, note that some functions are already implemented in suite/base.py. You can also look at some other simple environments (e.g. cartpoly.py and humanoid.py) to get a feeling. You can find a minimalistic example of a suite/robot.py file for a 'robot' domain with a 'test' task below.
"""Robot Domain."""
import collections
from dm_control import mujoco
from dm_control.rl import control
from dm_control.suite import base
from dm_control.suite import common
from dm_control.utils import containers
_DEFAULT_TIME_LIMIT = 30
_CONTROL_TIMESTEP = .04
SUITE = containers.TaggedTasks()
def get_model_and_assets():
"""Returns a tuple containing the model XML string and a dict of assets."""
return common.read_model('robot.xml'), common.ASSETS
@SUITE.add('playing')
def test(time_limit=_DEFAULT_TIME_LIMIT, random=None, environment_kwargs=None):
"""Returns the Test task."""
physics = Physics.from_xml_string(*get_model_and_assets())
task = Robot()
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics, task, time_limit=time_limit, control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs)
class Physics(mujoco.Physics):
"""Physics class"""
class Robot(base.Task):
def __init__(self, random=None):
"""Initializes an instance of `Robot`."""
super(Robot, self).__init__(random=random)
def initialize_episode(self, physics):
"""Sets the state of the environment at the start of each episode."""
pass
def get_observation(self, physics):
"""Returns either the pure state or a set of egocentric features."""
obs = collections.OrderedDict()
return obs
def get_reward(self, physics):
"""Returns a reward to the agent."""
return 0
Once you have implemented your .py file, you just need to import it near the top of suite/_init_.py, and you should be able to use your environment!
For composed environments (e.g. Soccer), it is a bit more complicated, but you should be able to understand it from studying the code.
from dm_control.
Totally agree. Add documents for the API and instructions or examples to create customized environment. Hope it will come soon.
from dm_control.
Just wondering, was there any progress made on this?
from dm_control.
(For future readers): also see some of the comments on #53.
from dm_control.
We have an example of defining a new task from scratch in the Composer section of the tutorial colab
from dm_control.
Dear All,
It is requested that kindly help or provide some link how to design states, Actions and Rewards to train the agent on offline data. Data available on CSV file.
from dm_control.
Please read the the tutorial (Section 6) of the tech report associated with this package and/or run the associated tutorial colab.
from dm_control.
Hi Yuv,
Thanks for writing. I am looking for some py file and notebook on how to design a custom environment to train the agent in RL. I am trying to put some offline data and my actions are in discreet in nature.
Regards,
from dm_control.
Please read the the tutorial (Section 6) of the tech report associated with this package and/or run the associated tutorial colab.
The tutorial file doesn't open in colab or on github the error displayed is "Invalid notebook, The Notebook Does Not Appear to Be Valid JSON"
from dm_control.
Related Issues (20)
- How to get the velocity of each joint in the global coordinate system HOT 5
- How to get all physics.named.data objects HOT 1
- Pretrained model for the multi-agent soccer
- Difference between the linear velocity returned by physics.data.sensordata and physics.data.object_velocity HOT 1
- How to fix a part of joints of the model in simulation? HOT 1
- dm-control mujoco tasks use A LOT of cpu's HOT 4
- Call mujoco functions with dm_control.mujoco.wrapper.core.MjModel and dm_control.mujoco.wrapper.core.MjData HOT 2
- Will dm_control support GPU & TPU acceleration based on MuJoCo 3 HOT 2
- `suite.load('cheetah', 'run')` breaks with mujoco 3.0 HOT 2
- (soccer) explore.py gives a stationary frame of the pitch? HOT 6
- "rope" composite type is deprecated HOT 1
- curve attribute not supported yet for composite
- Create plugin based models using MJCF HOT 2
- Colab errors HOT 1
- The atrribute 'count' should not be always required by a cable composite
- Can we directly change the mass / damping of the robot? HOT 6
- Update to MuJoCo V3.1.0 HOT 2
- [PyMJCF] SDF plugin integration HOT 1
- Initialize a flexcomp object in PyMJCF HOT 2
- How do we convert the data in an .amc file (from the CMU mocap dataset) as that to be compatible with the cmu_humanoid by dm_control
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dm_control.