527 字
3 分钟
MuJoCo 基础
XML 模型
2022-10-27 注意
mujoco
The unique top-level element, identifying the XML file as an MJCF model file.
model:string,模型名称
<mujoco model="模型名称"> 模型内容</mujico>
compiler
angle:[radian(弧度), degree(角度)],模型中使用弧度或角度来表示转向角。
<compiler angle="degree" />
option
关键字 | 变量类型 | 详细 |
---|---|---|
gravity | real(3), “0 0 -9.81” | [x, y, z] 三轴重力加速度 |
density | real | 介质密度 空气为 1.2 kg/m^3 水为 1000 kg/m^3 0 为禁用升力和阻力 |
viscosity | real | 介质粘度 空气为 0.00002 水为 0.0009 0 为禁用阻尼 |
timestep | real | 时间步长 推荐为 0.001,过大影响计算 |
(world)body
worldbody 只应用于顶层实体,body 应用于所有其他实体。
关键字 | 变量类型 | 详细 |
---|---|---|
name | string | 名称 |
pos | real(3), “0 0 0” | [x, y, z] 位置坐标 |
euler | real(3), “0 0 0” | [x, y, z] 三轴旋转角 |
geom(几何形状)
name:string,名称
type:string,几何形状类型
plane(平面)、sphere(球体)、ellipsoid(椭球体)、cylinder(圆柱体)、box(盒)
size:尺寸
Type | Number | Description |
---|---|---|
plane | 3 | [长,宽,高] |
sphere | 1 | 半径 |
ellipsoid | 1 | |
cylinder | 2 | [半径,高] |
box | 3 | [长,宽,高] |
joint(连接/关节)
关键字 | 变量类型 | 详细 |
---|---|---|
name | string | joint 的名称 |
type | [free, ball, slide, hinge] | free:自由 ball:球型关节 slide:滑动关节 hinge:铰链关节 |
axis | real(3), “0 0 1” | 方向向量! 铰链关节的旋转轴 滑动关节的平移方向 |
pos | real(3), “0 0 0” | 关节的位置坐标 |
limited | [false, true, auto], “auto” | 是否启用关节限制 决定 range 是否启用 |
range | real(2), “0 0” | 关节运动范围 |
damping | real, “0” | 关节阻尼 |
stiffness | real, “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 的参考位置和参考速度输入
位置模式:直接控制驱动器角度,速度模式:控制驱动器运动速度
关键字 | 变量类型 | 详细 |
---|---|---|
name | string | actualtor 的名称 |
kp(postion) | real, “1” | 位置反馈增益 |
kv(velocity) | real, “1” | 速度反馈增益 |