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


Python URDF.from_xml_file方法代码示例

本文整理汇总了Python中urdf_parser_py.urdf.URDF.from_xml_file方法的典型用法代码示例。如果您正苦于以下问题:Python URDF.from_xml_file方法的具体用法?Python URDF.from_xml_file怎么用?Python URDF.from_xml_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在urdf_parser_py.urdf.URDF的用法示例。


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

示例1: runDiff

# 需要导入模块: from urdf_parser_py.urdf import URDF [as 别名]
# 或者: from urdf_parser_py.urdf.URDF import from_xml_file [as 别名]
def runDiff(original_file, new_file, output_file):
    original_robot = URDF.from_xml_file(original_file)
    new_robot = URDF.from_xml_file(new_file)
    # only joint and link are considered
    diffs = dict()
    for j in original_robot.joints:
        new_j = findJointByName(new_robot, j.name)
        # check origin difference
        if new_j:
            diff = jointDiff(j, new_j)
            if diff:
                diffs[j.name] = diff
    with open(output_file, "w") as f:
        f.write(yaml.dump(diffs))
        print yaml.dump(diffs)
开发者ID:YoheiKakiuchi,项目名称:jsk_model_tools,代码行数:17,代码来源:urdf_patch.py

示例2: __init__

# 需要导入模块: from urdf_parser_py.urdf import URDF [as 别名]
# 或者: from urdf_parser_py.urdf.URDF import from_xml_file [as 别名]
    def __init__(self, urdf_path, sem_path, name_suffix=None):
        self.nsmap = {
            "xsd": "http://www.w3.org/2001/XMLSchema#",
            "owl": "http://www.w3.org/2002/07/owl#",
            "xsd": "http://www.w3.org/2001/XMLSchema#",
            "srdl2": "http://knowrob.org/kb/srdl2.owl#",
            "owl2xml": "http://www.w3.org/2006/12/owl2-xml#",
            "knowrob": "http://knowrob.org/kb/knowrob.owl#",
            "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
            "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
            "srdl2-comp": "http://knowrob.org/kb/srdl2-comp.owl#",
            "srdl2-cap": "http://knowrob.org/kb/srdl2-cap.owl#",
            "qudt-unit": "http://qudt.org/vocab/unit#",
        }
        self.imports = [
            "package://knowrob_srdl/owl/srdl2-comp.owl",
            "package://knowrob_common/owl/knowrob.owl",
        ]
        self.id_gen = UniqueStringGenerator()
        self.urdf = URDF.from_xml_file(urdf_path)
        self.urdf.check_valid()

        basename = os.path.basename(sem_path)
        namespace, _ = os.path.splitext(basename)
        self.map_ns = namespace
        if name_suffix is None:
            self.map_name = self.urdf.name + "_" + self.id_gen.gen()
        else:
            self.map_name = self.urdf.name + "_" + name_suffix
        self.map_uri_base = "http://knowrob.org/kb/%s" % basename
        self.map_uri = self.map_uri_base + "#"
        self.nsmap[self.map_ns] = self.map_uri
        self.transformations = {}
开发者ID:airballking,项目名称:knowrob,代码行数:35,代码来源:urdf_to_sem.py

示例3: runPatch

# 需要导入模块: from urdf_parser_py.urdf import URDF [as 别名]
# 或者: from urdf_parser_py.urdf.URDF import from_xml_file [as 别名]
def runPatch(input_file, patch_yaml, output_file):
    input_robot = URDF.from_xml_file(input_file)
    patch_param = yaml.load(open(patch_yaml))
    for joint_name in patch_param.keys():
        diff = patch_param[joint_name]
        if diff.has_key("xyz"):
            j = input_robot.joint_map[joint_name]
            j.origin.xyz = diff["xyz"]
        if diff.has_key("rpy"):
            j = input_robot.joint_map[joint_name]
            j.origin.rpy = diff["rpy"]
    if output_file:
        with open(output_file, "w") as f:
            f.write(input_robot.to_xml_string())
    else:
        print input_robot.to_xml_string()
开发者ID:YoheiKakiuchi,项目名称:jsk_model_tools,代码行数:18,代码来源:urdf_patch.py

示例4: __init__

# 需要导入模块: from urdf_parser_py.urdf import URDF [as 别名]
# 或者: from urdf_parser_py.urdf.URDF import from_xml_file [as 别名]
import rospy
import rospkg
from urdf_parser_py.urdf import URDF
from tf_cache import LocalTfCache
import std_redirect

#ROS Global Config stuff

#get configuration constants from the param server
#this class recursively parses configuration attributes into properties, letting us use the easy . syntax
class _ParamNode:
    def __init__(self, **entries): 
        self.__dict__.update(entries)
        for key in self.__dict__:
        	if type(self.__dict__[key]) is dict:
        		self.__dict__[key] = _ParamNode(**self.__dict__[key])

def config(prefix = ""):
	return _ParamNode(**rospy.get_param(prefix))

import geometry

with std_redirect.SysRedirect(stderr=std_redirect.devnull): #squelch annoying URDF warnings
	try:
		urdf = URDF.from_parameter_server()
	except KeyError:
		urdf = URDF.from_xml_file(rospkg.RosPack().get_path('spacejockey') + '/resources/spacejockey.urdf')

import kinematics
开发者ID:SpaceJockey,项目名称:MRSD-Team-B,代码行数:31,代码来源:__init__.py


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