3 import xml.etree.ElementTree
as ET
5 from string
import Template
7 WORLD_INCLUDE = Template(
''' 9 <uri>model://${model_name}</uri> 10 <pose>${x} ${y} ${z} ${roll} ${pitch} ${yaw}</pose> 16 Load Gazebo world as an ElementTree object 18 return ET.parse(world_file)
21 def add_model(world, model_name, x, y, z, roll, pitch, yaw, index=0):
23 Create and add an element to the world 25 world_elem = world.find(
'world')
26 model_elem = ET.fromstring(WORLD_INCLUDE.substitute(
27 model_name=model_name,
35 model_elem.tail =
'\n ' 36 world_elem.insert(index, model_elem)
42 Save the world to file-like object 44 return world.write(file)
def load_world(world_file)
def add_model(world, model_name, x, y, z, roll, pitch, yaw, index=0)
def save_world(world, file)