コード例 #1
0
ファイル: viman.py プロジェクト: DAInamite/morse
    def default(self, ci):
        seen_objects = [obj['name'] for obj in self.data['visible_objects']]
        parent = self.component_instance.robot_parent

        i = 0
        for object_id in self.scene_object_list:
            try:
                t = time.time()
                tacq_sec = int(t)
                tacq_usec = int((t - tacq_sec) * 1000)
                self.obj.objects[i].tacq_sec = tacq_sec
                self.obj.objects[i].tacq_usec = tacq_usec

                if object_id in seen_objects:
                    obj = passive_objects.obj_from_label(object_id)

                    position_3d = Transformation3d(obj)
                    logger.debug("VIMAN " + object_id + "(" + obj.name +
                                 ") is visible at " + str(position_3d))
                    self.obj.objects[i].found_Stereo = 1
                    _fill_world_matrix(self.obj.objects[i], position_3d)
                    _fill_robot_matrix(self.obj.objects[i], parent, position_3d)
                else:
                    self.obj.objects[i].found_Stereo = 0
            except KeyError as detail:
                logger.debug("WARNING: Object %s not found in the scene" % detail)
            i += 1
        self.write(self.obj)
コード例 #2
0
ファイル: viman.py プロジェクト: ekyah411/morse
    def default(self, ci):
        seen_objects = [obj['name'] for obj in self.data['visible_objects']]
        parent = self.component_instance.robot_parent

        i = 0
        for object_id in self.scene_object_list:
            try:
                t = time.time()
                tacq_sec = int(t)
                tacq_usec = int((t - tacq_sec) * 1000)
                self.obj.objects[i].tacq_sec = tacq_sec
                self.obj.objects[i].tacq_usec = tacq_usec

                if object_id in seen_objects:
                    obj = passive_objects.obj_from_label(object_id)

                    position_3d = Transformation3d(obj)
                    logger.debug("VIMAN " + object_id + "(" + obj.name +
                                 ") is visible at " + str(position_3d))
                    self.obj.objects[i].found_Stereo = 1
                    _fill_world_matrix(self.obj.objects[i], position_3d)
                    _fill_robot_matrix(self.obj.objects[i], parent,
                                       position_3d)
                else:
                    self.obj.objects[i].found_Stereo = 0
            except KeyError as detail:
                logger.debug("WARNING: Object %s not found in the scene" %
                             detail)
            i = i + 1
        self.write(self.obj)
コード例 #3
0
def write_viman(self, component_instance):
    """ Write the objects list to a poster """
    # Get the id of the poster already created
    poster_id = self._poster_dict[component_instance.blender_obj.name]
    parent = component_instance.robot_parent

    scene = bge.logic.getCurrentScene()

    seen_objects = [
        obj['name'] for obj in component_instance.local_data['visible_objects']
    ]

    i = 0
    for object_id in self.scene_object_list:

        try:
            t = time.time()
            tacq_sec = int(t)
            tacq_usec = int((t - tacq_sec) * 1000)
            ors_viman_poster.set_tacq(self.viman_data, i, tacq_sec, tacq_usec)

            if object_id in seen_objects:

                object = passive_objects.obj_from_label(object_id)

                position_3d = Transformation3d(object)
                logger.debug("VIMAN " + object_id + "(" + object.name +
                             ") is visible at " + str(position_3d))
                ors_viman_poster.set_visible(self.viman_data, i, 1)
                _fill_world_matrix(self.viman_data, position_3d, i)
                _fill_robot_matrix(self.viman_data, parent, position_3d, i)
            else:
                ors_viman_poster.set_visible(self.viman_data, i, 0)

            # Write to the poster with the data for all objects
            posted = ors_viman_poster.real_post_viman_poster(
                poster_id, self.viman_data)
        except KeyError as detail:
            logger.debug("WARNING: Object %s not found in the scene" % detail)
            pass
            posted = False

        i = i + 1
コード例 #4
0
ファイル: viman.py プロジェクト: matrixchan/morse
def write_viman(self, component_instance):
    """ Write the objects list to a poster """
    # Get the id of the poster already created
    poster_id = self._poster_dict[component_instance.bge_object.name]
    parent = component_instance.robot_parent

    scene = blenderapi.scene()
    
    seen_objects = [obj['name'] for obj in component_instance.local_data['visible_objects']]

    i = 0
    for object_id in self.scene_object_list:

        try:
            t = time.time()
            tacq_sec = int(t)
            tacq_usec = int((t - tacq_sec) * 1000)
            ors_viman_poster.set_tacq(self.viman_data, i, tacq_sec, tacq_usec)
            
            if object_id in seen_objects:

                object = passive_objects.obj_from_label(object_id)

                position_3d = Transformation3d(object)
                logger.debug("VIMAN " + object_id + "(" + object.name + ") is visible at " + str(position_3d))
                ors_viman_poster.set_visible(self.viman_data, i, 1)
                _fill_world_matrix(self.viman_data, position_3d, i)
                _fill_robot_matrix(self.viman_data, parent, position_3d, i)
            else:
                ors_viman_poster.set_visible (self.viman_data, i, 0)
        
        
            # Write to the poster with the data for all objects
            posted = ors_viman_poster.real_post_viman_poster(poster_id, self.viman_data)
        except KeyError as detail:
            logger.debug("WARNING: Object %s not found in the scene" % detail)
            pass
            posted = False

        i = i + 1