Giter Club home page Giter Club logo

mujoco's Introduction

MuJoCo

MuJoCo stands for Multi-Joint dynamics with Contact. It is a general purpose physics engine that aims to facilitate research and development in robotics, biomechanics, graphics and animation, machine learning, and other areas which demand fast and accurate simulation of articulated structures interacting with their environment.

This repository is maintained by Google DeepMind.

MuJoCo has a C API and is intended for researchers and developers. The runtime simulation module is tuned to maximize performance and operates on low-level data structures that are preallocated by the built-in XML compiler. The library includes interactive visualization with a native GUI, rendered in OpenGL. MuJoCo further exposes a large number of utility functions for computing physics-related quantities.

We also provide Python bindings and a plug-in for the Unity game engine.

Documentation

MuJoCo's documentation can be found at mujoco.readthedocs.io. Upcoming features due for the next release can be found in the changelog in the latest branch.

Getting Started

There are two easy ways to get started with MuJoCo:

  1. Run simulate on your machine. This video shows a screen capture of simulate, MuJoCo's native interactive viewer. Follow the steps described in the Getting Started section of the documentation to get simulate running on your machine.

  2. Explore our online IPython notebooks. If you are a Python user, you might want to start with our tutorial notebooks running on Google Colab:

  • The introductory tutorial teaches MuJoCo basics: Open In Colab
  • The LQR tutorial synthesizes a linear-quadratic controller, balancing a humanoid on one leg: Open In Colab
  • The least-squares tutorial explains how to use the Python-based nonlinear least-squares solver: Open In Colab
  • The MJX tutorial provides usage examples of MuJoCo XLA, a branch of MuJoCo written in JAX: Open In Colab

Installation

Prebuilt binaries

Versioned releases are available as precompiled binaries from the GitHub releases page, built for Linux (x86-64 and AArch64), Windows (x86-64 only), and macOS (universal). This is the recommended way to use the software.

Building from source

Users who wish to build MuJoCo from source should consult the build from source section of the documentation. However, please note that the commit at the tip of the main branch may be unstable.

Python (>= 3.8)

The native Python bindings, which come pre-packaged with a copy of MuJoCo, can be installed from PyPI via:

pip install mujoco

Note that Pre-built Linux wheels target manylinux2014, see here for compatible distributions. For more information such as building the bindings from source, see the Python bindings section of the documentation.

Contributing

We welcome community engagement: questions, requests for help, bug reports and feature requests. To read more about bug reports, feature requests and more ambitious contributions, please see our contributors guide and style guide.

Asking Questions

Questions and requests for help are welcome on the GitHub Issues page and should focus on a specific problem or question.

Discussions should address wider concerns that might require input from multiple participants.

Here are some guidelines for asking good questions:

  1. Search for existing questions or issues that touch on the same subject.

    You can add comments to existing threads or start new ones. If you start a new thread and there are existing relevant threads, please link to them.

  2. Use a clear and specific title. Try to include keywords that will make your question easy for other to find in the future.

  3. Introduce yourself and your project more generally.

    If your level of expertise is exceptional (either high or low), and it might be relevant to what we can assume you know, please state that as well.

  4. Take a step back and tell us what you're trying to accomplish, if we understand you goal we might suggest a different type of solution than the one you are having problems with

  5. Make it easy for others to reproduce the problem or understand your question.

    If this requires a model, please include it. Try to make the model minimal: remove elements that are unrelated to your question. Pure XML models should be inlined. Models requiring binary assets (meshes, textures), should be attached as a .zip file. Please make sure the included model is loadable before you attach it.

  6. Include an illustrative screenshot or video, if relevant.

  7. Tell us how you are accessing MuJoCo (C API, Python bindings, etc.) and which MuJoCo version and operating system you are using.

Related software

MuJoCo forms the backbone of many environment packages, but these are too many to list here individually. Below we focus on bindings and converters.

Bindings

These packages give users of various languages access to MuJoCo functionality:

First-party bindings:

Third-party bindings:

Converters

  • OpenSim: MyoConverter converts OpenSim models to MJCF.
  • SDFormat: gz-mujoco is a two-way SDFormat <-> MJCF conversion tool.
  • OBJ: obj2mjcf a script for converting composite OBJ files into a loadable MJCF model.

Citation

If you use MuJoCo for published research, please cite:

