527 字
3 分钟
MuJoCo 基础
2022-10-26

XML 模型#

参考: MuJoCo/XML_Reference

2022-10-27 注意

mujoco#

The unique top-level element, identifying the XML file as an MJCF model file.

modelstring,模型名称

<mujoco model="模型名称">
模型内容
</mujico>

compiler#

angle[radian(弧度), degree(角度)],模型中使用弧度或角度来表示转向角。

<compiler angle="degree" />

option#

关键字变量类型详细
gravityreal(3), “0 0 -9.81”[x, y, z] 三轴重力加速度
densityreal介质密度
空气为 1.2 kg/m^3
水为 1000 kg/m^3
0 为禁用升力和阻力
viscosityreal介质粘度
空气为 0.00002
水为 0.0009
0 为禁用阻尼
timestepreal时间步长
推荐为 0.001,过大影响计算

(world)body#

worldbody 只应用于顶层实体,body 应用于所有其他实体。

关键字变量类型详细
namestring名称
posreal(3), “0 0 0”[x, y, z] 位置坐标
eulerreal(3), “0 0 0”[x, y, z] 三轴旋转角

geom(几何形状)#

namestring,名称

typestring,几何形状类型

plane(平面)、sphere(球体)、ellipsoid(椭球体)、cylinder(圆柱体)、box(盒)

size:尺寸

TypeNumberDescription
plane3[长,宽,高]
sphere1半径
ellipsoid1
cylinder2[半径,高]
box3[长,宽,高]

joint(连接/关节)#

关键字变量类型详细
namestringjoint 的名称
type[free, ball, slide, hinge]free:自由
ball:球型关节
slide:滑动关节
hinge:铰链关节
axisreal(3), “0 0 1”方向向量!
铰链关节的旋转轴
滑动关节的平移方向
posreal(3), “0 0 0”关节的位置坐标
limited[false, true, auto], “auto”是否启用关节限制
决定 range 是否启用
rangereal(2), “0 0”关节运动范围
dampingreal, “0”关节阻尼
stiffnessreal, “0”关节刚度

actuator#

motor#

This element creates a direct-drive actuator.

驱动器模式:一种直接输出扭矩的模式

postion/velocity#

Note that in order create a PD controller, one has to define two actuators: a position servo and a velocity servo.

This is because MuJoCo actuators are SISO while a PD controller takes two control inputs (reference position and reference velocity).

在 MuJoCo 中如果需要定义 PD 控制器就必须同时定义 postion 和 velocity 来满足 SISO 的参考位置和参考速度输入

位置模式:直接控制驱动器角度,速度模式:控制驱动器运动速度

关键字变量类型详细
namestringactualtor 的名称
kp(postion)real, “1”位置反馈增益
kv(velocity)real, “1”速度反馈增益

MuJoCo 基础
https://fuwari.vercel.app/posts/编程/mujoco/mujoco-基础/
作者
Asuwee
发布于
2022-10-26
许可协议
CC BY-NC-SA 4.0