Beispiel #1
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
Beispiel #2
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.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
Beispiel #3
0
def write_viman(self, component_instance):
    """ Write an image and all its data 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 = GameLogic.getCurrentScene()

    i = 0
    for object_id in self.scene_object_list:

        try:
            object = scene.objects[object_id]

            if object in component_instance.local_data['visible_objects']:

                position_3d = Transformation3d(object)
                logger.debug("VIMAN " + 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)
            else:
                ors_viman_poster.set_visible (self.viman_data, i, 0)

            #robot_matrix = viman_data.objects[i].thetaMatRobot
            #world_matrix = viman_data.objects[i].thetaMatOrigin
            #camera_matrix = viman_data.objects[i].thetaMatCam

            # Compute the current time
            #pom_date, t = self._compute_date()

            # 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