@inproceedings{todorov2012mujoco,
  title={MuJoCo: A physics engine for model-based control},
  author={Todorov, Emanuel and Erez, Tom and Tassa, Yuval},
  booktitle={2012 IEEE/RSJ International Conference on Intelligent Robots and Systems},
  pages={5026--5033},
  year={2012},
  organization={IEEE},
  doi={10.1109/IROS.2012.6386109}
}

License and Disclaimer

Copyright 2021 DeepMind Technologies Limited.

Box collision code (engine_collision_box.c) is Copyright 2016 Svetoslav Kolev.

ReStructuredText documents, images, and videos in the doc directory are made available under the terms of the Creative Commons Attribution 4.0 (CC BY 4.0) license. You may obtain a copy of the License at https://creativecommons.org/licenses/by/4.0/legalcode.

Source code is licensed under the Apache License, Version 2.0. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

This is not an officially supported Google product.

mujoco's People

Contributors

aftersomemath avatar alefram avatar awesome-aj0123 avatar balint-h avatar btaba avatar crewmatt avatar ein04 avatar engnadeau avatar erez-tom avatar erikfrey avatar hartikainen avatar hyarion avatar jaro-sevcik avatar jc-cr avatar jmargeta avatar kbayes avatar kevinzakka avatar limymy avatar lucas-inacio avatar milutter avatar nimrod-gileadi avatar petermitrano avatar quagla avatar rohanpsingh avatar saran-t avatar thowell avatar traversaro avatar v-r-a avatar wpumacay avatar yuvaltassa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mujoco's Issues

Degree-of-freedom locking

Currently there is no mechanism in MuJoCo for locking (a.k.a, sleeping, freezing) degrees-of-freedom. This is important for e.g. simulating large scenes.

This could be implemented either at the level of joints, or at the level of subtrees (children of the world body).

./simulate is not working on RHEL 7.9

I am a novice user of Mujoco, I try to run the simulator on the remote cluster but I met the following problem. I tried some of the online solutions, but no help. Although it reports problems related to GLX, the command "glxinfo" and "glxgears" works well.

@Mercury2 bin$ ./simulate
mujoco pro version 2.10 x
error of failed request: badrequest (invalid request code or no such operation)
major opcode of failed request: 151 (glx)
minor opcode of failed request: 0 ()
serial number of failed request: 9
current serial number in output stream: 9
segmentation fault

Scale mass related value for a mesh geom during runtime.

Hi,
I have a geom defined by a mesh. During runtime, I would like to change the size of that object by scaling the position of each vertex. After doing that, I get the object changed to my desired size, but its body_mass, body_inertia, and body_invweight0 are not changed. How would I change those values accordingly based on the new object scaling during run time? Thanks!

Follow up question:
Is the inertia tensor of a mesh computed as the inertia tensor of its bounding box, or it is computed from the contribution of each face of that mesh?

How can I more accurately simulate my physical, real life bot?

If I learn every aspect of my physical robot's eccentricities of dampening, motors, and joints at every position, is there a way to insert the physical robot's traits into the simulator? To have these discrepancies factoring in between the simulated robot's inputs and outputs?

I'm specifically thinking of getting a neural network to learn the individual, real life physical robot's position for every type of force made by the actuators and gravity, among any other forces acting on the robot's body.

In other words:
1: I want to precisely map where my physical, real life robot changes in state. What inputs to the actuators give what readings, outputs on the encoders & gyro/ accelerometers. I want these relationships mapped to the point of accurate prediction.
2: I want these unique, local to my robot only input to output discrepancies programmed into the MuJoCo simulator.
If I don't have the physical robot modelled I can't get it accurately simulated. If it's not accurately simulated I can't use MuJoCo to train it.

Also, I see other people tagging their 'issues' as question or other tags. How do you do that?

QUESTION: Is everything I need to modify the simulator in this repo?

Provide a non-AVX MuJoCo build

@saran-t thank you for pointing out. I will try to fix issue at my mind with WSL. It doesnt give me enough information to go on with it so far only say that "Illegal instruction". Maybe I am missing something. Sorry for spamming this thread.
Thanks
Bilal

Originally posted by @Br3hman in #42 (comment)

Mujoco MATLAB integration

