• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python blenderapi.persistantstorage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中morse.core.blenderapi.persistantstorage函数的典型用法代码示例。如果您正苦于以下问题:Python persistantstorage函数的具体用法?Python persistantstorage怎么用?Python persistantstorage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了persistantstorage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: initialize

    def initialize(self):
        PocolibsDataStreamOutput.initialize(self, VimanObjectPublicArray)

        # Initialise the object
        self.obj = VimanObjectPublicArray()

        self.scene_object_list = []

        #If provided, read the list of ARToolkit tags to fill the list of objects
        #to export.
        self.scene_object_list += self._read_object_list()

        #Complete the list with the objects already tracked by the semantic cam.
        if 'passiveObjectsDict' in blenderapi.persistantstorage():
            self.scene_object_list += [obj['label'] for obj in blenderapi.persistantstorage().passiveObjectsDict.values()]

        if not self.scene_object_list:
            logger.error("No VIMAN object to track. Make sure some objects have " +\
                   "the game property 'Object' defined. Disabling poster for now.")
            return None

        # Init the data structures used by this poster
        self.obj.nbObjects = len(self.scene_object_list)
        i = 0
        for object in self.scene_object_list:
            logger.info("Adding " + object + " to the objects tracked by VIMAN")
            self.obj.objects[i].name = bytes(str(object), 'utf-8')
            i += 1
开发者ID:DAInamite,项目名称:morse,代码行数:28,代码来源:viman.py


示例2: default

    def default(self, ci):

        first_cam = blenderapi.persistantstorage().componentDict[self.camera_order[0]]
        main_to_origin = first_cam.robot_pose

        pom_robot_position =  ViamPos()
        pom_robot_position.x = main_to_origin.x
        pom_robot_position.y = main_to_origin.y
        pom_robot_position.z = main_to_origin.z
        pom_robot_position.yaw = main_to_origin.yaw
        pom_robot_position.pitch = main_to_origin.pitch
        pom_robot_position.roll = main_to_origin.roll

        # Compute the current time
        pom_date, t = Pocolibs.compute_date()

        ors_cameras = []
        ors_images = []

        # Cycle throught the cameras on the base
        # In normal circumstances, there will be two for stereo
        for camera_name in self.camera_order:
            camera_instance = blenderapi.persistantstorage().componentDict[camera_name]
            main_to_sensor = main_to_origin.transformation3d_with(
                    camera_instance.position_3d)
            imX = camera_instance.image_width
            imY = camera_instance.image_height
            try:
                image_data = camera_instance.local_data['image']
            except KeyError as detail:
                logger.warning("Camera image not found to read by VIAM poster.\n \
                        \tThe 'Class' property in the Camera component could be \
                        wrongly defined")

            # Don't create a poster if the camera is disabled
            if image_data is None or not camera_instance.capturing:
                logger.debug("Camera '%s' not capturing. Exiting viam poster" % \
                        camera_instance.bge_object.name)
                return

            # Fill in the structure with the image information
            camera_data = ViamSimuImage()
            camera_data.width = imX
            camera_data.height = imY
            camera_data.pom_tag = pom_date
            camera_data.tacq_sec = t.second
            camera_data.tacq_usec = t.microsecond
            camera_data.x = main_to_sensor.x
            camera_data.y = main_to_sensor.y
            camera_data.z = main_to_sensor.z
            camera_data.yaw = main_to_sensor.yaw
            camera_data.pitch = main_to_sensor.pitch
            camera_data.roll = main_to_sensor.roll
            camera_data.flipped = camera_instance.vertical_flip

            ors_cameras.append(camera_data)
            ors_images.append(image_data)

        self.obj.post(pom_robot_position, ors_cameras, ors_images)
开发者ID:eyesonlyhack,项目名称:morse,代码行数:59,代码来源:viam.py


示例3: action

 def action(self):
     if self._time_initialized:
         self.node.morse_ambassador.advance_time()
     else:
         self.node.init_time()
         self._time_initialized = True
     if self.time_sync and self.stop_time < self.node.morse_ambassador.logical_time:
         blenderapi.persistantstorage().serviceObjectDict["simulation"].quit()
开发者ID:pierriko,项目名称:morse,代码行数:8,代码来源:hla_datastream.py


示例4: _robot_exists

def _robot_exists(robot):
    try:
        for obj, robot_instance in blenderapi.persistantstorage().robotDict.items():
            if obj.name == robot:
                return robot_instance
    except KeyError:
        try:
            for obj, robot_instance in blenderapi.persistantstorage().externalRobotDict.items():
                if obj.name == robot:
                    return robot_instance
        except KeyError:
            return None
