def check_valid(self): assert self.xyz is not None or self.rpy is not None # Aliases for backwards compatibility @property def rotation(self): return self.rpy @rotation.setter def rotation(self, value): self.rpy = value @property def position(self): return self.xyz @position.setter def position(self, value): self.xyz = value xmlr.reflect(Pose, params = [ xmlr.Attribute('xyz', 'vector3', False), xmlr.Attribute('rpy', 'vector3', False) ]) # Common stuff name_attribute = xmlr.Attribute('name', str) origin_element = xmlr.Element('origin', Pose, False) class Color(xmlr.Object): def __init__(self, *args): # What about named colors? count = len(args) if count == 4 or count == 3: self.rgba = args elif count == 1: self.rgba = args[0]
import urdf_parser_py.xml_reflection as xmlr xmlr.start_namespace('srdf') verbose = True # Common stuff name_attribute = xmlr.Attribute('name', str) class Link(xmlr.Object): def __init__(self, name=None): self.name = name xmlr.reflect(Link, params=[name_attribute]) class Joint(xmlr.Object): def __init__(self, name=None): self.name = name xmlr.reflect(Joint, params=[name_attribute]) class JointVal(xmlr.Object): def __init__(self, name=None, value=[]): self.name = name self.value = value
from urdf_parser_py.xml_reflection.basics import * import urdf_parser_py.xml_reflection as xmlr xmlr.start_namespace('srdf') verbose = True # Common stuff name_attribute = xmlr.Attribute('name', str) class Link(xmlr.Object): def __init__(self, name = None): self.name = name xmlr.reflect(Link, params = [ name_attribute ]) class Joint(xmlr.Object): def __init__(self, name = None): self.name = name xmlr.reflect(Joint, params = [ name_attribute ]) class JointVal(xmlr.Object): def __init__(self, name = None, value = []): self.name = name self.value = value
@rotation.setter def rotation(self, value): self.rpy = value @property def position(self): return self.xyz @position.setter def position(self, value): self.xyz = value xmlr.reflect(Pose, params=[ xmlr.Attribute('xyz', 'vector3', False, default=[0, 0, 0]), xmlr.Attribute('rpy', 'vector3', False, default=[0, 0, 0]) ]) # Common stuff name_attribute = xmlr.Attribute('name', str) origin_element = xmlr.Element('origin', Pose, False) class Color(xmlr.Object): def __init__(self, *args): # What about named colors? count = len(args) if count == 4 or count == 3: self.rgba = args elif count == 1:
def check_valid(self): assert self.xyz is not None or self.rpy is not None name_attribute = xmlr.Attribute('name', str) pose_element = xmlr.Element('pose', Pose, False) class Entity(xmlr.Object): def __init__(self, name=None, pose=None): self.name = name self.pose = pose xmlr.reflect(Entity, params=[name_attribute, pose_element]) class Inertia(xmlr.Object): KEYS = ['ixx', 'ixy', 'ixz', 'iyy', 'iyz', 'izz'] def __init__(self, ixx=0.0, ixy=0.0, ixz=0.0, iyy=0.0, iyz=0.0, izz=0.0): self.ixx = ixx self.ixy = ixy self.ixz = ixz self.iyy = iyy self.iyz = iyz self.izz = izz def to_matrix(self): return [[self.ixx, self.ixy, self.ixz], [self.ixy, self.iyy, self.iyz],
@rotation.setter def rotation(self, value): self.rpy = value @property def position(self): return self.xyz @position.setter def position(self, value): self.xyz = value xmlr.reflect(Pose, params=[ xmlr.Attribute('xyz', 'vector3', False), xmlr.Attribute('rpy', 'vector3', False) ]) # Common stuff name_attribute = xmlr.Attribute('name', str) origin_element = xmlr.Element('origin', Pose, False) class Color(xmlr.Object): def __init__(self, *args): # What about named colors? count = len(args) if count == 4 or count == 3: self.rgba = args elif count == 1:
vec = self.as_vec() get_type('vector6').write_xml(node, vec) def check_valid(self): assert self.xyz is not None or self.rpy is not None name_attribute = xmlr.Attribute('name', str) pose_element = xmlr.Element('pose', Pose, False) class Entity(xmlr.Object): def __init__(self, name = None, pose = None): self.name = name self.pose = pose xmlr.reflect(Entity, params = [ name_attribute, pose_element ]) class Inertia(xmlr.Object): KEYS = ['ixx', 'ixy', 'ixz', 'iyy', 'iyz', 'izz'] def __init__(self, ixx=0.0, ixy=0.0, ixz=0.0, iyy=0.0, iyz=0.0, izz=0.0): self.ixx = ixx self.ixy = ixy self.ixz = ixz self.iyy = iyy self.iyz = iyz self.izz = izz def to_matrix(self):
def check_valid(self): assert self.xyz is not None or self.rpy is not None name_attribute = xmlr.Attribute("name", str) pose_element = xmlr.Element("pose", Pose, False) class Entity(xmlr.Object): def __init__(self, name=None, pose=None): self.name = name self.pose = pose xmlr.reflect(Entity, params=[name_attribute, pose_element]) class Inertia(xmlr.Object): KEYS = ["ixx", "ixy", "ixz", "iyy", "iyz", "izz"] def __init__(self, ixx=0.0, ixy=0.0, ixz=0.0, iyy=0.0, iyz=0.0, izz=0.0): self.ixx = ixx self.ixy = ixy self.ixz = ixz self.iyy = iyy self.iyz = iyz self.izz = izz def to_matrix(self): return [[self.ixx, self.ixy, self.ixz], [self.ixy, self.iyy, self.iyz], [self.ixz, self.iyz, self.izz]]
def check_valid(self): assert self.xyz is not None or self.rpy is not None name_attribute = xmlr.Attribute("name", str) pose_element = xmlr.Element("pose", Pose, False) class Entity(xmlr.Object): def __init__(self, name=None, pose=None): self.name = name self.pose = pose xmlr.reflect(Entity, params=[name_attribute, pose_element]) class Inertia(xmlr.Object): KEYS = ["ixx", "ixy", "ixz", "iyy", "iyz", "izz"] def __init__(self, ixx=0.0, ixy=0.0, ixz=0.0, iyy=0.0, iyz=0.0, izz=0.0): self.ixx = ixx self.ixy = ixy self.ixz = ixz self.iyy = iyy self.iyz = iyz self.izz = izz def to_matrix(self): return [