Coder Social home page Coder Social logo

tayalmanan28 / mujoco-tutorial Goto Github PK

View Code? Open in Web Editor NEW
129.0 0.0 25.0 32.27 MB

Tutorial on how to get started with MuJoCo Simulation Platform. MuJoCo stands for Multi-Joint dynamics with Contact. It was acquired and made freely available by DeepMind in October 2021, and open sourced in May 2022. Feel free to contribute. Show your support by ✨this repository.

License: MIT License

Python 1.24% Jupyter Notebook 98.76%
hacktoberfest2022 mujoco mujoco-environments python robotics simulation hacktoberfest deepmind hacktoberfest-accepted

mujoco-tutorial's Introduction

All Contributors

logo

MuJoCo Tutorial

Mujoco Tutorial 👓

Tutorial on how to get started with MuJoCo simulations.

Installation and Getting started: 🚀

Conda Environment Setup 🐍

To install Anaconda follow the instructions in this webpage (Ubuntu 20.04)

Create a conda environment for MuJoCo setup:

conda create --name mujoco-tut  

Switch to the newly create environment (you will notice the name of the environment on the command line in the extreme left):

conda activate mujoco-tut  

Then, clone the repository on your system:

git clone https://github.com/tayalmanan28/Mujoco-Tutorial.git

Install the following required packages:

pip install -r requirements.txt

Jupyter notebook

conda install nb_conda_kernels  

rendering ffmpeg

sudo apt install -y ffmpeg

Running example 👉

python3 run.py

Contents

The main purpose of this repo is providing the starter code required to run a MuJoCo simulation with keyboard and mouse callbacks using its Python bindings. The base class is in mujoco_base.py. To create your own MuJoCo simulation, you can create a new class that inherits mujoco_base.MuJoCoBase. An example of this usage is provided in example_projectile.py, the new class should implement the functions

- reset()       # Initializes the enviroment and control callback
- controller()  # Adds control actions
- simulate()    # Copy the simulate() function from 
                # mujoco_base.MuJoCoBase and add your own twist

MuJoCo Examples 👉

- Projectile with drag
- Control a simple pendulum
- Control a double pendulum
- Leg swing
- Manipulator drawing
- Control an underactuated pendulum
- Gymnast swing/release on a bar
- 2D Hopper
- Initial Value Problem
- Inverse Kinematics
- 2D Biped

READMEs in different Languages

español

Contributing 🤝

So you can contribute to this repository in 2 ways:

  1. By adding new examples of MuJoCo environments
  2. By help in resolving the existing issues

For Contributing a new example to this repo:

  • Fork this repository. You can fork this repository by clicking on fork button on top right corner. Once you fork this will create a copy of repo on your account
  • Follow the above steps for installation
  • Go to the examples folder and go through different mujoco environment examples.
  • Create a valid xml file. The instructions for making an XML File are mentioned here
  • Then you can use one of the environments as a base to create a mujoco environment for your example and discuss if there are any issues.
  • Once completed, create a pull request, read about submitting a pull request in the DigitalOcean tutorial "How To Create a Pull Request on GitHub".

For Contributions directly from Issues:

  • Fork this repository. You can fork this repository by clicking on fork button on top right corner. Once you fork this will create a copy of repo on your account
  • Follow the above steps for installation
  • Based on your experience select an issue from the issues button above and ask for assigning the issue to you. Work on the issue and discuss it if you face any problems.
  • Create a pull request, read about submitting a pull request in the DigitalOcean tutorial "How To Create a Pull Request on GitHub".

Soon, we will review your request and merge your pull requests to the main branch of project if your pull request is valid. You will also get notification once your pull request is merged with existing code base. After that you will be able to see your details in contributor section on the page below.

LICENSE 📃

The code is licenced under the MIT license and free to use by anyone without any restrictions. 👍


Our Top Contributors

Currently we are also participating in Hacktober Fest 2022 🎃 so if you want to contribute to this repository please follow the contributing instructions given in the contributing Section below 😉 image

mujoco-tutorial's People

Contributors

alokendumazumder avatar arturoemmanueltoledoaguado avatar bchainbuidler avatar guillergood avatar tayalmanan28 avatar viki-07 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

mujoco-tutorial's Issues

Contributors List

A proper display of top contributors along with their profile pic.

I can not find the lqr controller. It is imported in iiwa.py.

Describe the bug
I changed run.py to see how the iiwa example works.

`
from mujoco_base import MuJoCoBase
from examples.iiwa import Iiwa

def main():
xml_path = "./xml/iiwa/iiwa.xml"
sim = Iiwa(xml_path)
sim.reset()
sim.simulate()

if name == "main":
main()

`

I am getting error:

Traceback (most recent call last):
File "run.py", line 2, in
from examples.iiwa import Iiwa
File "/home/mamad/Mujoco_ws/MuJoCo-Tutorial/examples/iiwa.py", line 7
from ../controllers.lqr import lqr
^
SyntaxError: invalid syntax

To Reproduce
Steps to reproduce the behavior:

  1. Open run.py and copy code mentioned above.
  2. You should see the error above

Organize the repo in a better Way

Proper organization of the repo means assembling the examples into one folder and accordingly edit the paths of the folder so that one can run the examples in a better way

Video writing

Hello,

Can you guys explain how you write videos with mujoco_base? I think the classical approach is to collect the frames from the renderer, and using an external writer to make a video, but mujoco_base uses mjr_render, and doesn't have specific renderer (mujoco.Renderer)

I would be glad if you could share some codes.

Making the Readme more user friendly and professional

I am thinking of following changes to the README:

  1. Adding a banner to the README. The banner should have the logo of the the tutorial, some of the images of mujoco environment (shown below), a logo of Hacktoberfest 2022 probably indicating that we are accepting contributions this time in Hacktoberfest and the social media handles.
    image

image
image

  1. Add the stats of pull requests, stars, etc. and add emojis where-ever you feel is necessary and does not make it too unprofessional.

Simplified Model of a box on a conveyor belt

Hi, I am new to MuJoCo and I want to model the following:

I want to model a conveyor belt transporting a box. I want to simplify my model, by just modeling a static belt of the conveyor (imported static CAD model just for visuals). I want to move the box in one direction on the belt, by applying a velocity on the bottom of the box, without moving the belt. Can anyone help me out with applying the velocity on the bottom of the box?

Thanks!

What version of mujoco base do you use?

git clone https://github.com/BolunDai0216/PyMuJoCoBase.git
cd PyMuJoCoBase
python3 -m pip install .

and edited gymnast.py to use
from PyMuJoCoBase.mujoco_base import MuJoCoBase

error:

Traceback (most recent call last):
  File "/home/nawal/data/software-exercises/mujoco/MuJoCo-Tutorial/examples/gymnast.py", line 100, in <module>
    main()
  File "/home/nawal/data/software-exercises/mujoco/MuJoCo-Tutorial/examples/gymnast.py", line 96, in main
    sim.simulate()
  File "/home/nawal/data/software-exercises/mujoco/MuJoCo-Tutorial/examples/gymnast.py", line 65, in simulate
    mj.mj_step(self.model, self.data)
  File "/home/nawal/data/software-exercises/mujoco/MuJoCo-Tutorial/examples/gymnast.py", line 37, in controller
    J = data.efc_J[:3, :3]
        ~~~~~~~~~~^^^^^^^^
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

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.