Hi,
For some years I was using the Mujoco Haptix version, which comes with a precompiled MATLAB interface library. The version is not available on your web page or git, therefore I am curious if there are any plans for the future, for the MATLAB interface library to be available as open-source for Mujoco?
Thank you for the reply in advance!

Can I ask a newb question about how to create an exe from a C++ program using the library?

I am trying to turn the basic.cc file into an .exe. To compile it, in other words. I see there is a Makefile and dll files in bin.
I've spent time in visual studio trying to build. I've run basic.cc with gcc in the command line. I've looked online. I've installed several packages that were supposed to get make to work in the commandline on WIndows.

Could you spare a minute to explain this? Sorry if it's not MuJoCo specific enough.

Provide official Python bindings

MuJoCo should come with a canonical Python package that provides access to its C API. The package should be hosted on PyPI and installable via pip install mujoco.

The official bindings will be developed and continuously tested alongside MuJoCo itself. When this is done, we intend to reimplement our own RL framework dm_control on top of the new bindings.

The current plan is to create brand new bindings using pybind11.

How to visualize contact force?

Hi,
I am wandering how to visualize the contact force with Cpp API. I write a xml file and include the following line into it:

  <visual>
      <rgba com="0.502 1.0 0 0.5" contactforce="0.2 0.98 0.2 0.8" contactpoint="1.0 1.0 0.6 0.4"/>
      <scale com="0.2" forcewidth="0.05" contactwidth="0.10" contactheight="0.04"/>
  </visual>

Then I use the official file "simulate.cpp" to run this xml. I found that in the "randering" section, I can turn on the contact force and visualize the contact force as an arrow. Unfortunately, I still don't know how to show this contact force in my own program. Does anyone have a clue?

Thanks!

I'm learning STL file / objects in XML models are convex hulls. Does this mean it's not possible to model real robots?

Because if you can't get the proper volume and density into your physics simulator how can you simulate it?

I was hoping to source the CAD files of parts I was going to use, assemble them all in Solidworks and simulate the model in MuJoCo? Would I have to give the make the mesh (STL) imports zero mass to bring them into MuJoCo? Real CAD Joints and motors won't fit together if they are convex hulls. RIght?

Current Contact Jacobian and dJacobian

I want to access the value of the contact jacobian (J(q)) and its derivative (dJ(q,dq)) at the current state [q, dq] at a particular point on the robot and the value of contact force between these 2 contacting geoms. e.g the foot making contact with the ground. I want to add the following constraints to a qp:

$$ M(q)\ddot{q} + H(q,\dot{q}) = Bu + J^T\lambda $$

$$ J(q)\ddot{q} + \dot{J}(q,\dot{q}) = 0 $$

How do I go about doing this?

Initialize objects in collision free random states

Discussed in #47

Originally posted by Ankur-Deka November 6, 2021
I am using mujoco-py. The current approach I am using is to initialize in random states and then check for collision using a script which is similar to the following.

'''
code to initialize in random state
'''

try:
          self.sim.forward()
except mujoco_py.MujocoException as e:
          continue
contacts = self.get_contacts(object)
if len(contacts) > 0:
          print('collision detected, try sampling a new state')

It works most of the time but once in a while it fails. The object is initialized in a collision state and gets thrown away in the scene and the snippet above doesn't detect the collision. Since I am calling sim.forward (and NOT sim.step), there shouldn't be any integration in time as per documentation and correspondingly the plate shouldn't have been thrown away. How can I avoid the object being thrown away or how can I correctly sample collision free random states using an alternate approach?

Automatically generate the API reference

The API reference (doc/APIreference.rst) is currently written by hand. This means it immediately goes out of date with any changes to the API.

We need a solution for auto-generating the API reference that satisfies the following requirements:

  • It is complete: either every function is automatically included, or we get a build error if anything is missing.
  • Code snippets defining structs should automatically be included.
  • Function signatures are automatically included (either as a code snippet, or in a different standard form).
  • We have control of the ordering and grouping of functions / data types.
  • We can write extra bits of reStructuredText around the automatically generated functions (e.g the blurbs about "primitive types" or "physics callbacks").

howto add more geoms to a rope composite ?

hi,
i got a winch which which is connected to a rope, the only thing i found out till now is ,that i can control the position of the winch to the rope with the name attribute. yeah .sound strange, but if i use name="B0" , the winch is connected to the first capsule of the winch, if i use name="B10" its connected to the10th capsule (i think). But how do i connect more than one geom or body to the rope ?

