4 xmlr.start_namespace(
'srdf')
9 name_attribute = xmlr.Attribute(
'name', str)
15 xmlr.reflect(Link, params = [
23 xmlr.reflect(Joint, params = [
32 xmlr.reflect(JointVal, params = [
34 xmlr.Attribute(
'value',
"vector")
38 def __init__(self, center = None, radius = 0.0):
42 xmlr.reflect(Sphere, params = [
43 xmlr.Attribute(
'center', str),
44 xmlr.Attribute(
'radius', float)
48 link_element = xmlr.Element(
'link', Link,
False)
51 TYPES = [
'unknown',
'fixed',
'floating',
'planar']
53 def __init__(self, name = None, child_link = None, parent_frame = None, joint_type = None):
60 assert self.
type in self.
TYPES,
"Invalid joint type: {}".format(self.
type)
68 xmlr.reflect(VirtualJoint, params = [
70 xmlr.Attribute(
'child_link', str),
71 xmlr.Attribute(
'parent_frame', str),
72 xmlr.Attribute(
'type', str)
77 def __init__(self, base_link = None, tip_link = None):
81 xmlr.reflect(Chain, params = [
82 xmlr.Attribute(
'base_link', str),
83 xmlr.Attribute(
'tip_link', str)
87 def __init__(self, name = None, group = None, parent_link = None, parent_group = None):
93 xmlr.reflect(EndEffector, params = [
95 xmlr.Attribute(
'group', str),
96 xmlr.Attribute(
'parent_link', str),
97 xmlr.Attribute(
'parent_group', str,
False)
104 xmlr.reflect(PassiveJoint, params = [
109 def __init__(self, link1 = None, link2 = None, reason = None):
114 xmlr.reflect(DisableCollisions, params = [
115 xmlr.Attribute(
'link1', str),
116 xmlr.Attribute(
'link2', str),
117 xmlr.Attribute(
'reason', str,
False)
123 self.aggregate_init()
131 xmlr.reflect(Group, params = [
133 xmlr.AggregateElement(
'link', Link),
134 xmlr.AggregateElement(
'joint', Joint),
135 xmlr.AggregateElement(
'chain', Chain),
136 xmlr.AggregateElement(
'group', Group)
141 self.aggregate_init()
146 xmlr.reflect(GroupState, params = [
148 xmlr.AggregateElement(
'joint', JointVal),
149 xmlr.Attribute(
'group', str)
155 self.aggregate_init()
159 xmlr.reflect(LinkSphereApproximation, params = [
160 xmlr.Attribute(
'link', str),
161 xmlr.AggregateElement(
'sphere', Sphere)
166 self.aggregate_init()
180 xmlr.Object.add_aggregate(self, typeName, elem)
182 if typeName ==
'group':
185 elif typeName ==
'group_state':
214 Retrieve the robot semantic model on the parameter server
215 and parse it to create a SRDF robot structure.
217 Warning: this requires roscore to be running.
221 return cls.from_xml_string(rospy.get_param(key))
223 xmlr.reflect(Robot, tag =
'robot', params = [
225 xmlr.Attribute(
'name', str,
False),
226 xmlr.AggregateElement(
'group', Group),
227 xmlr.AggregateElement(
'group_state', GroupState),
228 xmlr.AggregateElement(
'end_effector', EndEffector),
229 xmlr.AggregateElement(
'virtual_joint', VirtualJoint),
230 xmlr.AggregateElement(
'passive_joint', PassiveJoint),
231 xmlr.AggregateElement(
'disable_collisions', DisableCollisions),
232 xmlr.AggregateElement(
'link_sphere_approximation', LinkSphereApproximation)