本文整理汇总了Python中OpenNero.set_environment方法的典型用法代码示例。如果您正苦于以下问题:Python OpenNero.set_environment方法的具体用法?Python OpenNero.set_environment怎么用?Python OpenNero.set_environment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenNero
的用法示例。
在下文中一共展示了OpenNero.set_environment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_sandbox
# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import set_environment [as 别名]
def setup_sandbox(self):
"""
setup the sandbox environment
"""
OpenNero.getSimContext().delay = 0.0
self.environment = RoombaEnvironment(constants.XDIM, constants.YDIM)
OpenNero.set_environment(self.environment)
示例2: set_environment
# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import set_environment [as 别名]
def set_environment(self, env):
self.environment = env
for id in self.wall_ids: # delete the walls
common.removeObject(id)
del self.wall_ids[:] # clear the ids
OpenNero.set_environment(env)
common.addObject(
"data/shapes/cube/WhiteCube.xml",
OpenNero.Vector3f(1 * constants.GRID_DX, 2 * constants.GRID_DY, 0 * constants.GRID_DZ),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(0.25, 0.25, 4),
)
common.addObject(
"data/shapes/cube/WhiteCube.xml",
OpenNero.Vector3f(2 * constants.GRID_DX, 2 * constants.GRID_DY, 0 * constants.GRID_DZ),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(0.25, 0.25, 4),
)
common.addObject(
"data/shapes/cube/WhiteCube.xml",
OpenNero.Vector3f(3 * constants.GRID_DX, 2 * constants.GRID_DY, 0 * constants.GRID_DZ),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(0.25, 0.25, 4),
)
示例3: setup_map
# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import set_environment [as 别名]
def setup_map(self):
"""
setup the test environment
"""
OpenNero.disable_ai()
if self.environment:
error("Environment already created")
return
self.environment = self.create_environment()
OpenNero.set_environment(self.environment)
self.environment.setup()
return True
示例4: setup_map
# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import set_environment [as 别名]
def setup_map(self):
"""
setup the test environment
"""
OpenNero.disable_ai()
if self.environment:
error("Environment already created")
return
# create the environment - this also creates the rtNEAT object
self.environment = self.create_environment()
OpenNero.set_environment(self.environment)
# world walls
height = constants.HEIGHT + constants.OFFSET
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM/2, 0, height),
OpenNero.Vector3f(0, 0, 90),
scale=OpenNero.Vector3f(1, constants.XDIM, constants.HEIGHT),
label="World Wall0",
type=constants.OBJECT_TYPE_OBSTACLE)
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(0, constants.YDIM/2, height),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(1, constants.YDIM, constants.HEIGHT),
label="World Wall1",
type=constants.OBJECT_TYPE_OBSTACLE)
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM, constants.YDIM/2, height),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(1, constants.YDIM, constants.HEIGHT),
label="World Wall2",
type=constants.OBJECT_TYPE_OBSTACLE)
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM/2, constants.YDIM, height),
OpenNero.Vector3f(0, 0, 90),
scale=OpenNero.Vector3f(1, constants.XDIM, constants.HEIGHT),
label="World Wall3",
type=constants.OBJECT_TYPE_OBSTACLE)
# Add an obstacle wall in the middle
"""
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM/2, constants.YDIM/2, height),
OpenNero.Vector3f(0, 0, 90),
scale=OpenNero.Vector3f(1, constants.YDIM / 4, constants.HEIGHT),
label="World Wall4",
type=constants.OBJECT_TYPE_OBSTACLE)
"""
# Add the surrounding Environment
common.addObject(
"data/terrain/NeroWorld.xml",
OpenNero.Vector3f(constants.XDIM/2, constants.YDIM/2, 0),
scale=OpenNero.Vector3f(1, 1, 1),
label="NeroWorld",
type=constants.OBJECT_TYPE_LEVEL_GEOM)
self.spawnAgent(agent_xml = 'data/shapes/tree/Tree.xml', first_person = False)
self.spawnAgent(agent_xml = 'data/shapes/character/steve_still_blue.xml', first_person = False)
self.spawnAgent(agent_xml = 'data/shapes/character/sydney_still.xml', first_person = False, z_pos=5)
self.spawnAgent(agent_xml = 'data/shapes/cube/GreenCube.xml', first_person = False, z_pos=7)
return True
示例5: setup_map
# 需要导入模块: import OpenNero [as 别名]
# 或者: from OpenNero import set_environment [as 别名]
def setup_map(self):
"""
setup the test environment
"""
OpenNero.disable_ai()
if self.environment:
error("Environment already created")
return
# create the environment - this also creates the rtNEAT object
self.environment = self.create_environment()
OpenNero.set_environment(self.environment)
# world walls
height = constants.HEIGHT + constants.OFFSET
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM/2, 0, height),
OpenNero.Vector3f(0, 0, 90),
scale=OpenNero.Vector3f(constants.WIDTH, constants.XDIM, constants.HEIGHT*2),
label="World Wall0",
type=constants.OBJECT_TYPE_OBSTACLE)
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(0, constants.YDIM/2, height),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(constants.WIDTH, constants.YDIM, constants.HEIGHT*2),
label="World Wall1",
type=constants.OBJECT_TYPE_OBSTACLE)
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM, constants.YDIM/2, height),
OpenNero.Vector3f(0, 0, 0),
scale=OpenNero.Vector3f(constants.WIDTH, constants.YDIM, constants.HEIGHT*2),
label="World Wall2",
type=constants.OBJECT_TYPE_OBSTACLE)
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM/2, constants.YDIM, height),
OpenNero.Vector3f(0, 0, 90),
scale=OpenNero.Vector3f(constants.WIDTH, constants.XDIM, constants.HEIGHT*2),
label="World Wall3",
type=constants.OBJECT_TYPE_OBSTACLE)
# Add an obstacle wall in the middle
common.addObject(
"data/shapes/cube/Cube.xml",
OpenNero.Vector3f(constants.XDIM/2, constants.YDIM/2, height),
OpenNero.Vector3f(0, 0, 90),
scale=OpenNero.Vector3f(constants.WIDTH, 100, constants.HEIGHT*2),
label="World Wall4",
type=constants.OBJECT_TYPE_OBSTACLE)
# # Add some trees
# for i in (0.25, 0.75):
# for j in (0.25, 0.75):
# # don't collide with trees - they are over 500 triangles each
# common.addObject(
# "data/shapes/tree/Tree.xml",
# OpenNero.Vector3f(i * constants.XDIM, j * constants.YDIM, constants.OFFSET),
# OpenNero.Vector3f(0, 0, 0),
# scale=OpenNero.Vector3f(1, 1, 1),
# label="Tree %d %d" % (10 * i, 10 * j),
# type=constants.OBJECT_TYPE_LEVEL_GEOM)
# # collide with their trunks represented with cubes instead
# common.addObject(
# "data/shapes/cube/Cube.xml",
# OpenNero.Vector3f(i * constants.XDIM, j * constants.YDIM, constants.OFFSET),
# OpenNero.Vector3f(0,0,0),
# scale=OpenNero.Vector3f(1,1,constants.HEIGHT),
# type=constants.OBJECT_TYPE_OBSTACLE)
# Add the surrounding Environment
common.addObject(
"data/terrain/NeroWorld.xml",
OpenNero.Vector3f(constants.XDIM/2, constants.YDIM/2, 0),
scale=OpenNero.Vector3f(1.2, 1.2, 1.2),
label="NeroWorld",
type=constants.OBJECT_TYPE_LEVEL_GEOM)
return True