Here is a gif that shows the winch that is connected to the first capsule of the rope (it seemed) and another red capsule that is NOT connected to the rope? How to connect the red-capsule to the rope ?

rope2

Here is my code:

<asset>
    <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="512"/>
    <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2"
        width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
    <texture name="texcarpet" type="2d" file="carpet.png"/>
    <texture name="texsponge" type="2d" file="sponge.png"/>
    <texture name="texmarble" type="cube" file="marble.png"/>

    <material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
    <material name="matcarpet" texture="texcarpet"/>
    <material name="matsponge" texture="texsponge" specular="0.3"/>
    <material name="matmarble" texture="texmarble" rgba=".7 .7 .7 1"/>
</asset>


<option timestep="0.002" jacobian="dense"/>

<size nconmax="100" njmax="300" nstack="50000"/>

<worldbody>
	<geom name="ground" type="plane" size="0 0 1" pos="0 0 0" quat="1 0 0 0" material="matplane" condim="1"/>
	
	<body name="b_winch" pos="0 0 0.05">
    	<geom type="cylinder" fromto="0 0 -0.05  0 0 0.05" size="0.06"/>
    	<joint name="winch_0" range="-1.5708 1.5708"/>
	<geom type="cylinder" fromto="0 0 -0.04  0 0 -0.05" size="0.12"/>	
	<geom type="cylinder" fromto="0 0 0.04  0 0 0.05" size="0.12"/>
	
	<body name="B0" pos="0 0 0.00">
        		<composite type="rope" count="40 1 1" spacing="0.04" offset="0 0 2">
            		<joint kind="main" damping="0.005"/>
            		<geom type="capsule" size=".01 .015" rgba=".8 .2 .1 1"/>
        		</composite>
    	</body>
    	
    	<body pos="0.5 0 0">
    	<geom type="capsule" size=".1 .15" rgba=".8 .2 .1 1"/>
    	<joint name="winch_1" range="-1.5708 1.5708"/>
    	</body>
</body>     
</worldbody>

<actuator>
    <motor name="winch_0"       gear="2" joint="winch_0" />
</actuator>

thanks

Invalid MIT-MAGIC-COOKIE-1 keyERROR: Expired activation key

I had bought the regular mujoco license 200 1 year ago. Today, I am getting an Invalid MIT-MAGIC-COOKIE-1 keyERROR: Expired activation key error whenever I tried to run a python3 scripts that runs a mujoco environment.

  • I tried to replace the mjkey inside mujoco200/bin to use the new and free license key. This did not work.

  • I tried to run sample/make in case this had some effect (it did not).

  • I tried to reset the computer: the same result.

  • After that, I thought about doing the upgrade from mujoco200 to mujcoo210 - same result.
    *Note: I do not get this error if I simply run mujoco210/bin/simulate ..model_file..
    I would appreciate any insight into this.

  • I tried uninstall mujoco_py with pip3, reinstall it, and rebuild the cython libraries to see if that has an effect. The buid finished with a ERROR: Expired activation key and updating my PYTHONPATH, LD_LIBRARY_PATH, LD_PRELOAD.

Here, I am getting the following:

python3 train_binPicking.py --render True
Invalid MIT-MAGIC-COOKIE-1 key
You appear to be missing MuJoCo.  We expected to find the file here: /home/juan/.mujoco/mujoco200

This package only provides python bindings, the library must be installed separately.

Please follow the instructions on the README to install MuJoCo

    https://github.com/openai/mujoco-py#install-mujoco

Which can be downloaded from the website

    https://www.roboti.us/index.html

Traceback (most recent call last):
  File "train_binPicking.py", line 44, in <module>
    import robosuite as suite                                                           # will call all __init__ inside suite loading all relevant classes
  File "/home/juan/python/drl/toolsuites/robosuite/robosuite/robosuite/__init__.py", line 1, in <module>
    from robosuite.environments.base import make
  File "/home/juan/python/drl/toolsuites/robosuite/robosuite/robosuite/environments/__init__.py", line 1, in <module>
    from .base import REGISTERED_ENVS, MujocoEnv
  File "/home/juan/python/drl/toolsuites/robosuite/robosuite/robosuite/environments/base.py", line 2, in <module>
    from mujoco_py import MjSim, MjRenderContextOffscreen
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/__init__.py", line 3, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 509, in <module>
    mujoco_path, key_path = discover_mujoco()
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/utils.py", line 93, in discover_mujoco
    raise Exception(message)
