Files
Mujoco_WASM/plugin/actuator/README.md
T
chenlin b45b15d153
build / setup (compute matrix) (push) Has been cancelled
build / ${{ matrix.label }} (push) Has been cancelled
build / macos-15-arm64-studio (push) Has been cancelled
build / ubuntu-24.04-clang-18-studio (push) Has been cancelled
build / ubuntu-24.04-gcc-14-studio (push) Has been cancelled
build / windows-2025-ninja-studio (push) Has been cancelled
build / ubuntu-24.04-clang-18-wasm (push) Has been cancelled
build / ubuntu-24.04-clang-18-mjx (push) Has been cancelled
add chinese
2026-08-19 17:14:37 +08:00

48 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 执行器插件(Actuator plugins
## PID
`mujoco.pid` 执行器插件实现了一个可配置的 [PID 控制器](https://en.wikipedia.org/wiki/Proportional%E2%80%93integral%E2%80%93derivative_controller)
$$f(t) = K_\text{p} e(t) + K_\text{i} \int_0^t e(\tau) \mathrm{d}\tau + K_\text{d} \frac{\mathrm{d}e(t)}{\mathrm{d}t},$$
其中 $e(t) = u(t) - \ell(t)$ 是控制量 $u$ 与执行器长度 $\ell$ 之间的差值。
使用示例如下:
```xml
<mujoco>
<extension>
<plugin plugin="mujoco.pid">
<instance name="pid">
<config key="kp" value="40.0"/>
<config key="ki" value="40"/>
<config key="kd" value="4"/>
<config key="slewmax" value="3" />
<config key="imax" value="1"/>
</instance>
</plugin>
</extension>
<worldbody>
<body>
<joint name="j" type="slide" axis="0 0 1" />
<geom size="0.01" mass="1"/>
</body>
</worldbody>
<actuator>
<plugin joint="j" plugin="mujoco.pid" instance="pid" />
</actuator>
</mujoco>
```
可用配置选项如下:
|属性 | 默认值 | 含义 |
|----------|---------|---------|
|`kp` | 0 | 控制器的**比例(P)**增益。 |
|`ki` | 0 | 控制器的**积分(I**增益。<p/>若非零,将在 `mjData.act` 中添加一个激活变量,用于存储当前的积分项(以力为单位)。 |
|`kd` | 0 | 控制器的**微分(D)**增益。 |
|`imax` | 可选 | 若指定,积分项产生的力将被截断至 `[-imax, imax]` 范围内。 |
|`slewmax` | 可选 | PID 控制器设定点允许的最大变化速率(斜率限制)。<p/>若两个时间步之间请求了更大的变化,它将被截断至 `[ctrl - slewmax * dt, ctrl + slewmax * dt]` 范围。<p/>若指定,将在 `mjData.act` 中添加一个激活变量,用于存储上一个时间步的 `ctrl` 值。 |