From eaee63a9e8d70bf82f391e45c68ec983d79cb282 Mon Sep 17 00:00:00 2001 From: cyy Date: Fri, 19 Jun 2026 16:05:38 +0800 Subject: [PATCH] Initial commit --- LICENSE | 29 + README.md | 99 +++ data/a1/meshes/calf.stl | Bin 0 -> 1102484 bytes data/a1/meshes/hip.stl | Bin 0 -> 450784 bytes data/a1/meshes/thigh.stl | Bin 0 -> 777084 bytes data/a1/meshes/thigh_mirror.stl | Bin 0 -> 801384 bytes data/a1/meshes/trunk.stl | Bin 0 -> 3977984 bytes data/a1/urdf/a1.urdf | 718 ++++++++++++++++++ data/a1/xml/a1.xml | 186 +++++ data/aliengo/meshes/calf.stl | Bin 0 -> 472584 bytes data/aliengo/meshes/hip.stl | Bin 0 -> 165584 bytes data/aliengo/meshes/thigh.stl | Bin 0 -> 475684 bytes data/aliengo/meshes/thigh_mirror.stl | Bin 0 -> 474084 bytes data/aliengo/meshes/trunk.stl | Bin 0 -> 1914284 bytes data/aliengo/urdf/aliengo.urdf | 718 ++++++++++++++++++ data/aliengo/xml/aliengo.xml | 185 +++++ data/go1/meshes/calf.stl | Bin 0 -> 1447984 bytes data/go1/meshes/hip.stl | Bin 0 -> 1505284 bytes data/go1/meshes/thigh.stl | Bin 0 -> 793584 bytes data/go1/meshes/thigh_mirror.stl | Bin 0 -> 950834 bytes data/go1/meshes/trunk.stl | Bin 0 -> 5619284 bytes data/go1/urdf/go1.urdf | 704 +++++++++++++++++ data/go1/xml/go1.xml | 195 +++++ data/go1/xml/terrain/plane.xml | 1 + data/go1/xml/terrain/rough.xml | 12 + data/go1/xml/terrain/slope.xml | 6 + data/go1/xml/terrain/stairs.xml | 13 + data/laikago/meshes/calf.stl | Bin 0 -> 238384 bytes data/laikago/meshes/hip.stl | Bin 0 -> 40084 bytes data/laikago/meshes/thigh.stl | Bin 0 -> 132184 bytes data/laikago/meshes/thigh_mirror.stl | Bin 0 -> 132384 bytes data/laikago/meshes/trunk.stl | Bin 0 -> 1584084 bytes data/laikago/urdf/laikago.urdf | 408 ++++++++++ data/laikago/xml/laikago.xml | 178 +++++ .../checkpoints/best_agent.pt | Bin 0 -> 892661 bytes ...fevents.1777181212.ml1o45bdy2z1bwf.37306.0 | Bin 0 -> 86956 bytes demo/export_skrl_policy_to_onnx.py | 185 +++++ demo/exports/normalizer.npz | Bin 0 -> 1268 bytes demo/exports/policy.onnx | Bin 0 -> 220071 bytes demo/exports/policy.pt | Bin 0 -> 221306 bytes demo/go1_sim2sim_mujoco.py | 371 +++++++++ 41 files changed, 4008 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 data/a1/meshes/calf.stl create mode 100644 data/a1/meshes/hip.stl create mode 100644 data/a1/meshes/thigh.stl create mode 100644 data/a1/meshes/thigh_mirror.stl create mode 100644 data/a1/meshes/trunk.stl create mode 100644 data/a1/urdf/a1.urdf create mode 100644 data/a1/xml/a1.xml create mode 100644 data/aliengo/meshes/calf.stl create mode 100644 data/aliengo/meshes/hip.stl create mode 100644 data/aliengo/meshes/thigh.stl create mode 100644 data/aliengo/meshes/thigh_mirror.stl create mode 100644 data/aliengo/meshes/trunk.stl create mode 100644 data/aliengo/urdf/aliengo.urdf create mode 100644 data/aliengo/xml/aliengo.xml create mode 100644 data/go1/meshes/calf.stl create mode 100644 data/go1/meshes/hip.stl create mode 100644 data/go1/meshes/thigh.stl create mode 100644 data/go1/meshes/thigh_mirror.stl create mode 100644 data/go1/meshes/trunk.stl create mode 100644 data/go1/urdf/go1.urdf create mode 100644 data/go1/xml/go1.xml create mode 100644 data/go1/xml/terrain/plane.xml create mode 100644 data/go1/xml/terrain/rough.xml create mode 100644 data/go1/xml/terrain/slope.xml create mode 100644 data/go1/xml/terrain/stairs.xml create mode 100644 data/laikago/meshes/calf.stl create mode 100644 data/laikago/meshes/hip.stl create mode 100644 data/laikago/meshes/thigh.stl create mode 100644 data/laikago/meshes/thigh_mirror.stl create mode 100644 data/laikago/meshes/trunk.stl create mode 100644 data/laikago/urdf/laikago.urdf create mode 100644 data/laikago/xml/laikago.xml create mode 100644 demo/example_runs/go1-flat-terrain-walk/skrl/26-04-26_13-26-51-427302_PPO/checkpoints/best_agent.pt create mode 100644 demo/example_runs/go1-flat-terrain-walk/skrl/26-04-26_13-26-51-427302_PPO/events.out.tfevents.1777181212.ml1o45bdy2z1bwf.37306.0 create mode 100644 demo/export_skrl_policy_to_onnx.py create mode 100644 demo/exports/normalizer.npz create mode 100644 demo/exports/policy.onnx create mode 100644 demo/exports/policy.pt create mode 100644 demo/go1_sim2sim_mujoco.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e472bbd --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2016-2022 HangZhou YuShu TECHNOLOGY CO.,LTD. ("Unitree Robotics") +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..dec44e8 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# Introduction +[MuJoCo](https://mujoco.org/) stands for Multi-Joint dynamics with Contact. It is a physics engine for simulation and has been open source. To get more details, see these repositories: [MuJoCo](https://github.com/deepmind/mujoco) and [MuJuCo-py](https://github.com/openai/mujoco-py). + +In this repo, some mujoco example scripts and the xml files of different Unitree robots are provided, including A1, Aliengo, Laikago and Go1. To simulate different robots, the corresponding xml files are needed. Here we introduce how to generate xml files from urdf and how to use them. + +# Generate XML +In MuJoCo, robots are described by xml files. Before we generate the xml file, we need the urdf file of the robot. There are many ways to obtain urdf, and these methods are not discussed here. After generating the urdf, you must ensure that all meshes are stl files. If you are using meshes in obj or other formats, convert them to stl. + +## Edit URDF +Before converting urdf to xml, some parts of urdf file need to be edited. Take "/data/urdf/a1.urdf" as an example. + +1. Add MuJoCo tag + + Add the following line after the robot description line: + ``` + + + + ``` + +2. Add a floating joint between robot body and world frame + + Since MuJoCo set the base link as fixed by default, a free joint has to be manually added between robot body and world frame: + ``` + + + + + + + ``` + +## Generate xml +MuJoCo provides an executable file for converting urdf to XML. This file is under "/mujoco/bin". To use it: +``` +./compile /path/to/model.urdf /path/to/model.xml +``` + +## Edit xml file +After converting the urdf to xml, some parts of xml file need to be edited. + +1. Set environment + +Add the following line after " size njmax="500" nconmax="100" " + +``` +