-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamics randomization for MuJoCo #109
Commits on Jun 8, 2018
-
First draft to specify variations in dynamics randomization
A simple data structure consisting of a list of variation objects was implemented. Each variation object is an instance of the Variation class that works as a container for each of the fields used to randomized a dynamic parameter within the simulation environment. This list of variations is further tested in script test_dynamics_rand.py to verify that fields within each variation can be set and get.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for cff37ed - Browse repository at this point
Copy the full SHA cff37edView commit details -
Angel Gonzalez committed
Jun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 0986def - Browse repository at this point
Copy the full SHA 0986defView commit details -
Reimplement the fluent interface to create individual setters
A setter for each field in the Variation class is used now instead of a constructor containing all fields as parameters. This allows a modular setting of fields for different configuration scenarios for dynamics randomization. To define the methods and distributions, two enumeration classes were created: VariationMethods and VariationDistributions.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 84ca64d - Browse repository at this point
Copy the full SHA 84ca64dView commit details -
Angel Gonzalez committed
Jun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 12c7f36 - Browse repository at this point
Copy the full SHA 12c7f36View commit details -
Add fisrt draft of randomize environment
Implement basic feature of a wrappered environment, which choose new randomized physics params in mujoco on every reset().
Chang authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 9104c48 - Browse repository at this point
Copy the full SHA 9104c48View commit details -
Rename RandomizeEnv.py to randomized_env.py
All the python files have file names in lowercase. To keep this standard, refactor RandomizeEnv.py to randomized_env.py.
Chang authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 9eba2da - Browse repository at this point
Copy the full SHA 9eba2daView commit details -
Add features and remove variables in RandomizedEnv
Add error handling in constructor and reset(). Remove variables that doesn't depend on self._wrapped_env.sim in reset(). Reuse MODEL_DIR in mujoco_env.py Alphabetize imports.
Chang authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 6fc661b - Browse repository at this point
Copy the full SHA 6fc661bView commit details -
Fix wrong AttributeError raising in constructor when there is element in xml. Add error handling towards the Variation.range attribute. When the range shape isn't the same as the attribute value shape, raise an AttributeError.
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for e4ce9b1 - Browse repository at this point
Copy the full SHA e4ce9b1View commit details -
Add thread to generate Mujoco models
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 28d73e8 - Browse repository at this point
Copy the full SHA 28d73e8View commit details -
Add thread terminate in mujoco_model_gen
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 21e42ee - Browse repository at this point
Copy the full SHA 21e42eeView commit details -
Add interrupt handler to mujoco model gen
Finish the thread when the simulaton is interrupted.
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 009ddbf - Browse repository at this point
Copy the full SHA 009ddbfView commit details -
Add documentation to new classes and sort import headers
Other miscellaneous changes include: - Rename classes VariationsMethods and VariationDistributions to VariationsMethod and VariationDistribution respectively. - The parsing of the XML string and fetch of the dynamic parameters to randomize is now done within the worker thread. - The file randomize_env.py was renamed to randomized_env.py
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 5485bfb - Browse repository at this point
Copy the full SHA 5485bfbView commit details -
Fix bug in MujocoModelGenerator
Before this commit, when there is an error raised when loading the xml object, only the worker_thread terminates. This commit fixes this bug by terminating all the processes. Fix some typo in the last commit.
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 4442f12 - Browse repository at this point
Copy the full SHA 4442f12View commit details -
Change multi-thread MujocoModelGen to n-length queue
Create an 10-length queue in MujocoModelGenerator to store the mujoco_models.
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 4a96217 - Browse repository at this point
Copy the full SHA 4a96217View commit details -
Miscellaneous changes to improve the code
- Renamed classes VariationMethod and VariationDistribution to Method and Distribution. - Enforced the use of methods exclusive for uniform or normal distributions in the fluent interface pattern provided in class Variations by splitting the class into VariationsBase, VariationsGaussian and VariationsUniform. - Included the module os.path.osp in rllab.envs.mujoco modules. - Changed error types and improved messages for two errors in class MujocoModelGenerator.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for c1a4a81 - Browse repository at this point
Copy the full SHA c1a4a81View commit details -
Fix PEP8 formatting in file mujoco_model_gen.py
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for cf45d0c - Browse repository at this point
Copy the full SHA cf45d0cView commit details -
Add miscellaneous changes to improve the code
- Delete unused threading.Event in MujocoModelGenerator. - Correct error types in MujocoModelGenerator. - Renamed classes RandomizedEnv to RandomizedDynamicsEnv. - Delete wrong try-except in RandomizedDynamicsEnv. - Use randomize_dynamics() in the launcher. - Format method chains onto multiple lines. - Correct wrong param name in Variation.
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 735ed80 - Browse repository at this point
Copy the full SHA 735ed80View commit details -
Add local cache of elems in MujocoModelGenerator
Solve the problem with v.elem=e, which calls the setter method in Variation. Replace this with a local cache of elements. Same with v.default in MujocoModelGenerator.
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 25db0fe - Browse repository at this point
Copy the full SHA 25db0feView commit details -
Add miscellaneous changes to improve the code
- Remove the setter in Variation - Add check of parameter shape in MujocoModelGenerator - Fix some typo
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 22d69af - Browse repository at this point
Copy the full SHA 22d69afView commit details -
CatherineSue authored and Angel Gonzalez committed
Jun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for a4c8442 - Browse repository at this point
Copy the full SHA a4c8442View commit details -
Add error handling to MujocoModelGenerator
- Add more detailed information in handling the shape of the sampled value with the default value - Add timeout in the Queue.get() in MujocoModelGenerator so the main thread will catch error raised in worker thread
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 43594ea - Browse repository at this point
Copy the full SHA 43594eaView commit details -
Rename RandomizedDynamicsEnv to RandomizedEnv
CatherineSue authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 4221002 - Browse repository at this point
Copy the full SHA 4221002View commit details -
Fix mujoco exception caused by cached propery action_space
The cached property action_space found in mujoco_env.py produces an error in Linux for dynamics randomization. The idea behind the cached property is to avoid doing an expensive computation several times, so for regular execution, action_space is obtained from the model that is used for the entire training once, improving the performance. However, for dynamics randomization there's a new model for each episode, and that requires that the action_space is updated accordingly, but that does not happen because it's cached. To update action_space and not make an invasive change, the attribute is invalidated for each reset in the RandomizedEnv class.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 133e2cb - Browse repository at this point
Copy the full SHA 133e2cbView commit details -
Add miscellaneous changes to improve the code
- Move the dynamics_randomization package to rllab.envs.mujoco. - Delete tosser.xml, use xml in rllab/vendor/mujoco_model for test - The old test_dynamics_rand.py only tests for the Variations API, so rewrite it to test for both Variations API and RandomizedEnv. - Reorder imports. - Delete import os.path as osp in rllab/envs/mujoco/__init__.py. Previously added by mistake.
Chang authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 27ec748 - Browse repository at this point
Copy the full SHA 27ec748View commit details -
Rename mujoco_model_gen to mujoco_model_generator
Package names should follow class names.
Chang authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for f18780e - Browse repository at this point
Copy the full SHA f18780eView commit details -
Delete trpo_swimmer in dynamics_randomization
test_dynamics_rand.py is enough for testing. Remove trpo_swimmer.py
Chang authored and Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 62331f2 - Browse repository at this point
Copy the full SHA 62331f2View commit details -
Initialize variations and generation of XML string in Variations
The code to initialize the variations and to generate the randomized parameters was moved into the Variations class. This will keep all the current code related to variations in the same file to improve the API of dynamics randomization, and will enable a more modular code for further features in the module.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for f154042 - Browse repository at this point
Copy the full SHA f154042View commit details -
Return to single thread, add default values and fix imports
There is a bottleneck at function load_model_from_xml from mujoco-py when using multi threading. In a single thread, a call to this function takes units of milliseconds, while in multi threading it takes tens of milliseconds. Maybe this is due to internal data structures that are required for both loading the model in the worker thread and performing the simulations in the main thread, causing the delay in load_model_from_xml and other functions that can be perceived in the cumulative time obtained by the profiler by running test_dynamics_rand.py. Due to this poor performance, the file mujoco_model_gen.py was removed since it serves no purpose now that the variations.py file contains methods to process the XML file, and the calls to obtain the randomized model are done directly in the class RandomizedEnv.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for a1b9f2a - Browse repository at this point
Copy the full SHA a1b9f2aView commit details -
Sort modules in the package, add newline at EOF and defaults
The changes in this commit include: - The modules in the __ini__.py file were sorted alphabetically. - The new line at the end of file was added in randomized_env.py. - Default values were assigned for VariationSpec, specifically for fields method, distribution, mean_std and var_range. Fields xpath, attrib, elem and default are specific to the model in the XML file provided by the user, so they cannot be default parameters. Further more, elem and default are obtained by parsing the XML file, so the user won't set them.
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for ac0d449 - Browse repository at this point
Copy the full SHA ac0d449View commit details -
Fix PEP8 formatting in randomized_env.py
Angel Gonzalez committedJun 8, 2018 Configuration menu - View commit details
-
Copy full SHA for 56d2b60 - Browse repository at this point
Copy the full SHA 56d2b60View commit details