Exception: 
You appear to be missing MuJoCo.  We expected to find the file here: /home/juan/.mujoco/mujoco200

This package only provides python bindings, the library must be installed separately.

Please follow the instructions on the README to install MuJoCo

    https://github.com/openai/mujoco-py#install-mujoco

Which can be downloaded from the website

    https://www.roboti.us/index.htm

Just to test things I renamed the mujoco210 folder as mujoco200 and uninstalled/reinstalled mujoco.py. This time there are compiler errors. I guess the latest mujco_py is not yet compatible with mujoco_210

Invalid MIT-MAGIC-COOKIE-1 keyImport error. Trying to rebuild mujoco_py.
Compiling /media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.pyx because it depends on /media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/pxd/mujoco.pxd.
[1/1] Cythonizing /media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.pyx
running build_ext
building 'mujoco_py.cymj' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py -I/home/juan/.mujoco/mujoco200/include -I/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/numpy/core/include -I/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/vendor/egl -I/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/include -I/usr/include/python3.8 -c /media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c -o /media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/generated/_pyxbld_2.0.2.13_38_linuxgpuextensionbuilder/temp.linux-x86_64-3.8/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.o -fopenmp -w
/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c: In function ‘__pyx_f_9mujoco_py_4cymj_11PyMjvFigure__set’:
/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c:77676:91: error: subscripted value is neither array nor pointer nor vector
77676 | _t_1 = ((PyObject *)__pyx_f_9mujoco_py_4cymj__wrap_float_1d((&(__pyx_v_p->linewidth[0])), 0x64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3829, __pyx_L1_error)
      |                                                                                    ^

/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c: In function ‘__pyx_pf_9mujoco_py_4cymj_11PyMjvFigure_9legendoff___get__’:
/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c:78316:55: error: ‘mjvFigure’ {aka ‘struct _mjvFigure’} has no member named ‘legendoff’; did you mean ‘legendoffset’?
78316 |   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->ptr->legendoff); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3860, __pyx_L1_error)
      |                                                       ^~~~~~~~~
      |                                                       legendoffset
/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c: In function ‘__pyx_pf_9mujoco_py_4cymj_11PyMjvFigure_9legendoff_2__set__’:
/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/cymj.c:78371:22: error: ‘mjvFigure’ {aka ‘struct _mjvFigure’} has no member named ‘legendoff’; did you mean ‘legendoffset’?
78371 |   __pyx_v_self->ptr->legendoff = __pyx_v_x;
      |                      ^~~~~~~~~
      |                      legendoffset
