refactor(web-platform): release V0.6 精简代码
web-platform-ci / TypeScript、Lint、Unit、Build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
web-platform-ci / TypeScript、Lint、Unit、Build (pull_request) Has been cancelled
web-platform-ci / Playwright E2E (pull_request) Has been cancelled
web-platform-ci / TypeScript、Lint、Unit、Build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
web-platform-ci / TypeScript、Lint、Unit、Build (pull_request) Has been cancelled
web-platform-ci / Playwright E2E (pull_request) Has been cancelled
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""可信本地脚本示例:用 PD 控制让倒立摆保持竖直。"""
|
||||
|
||||
NAME = "倒立摆 PD 平衡控制"
|
||||
CONTROL_HZ = 100
|
||||
|
||||
|
||||
def init(api):
|
||||
return {
|
||||
"joint": api.joint("balance_hinge"),
|
||||
"actuator": api.actuator("balance_motor"),
|
||||
}
|
||||
|
||||
|
||||
def step(ctx, state):
|
||||
angle = ctx.qpos(state["joint"])
|
||||
angular_velocity = ctx.qvel(state["joint"])
|
||||
torque = -80.0 * angle - 12.0 * angular_velocity
|
||||
ctx.set_control(state["actuator"], torque)
|
||||
|
||||
|
||||
def reset(state):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
<mujoco model="python_balance">
|
||||
<option timestep="0.002" gravity="0 0 -9.81"/>
|
||||
<worldbody>
|
||||
<geom type="plane" size="3 3 .1"/>
|
||||
<body name="pendulum" pos="0 0 0.08">
|
||||
<joint name="balance_hinge" type="hinge" axis="0 1 0" range="-1.4 1.4" damping="0.05"/>
|
||||
<geom name="rod" type="capsule" fromto="0 0 0 0 0 1" size="0.05" mass="1" rgba="0.2 0.55 0.95 1"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
<actuator>
|
||||
<motor name="balance_motor" joint="balance_hinge" ctrlrange="-100 100"/>
|
||||
</actuator>
|
||||
</mujoco>
|
||||
Reference in New Issue
Block a user