-
Notifications
You must be signed in to change notification settings - Fork 310
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 #51
Commits on Jun 12, 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for c9bfd53 - Browse repository at this point
Copy the full SHA c9bfd53View commit details -
Angel Gonzalez authored and CatherineSue committed
Jun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 7b49c10 - Browse repository at this point
Copy the full SHA 7b49c10View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 4814fe0 - Browse repository at this point
Copy the full SHA 4814fe0View commit details -
Angel Gonzalez authored and CatherineSue committed
Jun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 76de607 - Browse repository at this point
Copy the full SHA 76de607View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for f26bece - Browse repository at this point
Copy the full SHA f26beceView 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 7cdbac7 - Browse repository at this point
Copy the full SHA 7cdbac7View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for edd1cb2 - Browse repository at this point
Copy the full SHA edd1cb2View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for ef8f05a - Browse repository at this point
Copy the full SHA ef8f05aView commit details -
Add thread to generate Mujoco models
Angel Gonzalez authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 70a0608 - Browse repository at this point
Copy the full SHA 70a0608View commit details -
Add thread terminate in mujoco_model_gen
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 3db0053 - Browse repository at this point
Copy the full SHA 3db0053View commit details -
Add interrupt handler to mujoco model gen
Finish the thread when the simulaton is interrupted.
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for a122e90 - Browse repository at this point
Copy the full SHA a122e90View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 834f2c2 - Browse repository at this point
Copy the full SHA 834f2c2View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 9724d5f - Browse repository at this point
Copy the full SHA 9724d5fView commit details -
Change multi-thread MujocoModelGen to n-length queue
Create an 10-length queue in MujocoModelGenerator to store the mujoco_models.
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for aa0b2b6 - Browse repository at this point
Copy the full SHA aa0b2b6View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 9d64272 - Browse repository at this point
Copy the full SHA 9d64272View commit details -
Fix PEP8 formatting in file mujoco_model_gen.py
Angel Gonzalez authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for ff97435 - Browse repository at this point
Copy the full SHA ff97435View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for e6180ce - Browse repository at this point
Copy the full SHA e6180ceView 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for dc668e8 - Browse repository at this point
Copy the full SHA dc668e8View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for f604b7f - Browse repository at this point
Copy the full SHA f604b7fView commit details -
CatherineSue committed
Jun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for c74bee6 - Browse repository at this point
Copy the full SHA c74bee6View 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 8b66b7f - Browse repository at this point
Copy the full SHA 8b66b7fView commit details -
Rename RandomizedDynamicsEnv to RandomizedEnv
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 66a7df8 - Browse repository at this point
Copy the full SHA 66a7df8View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for a9d586d - Browse repository at this point
Copy the full SHA a9d586dView 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 committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 3476dc0 - Browse repository at this point
Copy the full SHA 3476dc0View commit details -
Rename mujoco_model_gen to mujoco_model_generator
Package names should follow class names.
Chang committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 761f065 - Browse repository at this point
Copy the full SHA 761f065View commit details -
Delete trpo_swimmer in dynamics_randomization
test_dynamics_rand.py is enough for testing. Remove trpo_swimmer.py
Chang committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 775a628 - Browse repository at this point
Copy the full SHA 775a628View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 59f9ca4 - Browse repository at this point
Copy the full SHA 59f9ca4View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 9056d88 - Browse repository at this point
Copy the full SHA 9056d88View 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 authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 041d83b - Browse repository at this point
Copy the full SHA 041d83bView commit details -
Fix PEP8 formatting in randomized_env.py
Angel Gonzalez authored and CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 33c12f5 - Browse repository at this point
Copy the full SHA 33c12f5View commit details -
Reorder imports in the package
Alphabetize the imports order in the package
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 2d1c54d - Browse repository at this point
Copy the full SHA 2d1c54dView commit details -
Change comments in the package
The dynamic randomization is set to single thread, so the comments contains 'MujocoModelGenerator' need to be changed or deleted.
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 1422eba - Browse repository at this point
Copy the full SHA 1422ebaView commit details -
Refactor package name and test file location
Rename the dynamics_randmization to randomization since it's not actually specific to dynamics. Move tesrt_dynamic_rand.oy to tests/
CatherineSue committedJun 12, 2018 Configuration menu - View commit details
-
Copy full SHA for 360bef5 - Browse repository at this point
Copy the full SHA 360bef5View commit details