(Original title: OpenAI open source robot simulation Python library, parallel simulation processing speed increased by 400%)
In the past year's research, the OpenAI team has open-sourced a high-performance Python library for robot simulation developed using MuJoCoengine. It is reported that this Python library is one of the core tools for the OpenAI team to further study robotics. Now the team released mujoco-py (MuJoCo binding for Python 3) as the main version of MuJoCo. Mujoco-py 1.50.1.0 brings many new features and significant performance improvements. Learned that the new features include the following:
Efficient processing of parallel simulations
GPU-accelerated automatic 3D rendering
Direct access to MuJoCo functions and data structures
Supports all MuJoCo 1.50 features, such as improved contact solver
Batch simulationMany methods in trajectory optimization and reinforcement learning (such as LQR, PI2, and TRPO) can benefit from running multiple simulations in parallel. Mujoco-py uses data parallelism through OpenMP and directly accesses memory management through Cython and NumPy, making batch simulation more efficient.
The preliminary use of the new version of the MjSimPool interface shows that the speed is over 400% of the old version, and is still about the old version in an optimized and limited usage mode (the same level of parallel computing is obtained through Python's multiprocessing toolkit) 180%. Most of the speed increase is due to the shortened access time of MuJoCo's various data structures.
You can learn about MjSimPool in this case. Https://github.com/openai/mujoco-py/blob/master/examples/simpool.py
High-performance texture randomization
Domain randomization techniques are used in many OpenAI projects. The latest version of Mujoco-Py support supports headless GPU rendering, which is 40 times faster than CPU-based rendering and can generate hundreds of frames per second of composite image data. In the above (deceleration) animation, OpenAI uses randomization techniques to change the texture of a robot, helping the robot to identify its body (when it is transferred from the simulator to reality). See examples / disco_fetch.py ​​for an example of random texture generation.
VR with mujoco-py
The API exposed by mujoco-py is sufficient to allow virtual reality interaction without any additional C++ code. OpenAI uses mujoco-py to port MuJoCo's C++ VR examples to Python. If you have HTC Vive VR settings, you can try this example (this support is considered experimental, but OpenAI already uses it internally).
API and Usage
The easiest way to start using mujoco-py is to use the MjSim class. It is a wrapper around simulation models and data that allows you to easily simulate and render images from camera sensors. Here is a simple example:
From mujoco_py import load_model_from_path, MjSim
Model = load_model_from_path("xmls/tosser.xml")
Sim = MjSim(model)
Sim.step()
Print(sim.data.qpos)
# => [ -1.074e-05 notes 1.043e-04 -3.923e-05 notes 0.000e+00 notes 0.000e+00]
For high-end users, OpenAI provides a large number of low-level interfaces for direct access to MuJoCo C structures and internal functions.
Wuxi Lerin New Energy Technology Co.,Ltd. , https://www.lerin-tech.com