本文整理汇总了Python中salma.model.world.World.create_new_world方法的典型用法代码示例。如果您正苦于以下问题:Python World.create_new_world方法的具体用法?Python World.create_new_world怎么用?Python World.create_new_world使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类salma.model.world.World
的用法示例。
在下文中一共展示了World.create_new_world方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
def setUp(self):
print("setup")
World.create_new_world()
world = World.instance()
world.add_additional_expression_context_global("random", random)
world.load_declarations()
world.deactivate_all_events()
示例2: setUp
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
def setUp(self):
print("setup")
World.create_new_world(erase_properties=True)
world = World.instance()
world.load_declarations()
world.set_constant_value("gravity", [], 9.81)
world.register_clp_function("robotLeftFrom")
self.configure_events_default()
示例3: initialize
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
def initialize(self):
if self.world is None:
World.create_new_world(erase_properties=False)
self.__world = World.instance()
self.world.load_declarations()
self.augment_world_context()
self.create_entities()
self.world.initialize()
self.setup_distributions()
self.create_initial_situation()
示例4: setUp
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
def setUp(self):
self.dataFile = None
self.dataBuffer = None
World.create_new_world()
world = World.instance()
world.addFluent(Fluent("xpos", "float", [("r", "robot")], range=(20, 480)))
world.addFluent(Fluent("ypos", "float", [("r", "robot")], range=(20, 480)))
world.addFluent(Fluent("attached", "boolean", [("r", "robot"), ("i", "item")]))
world.addFluent(Fluent("direction", "float", [("r", "robot")], range=(0, 2 * math.pi)))
world.addFluent(Fluent("velocity", "float", [("r", "robot")], range=(0, 5.0)))
world.addFluent(Fluent("light_sensor_value", "float", [("r", "robot"), ("s", "light_sensor")], range=(0, 1.0)))
world.addFluent(
Fluent("distance_sensor_value", "float", [("r", "robot"), ("s", "distance_sensor")], range=(0, 1.0)))
world.addFluent(Fluent("item_sensor_value", "item", [("r", "robot")]))
world.addFluent(Fluent("target_wavelength", "wavelength", [("r", "robot")]))
world.addFluent(Fluent("light_active", "boolean", [("l", "light_source")]))
update_direction = ParametricStochasticAction('update_direction',
[
('rob', 'robot'),
('direction', 'float'),
('error', UniformDistribution('float', (0, 0)))
], immediate=False)
world.addAction(update_direction)
update_velocity = ParametricStochasticAction('update_velocity',
[
('rob', 'robot'),
('velocity', 'float'),
('error', UniformDistribution('float', (0, 0)))
], immediate=False)
world.addAction(update_velocity)
update_light_sensor = ParametricStochasticAction('update_light_sensor',
[
('rob', 'robot'),
('sensor', 'light_sensor'),
('wavelength', 'wavelength'),
('error', UniformDistribution('float', (0, 0)))
], immediate=True)
world.addAction(update_light_sensor)
update_distance_sensor = ParametricStochasticAction('update_distance_sensor',
[
('rob', 'robot'),
('sensor', 'distance_sensor'),
('error', UniformDistribution('float', (0, 0)))
], immediate=True)
world.addAction(update_distance_sensor)
world.addAction(
DeterministicAction('grab',
[
('rob', 'robot'),
('i', 'item')
], immediate=False)
)
world.addAction(
DeterministicAction('drop',
[
('rob', 'robot'),
('i', 'item')
], immediate=False)
)
world.addAction(
UniformStochasticAction('sense_for_item', [('r', 'robot')],
[RandomActionOutcome('update_item_sensor', [('r', 'robot')]),
NOP_OUTCOME
]
)
)
示例5: setUp
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
def setUp(self):
self.logger = logging.getLogger('salmalab')
World.create_new_world()
world = World.instance()
world.load_declarations()
示例6: setUp
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
def setUp(self):
World.create_new_world()
world = World.instance()
world.load_declarations()