PyBullet Physics Simulation Skill
用于 PyBullet 物理仿真配置
何时使用
当需要以下帮助时使用此技能:
- 配置物理参数
- 设置碰撞检测
- 使用约束
快速参考
连接
import pybullet as p
import pybullet_data
client = p.connect(p.GUI) # GUI 模式
# client = p.connect(p.DIRECT) # 无头模式
p.setAdditionalSearchPath(pybullet_data.getDataPath())
物理配置
重力和时间步
p.setGravity(0, 0, -9.81)
p.setTimeStep(1/240) # 默认 240Hz
约束
关节约束
# 创建点对点约束
constraint = p.createConstraint(
parentBodyUniqueId,
parentLinkIndex,
childBodyUniqueId,
childLinkIndex,
p.JOINT_POINT2POINT,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
)
另见
- rl-environments - RL 环境
- robot-control - 机器人控制