Traceback (most recent call last):
  File "/usr/lib/python3.8/distutils/unixccompiler.py", line 117, in _compile
    self.spawn(compiler_so + cc_args + [src, '-o', obj] +
  File "/usr/lib/python3.8/distutils/ccompiler.py", line 910, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/usr/lib/python3.8/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/usr/lib/python3.8/distutils/spawn.py", line 157, in _spawn_posix
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_binPicking.py", line 44, in <module>
    import robosuite as suite                                                           # will call all __init__ inside suite loading all relevant classes
  File "/home/juan/python/drl/toolsuites/robosuite/robosuite/robosuite/__init__.py", line 1, in <module>
    from robosuite.environments.base import make
  File "/home/juan/python/drl/toolsuites/robosuite/robosuite/robosuite/environments/__init__.py", line 1, in <module>
    from .base import REGISTERED_ENVS, MujocoEnv
  File "/home/juan/python/drl/toolsuites/robosuite/robosuite/robosuite/environments/base.py", line 2, in <module>
    from mujoco_py import MjSim, MjRenderContextOffscreen
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/__init__.py", line 3, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 510, in <module>
    cymj = load_cython_ext(mujoco_path)
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 105, in load_cython_ext
    cext_so_path = builder.build()
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 221, in build
    built_so_file_path = self._build_impl()
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 291, in _build_impl
    so_file_path = super()._build_impl()
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 244, in _build_impl
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python3.8/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/mujoco_py/builder.py", line 144, in build_extensions
    build_ext.build_extensions(self)
  File "/media/juan/sdd/python/drl/code-bases/graphs/rlkit-relational/relSuite_env/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/usr/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
    objects = self.compiler.compile(sources,
  File "/usr/lib/python3.8/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python3.8/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 

Why is the dylib missing from the MuJoco repo?

Example output from MacOS:

shyamalchandra@Shyamals-iMac sample % make -f Makefile.macos 
clang++ -O2 -I../include -L../bin -std=c++11 -stdlib=libc++ -mavx -pthread testxml.cc    -lmujoco210nogl      -o ../bin/testxml
ld: library not found for -lmujoco210nogl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1

Please let me know if I am missing something. Any help would be great!

Where does the information for an <inertial> come from?

Sorry if this question points to something that might be outside of MuJoCo, but I'm not sure if this data comes from some script in MuJoCo or where I might find this data.

When you have something like this between a <body> and a <joint>, with a mesh in a <geom> under that, where do you get this data for your models, for your XML file?
<inertial pos="-0.0112984 -3.15366e-006 0.0746835" quat="0.997071 0.000128212 0.076485 -0.00012406" mass="2.27" diaginertia="0.003962 0.00341694 0.00169212" />

Also, I notice there are tags on these github issues, or labels. Features they might be called. How do you write these?
I wanted to put a question tag. Is this the place to ask these sorts of questions? It's not about a bug.

Automatic reallocation of mjData buffer

MuJoCo is designed to not dynamically allocate any memory at runtime, which is great for e.g. embedded applications. However, in many higher-level use cases, it is desirable to have a mechanism that would allow the mjData buffer to grow dynamically when full, rather than triggering a memory error.

In terms of implementation detail, this is possibly best done as a new C++ API that wraps the existing C API.

Violation of mjtSTAGE contract by mj_Euler()

MuJoCo provides an explicit contract related to the mjtSTAGE enum: All computations requiring only position and velocity (mjSTAGE_POS and mjSTAGE_VEL) happen in mj_step1(), while computations related to accelerations and forces (mjSTAGE_ACC) happen in mj_step2().

This contract is violated by the mass-matrix modification that happens in mj_Euler() related to implicit integration of joint damping, since the output computation depends only on positions. This issue shows up, for example, when trying to perform efficient finite-differencing of mj_step() skipping position-related computations when differencing velocities or controls.

winch xml

Hi,
as the forums of mujoco are no longer available, we should ask here, so i do :)

I want to describe a winch model with a steel-rope with mujoco xml. But i dont know what to use for a motor-actuator as joint (hinge is wrong :) ) ? In the simulator i can use the controls of "winch_0" but it does not rotate like a motor would rotate the cylinder, the rope moves up-and-down the cylinder ?

Here is my code so far:

<mujoco model="RopeWinch">

    
    <asset>
        <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="512"/>
        <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2"
            width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
        <texture name="texcarpet" type="2d" file="carpet.png"/>
        <texture name="texsponge" type="2d" file="sponge.png"/>
        <texture name="texmarble" type="cube" file="marble.png"/>

        <material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
        <material name="matcarpet" texture="texcarpet"/>
        <material name="matsponge" texture="texsponge" specular="0.3"/>
        <material name="matmarble" texture="texmarble" rgba=".7 .7 .7 1"/>
    </asset>


    <option timestep="0.002" jacobian="dense"/>

    <size nconmax="100" njmax="300" nstack="50000"/>

    <worldbody>
    	<geom name="ground" type="plane" size="0 0 1" pos="0 0 0" quat="1 0 0 0" material="matplane" condim="1"/>
    	
        <body name="B0" pos="0 0 0.3">        
            <freejoint/>
            <body>
            	<geom type="cylinder" fromto="0 0 -0.3  0 0 0.3" size="0.06"/>
            	<joint name="winch_0" type="hinge" pos="0 0 0.065" axis="0 1 0" range="-75 30" damping="5" stiffness="10" armature="0.02" />
            </body>
            <composite type="rope" count="40 1 1" spacing="0.04" offset="0 0 2">
                <joint kind="main" damping="0.005"/>
                <geom type="capsule" size=".01 .015" rgba=".8 .2 .1 1"/>
            </composite>
        </body>
    </worldbody>
    
    <actuator>
        <motor name="winch_0"       gear="200" joint="winch_0" />
    </actuator>    