开发者ID:lakky,项目名称:morse,代码行数:12,代码来源:communication_services.py


示例5: switch_cameras

 def switch_cameras(self):
     """ Change between the main camera view in MORSE and the first person camera """
     scene = blenderapi.scene()
     index = blenderapi.persistantstorage().current_camera_index
     next_camera = scene.cameras[index]
     scene.active_camera = next_camera
     logger.info("Showing view from camera: '%s'" % next_camera.name)
     # Disable mouse cursor for Human camera
     if next_camera.name == "Human_Camera":
         blenderapi.mousepointer(visible = False)
     else:
         blenderapi.mousepointer(visible = True)
     # Update the index for the next call
     index = (index + 1) % len(scene.cameras)
     blenderapi.persistantstorage().current_camera_index = index
开发者ID:Greg8978,项目名称:morse_MaRDi,代码行数:15,代码来源:mocap_human.py


示例6: synchronize

    def synchronize(self):
        if not self.node_stream:
            logger.debug("not self.node_stream")
            return
        if not self.node_stream.connected:
            logger.debug("not self.node_stream.connected")
            return

        # Get the coordinates of local robots
        for obj in blenderapi.persistantstorage().robotDict.keys():
            #self.out_data[obj.name] = [obj.worldPosition.to_tuple()]
            euler_rotation = obj.worldOrientation.to_euler()
            self.out_data[obj.name] = [obj.worldPosition.to_tuple(), \
                [euler_rotation.x, euler_rotation.y, euler_rotation.z]]
        self.out_data['__time'] = [self.simulation_time.time, 1.0/ blenderapi.getfrequency(), self.simulation_time.real_time]
        # Send the encoded dictionary through a socket
        #  and receive a reply with any changes in the other nodes
        in_data = self._exchange_data(self.out_data)
        logger.debug("Received: %s" % in_data)

        if not in_data:
            return

        try:
            self.update_scene(in_data, blenderapi.scene())
        except Exception as e:
            logger.warning("error while processing incoming data: " + str(e))
开发者ID:alexfig,项目名称:morse,代码行数:27,代码来源:socket.py


示例7: _get_armature_actuator

 def _get_armature_actuator(self):
     # Get the reference to the class instance of the armature actuator
     component_dict = blenderapi.persistantstorage().componentDict
     if self.armature and self.armature.name in component_dict:
         self._armature_actuator = component_dict[self.armature.name]
     else:
         logger.error("Could not find armature actuator <%s> from armature sensor <%s>!" % (self.armature.name, self.name()))
开发者ID:matrixchan,项目名称:morse,代码行数:7,代码来源:armature_pose.py


示例8: initialize

    def initialize(self):
        try:
            self.out_robot = self.rtia_.getObjectClassHandle("Robot")
            self.out_position = self.rtia_.getAttributeHandle("position", self.out_robot)
            self.out_orientation = self.rtia_.getAttributeHandle("orientation", self.out_robot)
        except rti.NameNotFound:
            logger.error("'Robot' (or attributes) not declared in FOM." + "Your '.fed' file may not be up-to-date.")
            return False

        self.rtia_.publishObjectClass(self.out_robot, [self.out_position, self.out_orientation])

        robot_dict = blenderapi.persistantstorage().robotDict
        for obj, local_robot_data in robot_dict.items():
            self.objects.append(self.rtia_.registerObjectInstance(self.out_robot, obj.name))
            logger.info("Pose of robot %s will be published on the %s federation.", obj.name, self.federation)

        self.in_robot = self.rtia_.getObjectClassHandle("Robot")
        self.in_position = self.rtia_.getAttributeHandle("position", self.in_robot)
        self.in_orientation = self.rtia_.getAttributeHandle("orientation", self.in_robot)
        self.rtia_.subscribeObjectClassAttributes(self.in_robot, [self.in_position, self.in_orientation])
        # TSO initialization
        if self.tag:
            self.tag = False
            self.lookahead = 1
            self.current_time = self.rtia_.queryFederateTime()
            logger.debug("Initial Federate time is %s", self.current_time)
            self.rtia_.enableTimeConstrained()
            self.rtia_.enableTimeRegulation(self.current_time, self.lookahead)
            while not self.constrained and not self.regulator and not self.tag:
                self.rtia_.tick(0, 1)
        logger.debug("MorseAmbassador initialized")
开发者ID:kargm,项目名称:morse,代码行数:31,代码来源:hla.py


