# Physics Simulation

> PyBullet 物理仿真技能 - 刚体动力学、碰撞检测、约束配置

- Skill: `miuav/physics-simulation-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add miuav/physics-simulation-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/miuav/physics-simulation-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: miuav (https://skillmd.com/u/miuav)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/miuav/physics-simulation-2

---


# PyBullet Physics Simulation Skill

> 用于 PyBullet 物理仿真配置

---

## 何时使用

当需要以下帮助时使用此技能：
- 配置物理参数
- 设置碰撞检测
- 使用约束

---

## 快速参考

### 连接

```python
import pybullet as p
import pybullet_data

client = p.connect(p.GUI)  # GUI 模式
# client = p.connect(p.DIRECT)  # 无头模式

p.setAdditionalSearchPath(pybullet_data.getDataPath())
```

---

## 物理配置

### 重力和时间步

```python
p.setGravity(0, 0, -9.81)
p.setTimeStep(1/240)  # 默认 240Hz
```

---

## 约束

### 关节约束

```python
# 创建点对点约束
constraint = p.createConstraint(
    parentBodyUniqueId,
    parentLinkIndex,
    childBodyUniqueId,
    childLinkIndex,
    p.JOINT_POINT2POINT,
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0]
)
```

---

## 另见

- [rl-environments](../rl-environments/) - RL 环境
- [robot-control](../robot-control/) - 机器人控制