</mujoco>`

It looks like this, where the rope goes up/down the cylinder. But the cylinder should rotate and the rope-connection-point should stay stationary.

mujoco-ropewinch

What do i wrong ?

Mujoco Unity integration

Awesome news about open sourcing Mujoco, thank you very much for providing it!

We're looking in our next gen simulation environment, and Unity + Mujoco would be a big contender. Are they any plans on supporting the Unity plugin?

mujoco gazebo integration

Gazebo is a popular open source tool for physics simulation and is widely used for robot simulation as well. An integration of mujoco physics with gazebo will enable the mujoco user audience to grow and consequently this will enable faster development processes (bug reporting, feature requests etc.)

Modify the connection relationship during operation

I would like to express my gratitude to the contributors of MuJoCo. This issue is posted to seek advice on changing the connection relationship online.

At present, most simulation engines such as MuJoCo have defined fixed connection relationships before running, such as MJCF, URDF, etc. This limits the simulation of modular self-reconfigurable robots, which need to change the connection relationship between modules during operation, such as changing from a snake-shaped robot to a three-legged robot. In other words, the parent-child relationship, maybe also the joints, between the different links of the robot will change during the simulation, but the 3D position of the links will remain unchanged. For example, in the figure below, module 3 was originally connected to module 2. At a certain moment in the simulation, module 3 was disconnected from module 2 and then connected to module 1, but its 3D position remained unchanged.

图片

Look forward to getting suggestions from the community. Thanks in advance.

Using Open Source MuJuCo in Gym

Hey,

I'm the new maintainer of Gym (I'm a PhD student at UMD, I have no formal affiliation with OpenAI). As you may know, Gym has been using MuJuCo for a long time in it's MuJuCo and Robotics environments, and was in the process of replacing these in full with Brax (originally PyBullet, but plans changed) due to MuJuCo's status as closed source and a host of massive maintenance issues with the MuJuCo environments and mujuco-py. Are you guys interested in Gym support, and if so would you be willing to reach out to me to set up a time to briefly chat about plans? My email is [email protected]

Compiling for M1

Hello folks,
Thanks so much for taking the charge to open-source mujoco. Before the source is available yet, I wonder if there is any plans to cross-compile to arm64, namely, Apple Silicon?

Thanks in advance for your help!

Strange behavior in wheel slip simulation.

Hello,
I'm currently working on a sim-to-real project which requires a simulation of a rear-wheel driven car
on a low-friction surface (meaning the car drifts and slips a lot). I'm getting strange behavior where when turning, the car crabs
to one side, as if there was a parasitic force acting on it, as on the video. Is this a bug or is it a matter of setting simulator parameters correctly? I tried various things and nothing works. The simulation is from the Mushr tutorial. I only decreased the friction of the wheels of the car and I can't get it to work as one would expect it to.

crabbing_buggy_cropped.mp4

How can I provide my own actuator torque model based on data from a real physical robot?

From the Read Me...

we are currently making preparations to open source the codebase. In the meantime, MuJoCo is available for download as a free and unrestricted precompiled binary under the Apache 2.0 license from mujoco.org.

MuJoCo's source code will be released through this GitHub repository once it is ready. In the meantime, the repository hosts MuJoCo's documentation

Why can't you just put it up now?
In case you have any thoughts I'll tell you what I want it for... My goal is to replace the torque and the output code with a neural network trained on my real life, physical robot. A neural network trained to predict the state depending on the torque and last state.
So, while I'm on the topic, any general advice how to proceed? Maybe where to begin? Like a more bite sized project before I tackle this?

Set up continuous integration

We would like to run some unit and integration tests continuously once we have the source code on github.

We'll probably use GitHub Actions for this, and would like to build and test on Linux, Windows, macOS.

Could anyone please explain scale and units of measure in MuJoCo?

I've looked at the docs and maybe I've missed it. When writing an XML file you start with the first object in the body, then add geoms to it and joints. Where do the specific positions come from to assemble joints correctly? I'm confused because Emo, the creator of MuJoCo has said that MuJoCo has not units of measure.
Do meshes function as geoms on their own, or is there a problem with the way their shape is rendered that requires new shapes in their place? I ask because I notice a lot of cubes and cylinders inside of meshes in XML model files I've seen online.

Programmatically defining an mjModel

Hi,

is there any sample code how to programmatically define an mjModel: e.g. given a kinematic structure with geometric shapes (spheres, meshes, boxes, etc.), how to build the corresponding mjModel without translation into an XML file.

Best
Marc

Connecting two body objects to the child body in the kinematics tree

Hello, I am making a custom model, which I am converting from URDF. In the original urdf model, there are two objects which are connecting to the same child body, however mujoco transated that into one of the bodies being connected and the other one is open-ended. Is there some sort of trick to have two bodies having the same child in the kinematics tree? I am refering to psm_pitch_top_link and psm_pitch_bottom_link both being connected to psm_pitch_end_link in the attached model. Thanks!

psm.txt

How to simultaneously visualize and render offscreen?

Referring to https://roboti.us/forum/index.php?threads/how-to-simultaneously-visualize-and-render-offscreen.3517/ which was not resolved completely.
Thank you for opensourcing mujoco, it is integral to my research. I have a scene with a robot and I need to render two viewpoints, a third person free moving view of the robot(onscreen) and a view from a fixed camera attached to the robot's body(offscreen).
Could someone guide me on how to do this? I define one mjmodel, mjdata and two GLFWwindow, mjvCamera, mjvOption, mjvScene, mjrContext.
Guidance would be very much appreciated. Thanks!

Exceeded joint limit range

I observed that some of my hinge joints exceed the joint limits that are specified using 'range' parameter whilst setting 'limited' flag as 'true'. What could be the possible reasons for this?

Report an issue with mj_ray()

Hi, glad to hear that Mujoco is now free and open sourced!

I am a user of OpenAI's safety gym which is built on Mujoco. The natural lidar in safety gym seems broken (can't exclude robot body parts when casting the ray to detect obstacles in the environment, resulting in false positives). This is due to Mujoco's mj_ray() issue as discussed in an old post by people at OpenAI on Mujoco's forum:

http://webcache.googleusercontent.com/search?q=cache:0_oDvIqG-qsJ:www.mujoco.org/forum/index.php%3Fthreads/interpretation-of-mj_ray-arguments.3853/+&cd=1&hl=en&ct=clnk&gl=us

This issue so far hasn't been fixed yet. As a result, safety gym by default uses pseudo lidar instead of natural lidar. I think this issue might be worth an inspection. Thanks!

Getting minimum possible reward?

I need to rescale rewards, so I'm wondering if it's possible to get an environment's minimum possible reward. Actions and states have min values, but I'm not sure if rewards do?

Bug reports

Hi,

First off, thank you for taking on this effort to open source and maintain MuJoCo, it's really greatly appreciated. I've been using MuJoCo for a while now so figure it may be nice to formally report some bugs I've noticed here. If you prefer I can split each of these into individual bug reports/feature requests.

  • Cylinder-box contacts are extremely noisy. I believe Emo was aware of this deficiency and planning to fix it in a future release. Is that still the case?
  • mj_contactForce sometimes returns what looks like garbage data, usually only once at the initiation of contact. This seems like it's perhaps an uninitialized memory bug. I can provide a minimal reproducible example at some point if that helps.
  • Contact distance calculations don't scale properly with certain geom pairs. I can't remember the details of this bug, but I reported it in the MuJoCo forum once so once that's up and running again I can update this. I don't think this affects normal simulation, but shows up if you set margin=gap>>0

Finally, at some point Emo said he was working on an incremental compiler for MuJoCo. Is that also on the development roadmap still?

Missing path to your environment variable (mujoco210)

Hey,
Today my license for mujoco expired so I downloaded the open-source version from DeepMind website "mujoco210" and placed it in ~/.mujoco folder and added the following line to my .bashrc file and source my .bashrc file.

export LD_LIBRARY_PATH=/home/sagar/.mujoco/mujoco210/bin
export PATH="$LD_LIBRARY_PATH:$PATH"

But still, I get the following error:

Missing path to your environment variable. 
Current values LD_LIBRARY_PATH=/home/sagar/.mujoco/mujoco210/bin
Please add following line to .bashrc:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/sagar/.mujoco/mujoco200/bin

Can someone tell me if I am missing any point?
OS: Ubuntu 20.04 LTS
Python version: 3.7.5
Conda version: 4.10.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.