示例9: __init__

    def __init__(self, obj, parent=None):
        """ Constructor method.

        Receives the reference to the Blender object.
        The second parameter should be the name of the object's parent.
        """
        
        logger.info('%s initialization of' % obj.name)
        # Call the constructor of the parent class
        morse.sensors.camera.Camera.__init__(self, obj, parent)

        # Locate the Blender camera object associated with this sensor
        main_obj = self.bge_object
        for obj in main_obj.children:
            if hasattr(obj, 'lens'):
                self.blender_cam = obj
                logger.info("Camera object: {0}".format(self.blender_cam))
                break
        if not self.blender_cam:
            logger.error("no camera object associated to the semantic camera. \
                         The semantic camera requires a standard Blender  \
                         camera in its children.")

        # TrackedObject is a dictionary containing the list of tracked objects
        # (->meshes with a class property set up) as keys
        #  and the bounding boxes of these objects as value.
        if not 'trackedObjects' in blenderapi.persistantstorage():
            logger.info('Initialization of tracked objects:')
            blenderapi.persistantstorage().trackedObjects = \
                            dict.fromkeys(passive_objects.active_objects())

            # Store the bounding box of the marked objects
            for obj in blenderapi.persistantstorage().trackedObjects.keys():

                # bound_box returns the bounding box in local space
                #  instead of world space.
                blenderapi.persistantstorage().trackedObjects[obj] = \
                                    blenderapi.objectdata(obj.name).bound_box

                details = passive_objects.details(obj)
                logger.info('    - {%s} (type:%s)'%
                            (details['label'], details['type']))

        if self.noocclusion:
            logger.info("Semantic camera running in 'no occlusion' mode (fast mode).")
        logger.info("Component initialized, runs at %.2f Hz ", self.frequency)
开发者ID:sterlingsomers,项目名称:ACTR_3D,代码行数:46,代码来源:GeometricCamerav1.py


示例10: activate

def activate(component_name):
    """ Enable the functionality of the component specified
    """
    try:
        blenderapi.persistantstorage().componentDict[component_name]._active = True
    except KeyError as detail:
        logger.warn("Component %s not found. Can't activate" % detail)
        raise MorseRPCTypeError("Component %s not found. Can't activate" % detail)
开发者ID:davidhodo,项目名称:morse,代码行数:8,代码来源:supervision_services.py


示例11: __init__

    def __init__(self, args, kwargs):
        """ Initialize the socket connections """
        # Call the constructor of the parent class
        DatastreamManager.__init__(self, args, kwargs)

        self._mav = mavlink.MAVLink(None)
        self._conn_manager = MavlinkConnManager(self._mav)
        self._boot_time = blenderapi.persistantstorage().time.time
开发者ID:adegroote,项目名称:morse,代码行数:8,代码来源:mavlink_datastream.py


示例12: deactivate

def deactivate(component_name):
    """ Stop the specified component from calling its default_action method
    """
    try:
        blenderapi.persistantstorage().componentDict[component_name]._active = False
    except KeyError as detail:
        logger.warn("Component %s not found. Can't deactivate" % detail)
        raise MorseRPCTypeError("Component %s not found. Can't deactivate" % detail)
开发者ID:davidhodo,项目名称:morse,代码行数:8,代码来源:supervision_services.py


示例13: get_cameras_instance

 def get_cameras_instance(self):
     if self.video_camera and self.depth_camera:
         return
     # Get the reference to the class instance of the depth and video cameras
     component_dict = blenderapi.persistantstorage().componentDict
     if self.video_camera_name in component_dict:
         self.video_camera = component_dict[self.video_camera_name]
     if self.depth_camera_name in component_dict:
         self.depth_camera = component_dict[self.depth_camera_name]
开发者ID:Greg8978,项目名称:morse_MaRDi,代码行数:9,代码来源:kinect.py


示例14: abort_request

    def abort_request(self, request_id):
        """ This method will interrupt a running asynchronous service,
        uniquely described by its request_id
        """
        component_name, service_name = self._pending_requests[request_id]

        for component in blenderapi.persistantstorage().componentDict.values():
            if component.name() == component_name:
                logger.info("calling  interrupt on %s" % str(component))
                component.interrupt()
                return

        # if not found, search in the overlay dictionnary
        for overlay in blenderapi.persistantstorage().overlayDict.values():
            if overlay.name() == component_name:
                logger.info("calling  interrupt on %s" % str(overlay))
                overlay.interrupt()
                return
开发者ID:morse-simulator,项目名称:morse,代码行数:18,代码来源:request_manager.py


