datetime:2025/12/21 16:00
author:nzb
本节内容
- 配置机器人与障碍物
- 机器人配置参数
- 障碍物配置参数
- 多机器人/障碍物的高级配置
Python 脚本与 YAML 配置文件
import irsim
env = irsim.make('obstacles.yaml')
for i in range(1000):
env.step()
env.render(0.05)
if env.done():
break
env.end()
world:
height: 10
width: 10
robot:
kinematics: {name: 'diff'}
shape: {name: 'circle', radius: 0.2}
state: [1, 1, 0]
goal: [9, 9, 0]
color: 'g'
behavior: {name: 'dash'}
plot:
show_trajectory: True
show_goal: True
obstacle:
- shape: {name: 'circle', radius: 1.0}
state: [5, 5, 0]
- shape: {name: 'rectangle', length: 1.5, width: 1.2}
state: [6, 5, 1]
- shape: {name: 'linestring', vertices: [[5, 5], [4, 0], [1, 6]] }
state: [0, 0, 0]
unobstructed: True
- shape:
name: 'polygon'
vertices:
- [4.5, 4.5]
- [5.5, 4.5]
- [5.5, 5.5]
- [4.5, 5.5]
world:
height: 10
width: 10
robot:
- number: 2
distribution: {name: 'manual'}
kinematics: {name: 'diff'}
behavior: {name: 'dash'}
shape:
- {name: 'circle', radius: 0.2}
state:
- [1, 1, 0]
- [2, 1, 0]
goal:
- [9, 9, 0]
- [9, 2, 0]
color:
- 'royalblue'
- 'red'
- number: 4
distribution: {name: 'random'}
kinematics: {name: 'diff'}
behavior: {name: 'dash'}
shape:
- {name: 'circle', radius: 0.2}
color:
- 'pink'
obstacle:
- number: 4
distribution: {name: 'manual'}
state: [[4, 8], [1, 3], [1, 0], [5, 2]]
shape:
- {name: 'circle', radius: 0.2}
- {name: 'circle', radius: 0.1}
color: 'k'