{"id":21989734,"url":"https://github.com/iandanforth/mjcf","last_synced_at":"2025-10-15T10:47:28.410Z","repository":{"id":142059312,"uuid":"147888298","full_name":"iandanforth/mjcf","owner":"iandanforth","description":"Python Library for MuJoCo Format model xml","archived":false,"fork":false,"pushed_at":"2023-05-12T15:03:10.000Z","size":1441,"stargazers_count":20,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T09:50:37.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iandanforth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-08T00:52:38.000Z","updated_at":"2025-07-18T07:50:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8b70fb0-37a4-41b0-8545-c05ec9f1cb9b","html_url":"https://github.com/iandanforth/mjcf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iandanforth/mjcf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iandanforth%2Fmjcf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iandanforth%2Fmjcf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iandanforth%2Fmjcf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iandanforth%2Fmjcf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iandanforth","download_url":"https://codeload.github.com/iandanforth/mjcf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iandanforth%2Fmjcf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279074548,"owners_count":26097651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T19:32:47.192Z","updated_at":"2025-10-15T10:47:28.405Z","avatar_url":"https://github.com/iandanforth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mjcf\nPython Library for MuJoCo Format model xml\n\nHave you ever wanted to generate MuJoCo format\nxml files from Python classes? Of course you have! That's why this library\nexists. \n\nFor every mjcf element there is now a Python class for you to play with.\n\n## Usage\n\nThe following is the contents of `gen_empty.py` which will (re)generate\n`empty-gen.xml`. This is an empty checkerboard world, ripe for populating with\ncreations of your devising!\n\nYou can then run that world with\n\n```\npython model-viewer.py empty-gen.xml\n```\n\n```python\nfrom mjcf import elements as e\n\n\ndef main():\n    #########################\n    # Level 1\n    mujoco = e.Mujoco(\n        model=\"empty\"\n    )\n\n    #########################\n    # Level 2\n    option = e.Option(\n        integrator=\"RK4\",\n        timestep=0.01\n    )\n    asset = e.Asset()\n    worldbody = e.Worldbody()\n\n    mujoco.add_children([\n        option,\n        asset,\n        worldbody\n    ])\n\n    ######################\n    # Level 3\n\n    # Asset\n    tex1 = e.Texture(\n        builtin=\"gradient\",\n        height=100,\n        rgb1=[1, 1, 1],\n        rgb2=[0, 0, 0],\n        type=\"skybox\",\n        width=100\n    )\n    tex2 = e.Texture(\n        builtin=\"flat\",\n        height=1278,\n        mark=\"cross\",\n        markrgb=[1, 1, 1],\n        name=\"texgeom\",\n        random=0.01,\n        rgb1=[0.8, 0.6, 0.4],\n        rgb2=[0.8, 0.6, 0.4],\n        type=\"cube\",\n        width=127\n    )\n    tex3 = e.Texture(\n        builtin=\"checker\",\n        height=[100],\n        name=\"texplane\",\n        rgb1=[0, 0, 0],\n        rgb2=[0.8, 0.8, 0.8],\n        type=\"2d\",\n        width=100\n    )\n    mat1 = e.Material(\n        name=\"MatPlane\",\n        reflectance=0.5,\n        shininess=1,\n        specular=1,\n        texrepeat=[60, 60],\n        texture=\"texplane\"\n    )\n    mat2 = e.Material(\n        name=\"geom\",\n        texture=\"texgeom\",\n        texuniform=True\n    )\n    asset.add_children([\n        tex1,\n        tex2,\n        tex3,\n        mat1,\n        mat2,\n    ])\n\n    # Worldbody\n    light = e.Light(\n        cutoff=100,\n        diffuse=[1, 1, 1],\n        dir=[-0, 0, -1.3],\n        directional=True,\n        exponent=1,\n        pos=[0, 0, 1.3],\n        specular=[.1, .1, .1]\n    )\n    floor_geom = e.Geom(\n        conaffinity=1,\n        condim=3,\n        material=\"MatPlane\",\n        name=\"floor\",\n        pos=[0, 0, 0],\n        rgba=[0.8, 0.9, 0.8, 1],\n        size=[40, 40, 40],\n        type=\"plane\"\n    )\n    worldbody.add_children([\n        light,\n        floor_geom,\n    ])\n\n    model_xml = mujoco.xml()\n\n    # Output\n    with open('empty-gen.xml', 'w') as fh:\n        fh.write(model_xml)\n\n\nif __name__ == '__main__':\n    main()\n```\n\n## What is this insanity?\n\n*So these are thin Python class wrapers for XML elements?*\n\nYup!\n\n*Why?*\n\nPython all the things!\n\n*Ok*\n\nShutup!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiandanforth%2Fmjcf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiandanforth%2Fmjcf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiandanforth%2Fmjcf/lists"}