本文整理汇总了Python中scenario_generator.Scenario_Generator.find_contacts_with_mobile_objs方法的典型用法代码示例。如果您正苦于以下问题:Python Scenario_Generator.find_contacts_with_mobile_objs方法的具体用法?Python Scenario_Generator.find_contacts_with_mobile_objs怎么用?Python Scenario_Generator.find_contacts_with_mobile_objs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scenario_generator.Scenario_Generator
的用法示例。
在下文中一共展示了Scenario_Generator.find_contacts_with_mobile_objs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_qualitative_path_ptlike
# 需要导入模块: from scenario_generator import Scenario_Generator [as 别名]
# 或者: from scenario_generator.Scenario_Generator import find_contacts_with_mobile_objs [as 别名]
def find_qualitative_path_ptlike(self, action, zones, initial_zone):
scenario = Scenario_Generator(self.width, self.height, self.immobile_objs, self.mobile_objs, self.manipulatable_obj, self.target_obj, showRender=False)
scenario.apply_impulse_and_run(action)
traj = scenario.find_man_traj()
b2contacts = scenario.find_contacts_with_mobile_objs()
#print contacts
pre_zone = initial_zone
path = [initial_zone]
for traj_pt in traj:
occupied_zone = -1
man_position = Point(traj_pt)
for i in xrange(len(zones)):
if zones[i].contains(man_position):
occupied_zone = i
break
# if out of scope, still wait to see if it will come back, quite slow
if occupied_zone == -1 or occupied_zone == pre_zone:
continue
'''
if occupied_zone == -1:
# reach end zone
path.append(-1)
break
elif occupied_zone == pre_zone:
continue
'''
path.append(occupied_zone)
pre_zone = occupied_zone
return path, b2contacts
示例2: find_qualitative_path_extended
# 需要导入模块: from scenario_generator import Scenario_Generator [as 别名]
# 或者: from scenario_generator.Scenario_Generator import find_contacts_with_mobile_objs [as 别名]
def find_qualitative_path_extended(self, velocity, zones, man_obj_id):
scenario = Scenario_Generator(self.width, self.height, self.immobile_objs, self.mobile_objs, self.manipulatable_obj, self.target_obj, showRender=False)
scenario.current_man_id = man_obj_id
scenario.apply_velocity_and_run(*velocity)
traj = scenario.find_man_traj()
b2contacts = scenario.find_contacts_with_mobile_objs()
initial_zone = -1
pre_zone = initial_zone
path = [initial_zone]
for traj_pt in traj:
occupied_zone = -1
man_position = Point(traj_pt)
for i in xrange(len(zones)):
if zones[i].contains(man_position):
occupied_zone = i
break
# if out of scope, still wait to see if it will come back, quite slow
if occupied_zone == -1 or occupied_zone == pre_zone:
continue
path.append(occupied_zone)
pre_zone = occupied_zone
return path, b2contacts