当前位置: 首页>>代码示例>>Python>>正文


Python Scenario_Generator.find_contacts_with_mobile_objs方法代码示例

本文整理汇总了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
开发者ID:fantastdd,项目名称:physical-reasoning-2d,代码行数:36,代码来源:increment_solver.py

示例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
开发者ID:fantastdd,项目名称:physical-reasoning-2d,代码行数:29,代码来源:increment_solver.py


注:本文中的scenario_generator.Scenario_Generator.find_contacts_with_mobile_objs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。