示例15: default

 def default(self, ci='unused'):
     logger.debug("Posting message to the MOOS database.")
     current_time = blenderapi.persistantstorage().current_time
     #iterate through all objects of the component_instance and post the data
     for variable, data in self.data.items():
         name = "%s_%s" % (self.component_name, variable)
         logger.debug("name: %s, type: %s, data: %s"%
                             (name, type(data), str(data)))
         self.m.Notify(name, str(data), current_time)
开发者ID:DAInamite,项目名称:morse,代码行数:9,代码来源:abstract_moos.py


示例16: initialize

 def initialize(self):
     AbstractMOOS.initialize(self)
     # post lidar settings to the database only once at startup
     cur_time=blenderapi.persistantstorage().time.time
     self.m.Notify('sScanAngle',
         self.component_instance.scan_window, cur_time)
     self.m.Notify('sScanResolution',
         self.component_instance.resolution, cur_time)
     self.m.Notify('sScanRange',
         self.component_instance.laser_range, cur_time)
开发者ID:HorvathJo,项目名称:morse,代码行数:10,代码来源:sick.py


示例17: __init__

 def __init__(self, name, hvl, radioactivity):
     """Initialisation setting name, density [g/cm^3], half-value layers,
     and radioactivity.
     The HVL has to be supplied as dictionary with the source radionuclide as
     key and the corresponding HVL [cm] as value.
     """
     self.name = name
     self.hvl = hvl
     self.radioactivity = radioactivity
     self.t_created = blenderapi.persistantstorage().time.time
开发者ID:mklostermann,项目名称:morse-radiation_sensor,代码行数:10,代码来源:material.py


示例18: look_robot

def look_robot(camera):
    """ Put the camera above a robot """
    global robots, current_robot
    if not robots:
        robots = [r for r in blenderapi.persistantstorage().robotDict]

    robot = robots[ current_robot ]
    camera.worldTransform = robot.worldTransform * camera_to_robot_transform
    # switch between robots
    current_robot = (current_robot + 1) % len(robots)
开发者ID:Djeef,项目名称:morse,代码行数:10,代码来源:view_camera.py


示例19: __init__

    def __init__(self, obj, parent=None):
        """ Constructor method.

        Receives the reference to the Blender object.
        The second parameter should be the name of the object's parent.
        """
        logger.info("%s initialization" % obj.name)
        # Call the constructor of the parent class
        super(self.__class__, self).__init__(obj, parent)

        # Locate the Blender camera object associated with this sensor
        main_obj = self.bge_object
        for obj in main_obj.children:
            if hasattr(obj, "lens"):
                self.blender_cam = obj
                logger.info("Camera object: {0}".format(self.blender_cam))
                break
        if not self.blender_cam:
            logger.error(
                "no camera object associated to the semantic camera. \
                         The semantic camera requires a standard Blender  \
                         camera in its children."
            )

        # TrackedObject is a dictionary containing the list of tracked objects
        # (->meshes with a class property set up) as keys
        #  and the bounding boxes of these objects as value.
        if not "trackedObjects" in blenderapi.persistantstorage():
            logger.info("Initialization of tracked objects:")
            blenderapi.persistantstorage().trackedObjects = dict.fromkeys(passive_objects.active_objects())

            # Store the bounding box of the marked objects
            for obj in blenderapi.persistantstorage().trackedObjects.keys():

                # bound_box returns the bounding box in local space
                #  instead of world space.
                blenderapi.persistantstorage().trackedObjects[obj] = blenderapi.objectdata(obj.name).bound_box

                details = passive_objects.details(obj)
                logger.info("    - {%s} (type:%s)" % (details["label"], details["type"]))

        logger.info("Component initialized")
开发者ID:matrixchan,项目名称:morse,代码行数:42,代码来源:semantic_camera.py


示例20: details

def details(obj):
    """ Returns a dictionary containing the differents properties for a given
    active object.

    If the object is not active (ie, it has no 'Object' property, or the
    property is set to False), None is returned.

    If no label is available, it defaults to the Blender name.
    The description field may be an empty string.
    If no type is available, it defaults to 'Object'.
    If the graspable flag is not present, it defaults to False.

    :param name: the Blender name of the object.
    :return: a dictionary {'label':string, 'description':string, 'type':string, 'graspable':bool}

    """
    if not obj in blenderapi.persistantstorage().passiveObjectsDict.keys():
        return None
    else:
        return blenderapi.persistantstorage().passiveObjectsDict[obj]
开发者ID:DAInamite,项目名称:morse,代码行数:20,代码来源:passive_objects.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python blenderapi.scene函数代码示例发布时间:2022-05-27
下一篇:
Python blenderapi.controller函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap