예제 #1
0
def exportSubmechanisms(model, path):
    """This function exports the submechanisms contained in a robot model.

    Args:
      model(dict): The robot model to export
      path(str): The filepath to export the submechanisms data to

    Returns:

    """
    log("Phobos Submechanisms export: Creating submechanisms data at " + path,
        "INFO")
    for submechanism in model['submechanisms']:
        root = sUtils.getObjectByProperty('submechanism/name',
                                          submechanism['contextual_name'])
        linkobjs = [root] + root['submechanism/spanningtree']
        if 'submechanism/freeloader' in root:
            linkobjs += root['submechanism/freeloader']

        objects = [
            o for link in linkobjs for o in link.children
            if o.phobostype in ['visual', 'collision', 'inertial']
        ] + linkobjs
        model = deriveModelDictionary(root, root['submechanism/name'], objects)
        jointname = nUtils.getObjectName(root, 'joint')
        if jointname in model['joints']:
            del model['joints'][jointname]
            log('Removed joint which is not part of submodel: ' + jointname,
                'DEBUG')
        exportModel(model, path, ['urdf'])
예제 #2
0
def exportSubmechanisms(model, path):
    """This function exports the submechanisms contained in a robot model.

    Args:
      model(dict): The robot model to export
      path(str): The filepath to export the submechanisms data to

    Returns:

    """
    log("Phobos Submechanisms export: Creating submechanisms data at " + path, "INFO")
    for submechanism in model['submechanisms']:
        root = sUtils.getObjectByProperty('submechanism/name', submechanism['contextual_name'])
        linkobjs = [root] + root['submechanism/spanningtree']
        if 'submechanism/freeloader' in root:
            linkobjs += root['submechanism/freeloader']

        objects = [
            o
            for link in linkobjs
            for o in link.children
            if o.phobostype in ['visual', 'collision', 'inertial']
        ] + linkobjs
        model = deriveModelDictionary(root, root['submechanism/name'], objects)
        jointname = nUtils.getObjectName(root, 'joint')
        if jointname in model['joints']:
            del model['joints'][jointname]
            log('Removed joint which is not part of submodel: ' + jointname, 'DEBUG')
        exportModel(model, path, ['urdf'])
예제 #3
0
파일: poses.py 프로젝트: Amudtogal/phobos
    def execute(self, context):
        """

        Args:
          context: 

        Returns:

        """
        root = sUtils.getObjectByProperty('model/name', self.robot_name)
        poses.storePose(root, self.pose_name)
        return {'FINISHED'}
예제 #4
0
    def execute(self, context):
        """

        Args:
          context: 

        Returns:

        """
        root = sUtils.getObjectByProperty('model/name', self.robot_name)
        poses.storePose(root, self.pose_name)
        return {'FINISHED'}