6 xmlr.start_namespace(
'sdf')
9 class Pose(xmlr.Object):
14 assert isinstance(vec, list)
20 elif extra
is not None:
21 assert xyz
is None,
"Cannot specify 6-length vector and 3-length vector"
22 assert len(extra) == 3,
"Invalid length"
26 assert len(vec) == 6,
"Invalid length"
31 xyz = self.
xyz if self.
xyz else [0, 0, 0]
32 rpy = self.
rpy if self.
rpy else [0, 0, 0]
45 assert self.
xyz is not None or self.
rpy is not None
48 name_attribute = xmlr.Attribute(
'name', str)
49 pose_element = xmlr.Element(
'pose', Pose,
False)
58 xmlr.reflect(Entity, params=[
65 KEYS = [
'ixx',
'ixy',
'ixz',
'iyy',
'iyz',
'izz']
67 def __init__(self, ixx=0.0, ixy=0.0, ixz=0.0, iyy=0.0, iyz=0.0, izz=0.0):
83 params=[xmlr.Element(key, float)
for key
in Inertia.KEYS])
90 def __init__(self, mass=0.0, inertia=None, pose=None):
96 xmlr.reflect(Inertial, params=[
97 xmlr.Element(
'mass', float),
98 xmlr.Element(
'inertia', Inertia),
104 def __init__(self, name=None, pose=None, inertial=None, kinematic=False):
105 Entity.__init__(self, name, pose)
110 xmlr.reflect(Link, parent_cls=Entity, params=[
111 xmlr.Element(
'inertial', Inertial),
112 xmlr.Attribute(
'kinematic', bool,
False),
113 xmlr.AggregateElement(
'visual', Visual, var=
'visuals'),
114 xmlr.AggregateElement(
'collision', Collision, var=
'collisions')
120 Entity.__init__(self, name, pose)
126 xmlr.reflect(Model, parent_cls=Entity, params=[
127 xmlr.AggregateElement(
'link', Link, var=
'links'),
128 xmlr.AggregateElement(
'joint', Joint, var=
'joints'),
129 xmlr.AggregateElement(
'plugin', Plugin, var=
'plugins')
132 xmlr.end_namespace(
'sdf')