Beispiel #1
0
        """
        Retrieve the robot semantic model on the parameter server
        and parse it to create a SRDF robot structure.
        Warning: this requires roscore to be running.
        """
        # Could move this into xml_reflection
        import rospy
        return cls.from_xml_string(rospy.get_param(key))


xmlr.reflect(
    Robot,
    tag='robot',
    params=[
        #   name_attribute,
        xmlr.Attribute('name', str, False),  # Is 'name' a required attribute?
        xmlr.AggregateElement('group', Group),
        xmlr.AggregateElement('group_state', GroupState),
        xmlr.AggregateElement('end_effector', EndEffector),
        xmlr.AggregateElement('virtual_joint', VirtualJoint),
        xmlr.AggregateElement('passive_joint', PassiveJoint),
        xmlr.AggregateElement('disable_collisions', DisableCollisions),
        xmlr.AggregateElement('link_sphere_approximation',
                              LinkSphereApproximation)
    ])

# Make an alias
SRDF = Robot

xmlr.end_namespace()
Beispiel #2
0
				root = link
		assert root is not None, "No roots detected, invalid URDF."
		return root

	@classmethod
	def from_parameter_server(cls, key = 'robot_description'):
		"""
		Retrieve the robot model on the parameter server
		and parse it to create a URDF robot structure.

		Warning: this requires roscore to be running.
		"""
		# Could move this into xml_reflection
		import rospy
		return cls.from_xml_string(rospy.get_param(key))
	
xmlr.reflect(Robot, tag = 'robot', params = [
# 	name_attribute,
	xmlr.Attribute('name', str, False), # Is 'name' a required attribute?
	xmlr.AggregateElement('link', Link),
	xmlr.AggregateElement('joint', Joint),
	xmlr.AggregateElement('gazebo', xmlr.RawType()),
 	xmlr.AggregateElement('transmission', 'transmission'),
	xmlr.AggregateElement('material', Material)
	])

# Make an alias
URDF = Robot

xmlr.end_namespace()
Beispiel #3
0
xmlr.reflect(Link,
             parent_cls=Entity,
             params=[
                 xmlr.Element('inertial', Inertial),
                 xmlr.Attribute('kinematic', bool, False),
                 xmlr.AggregateElement('visual', Visual, var='visuals'),
                 xmlr.AggregateElement('collision',
                                       Collision,
                                       var='collisions')
             ])


class Model(Entity):
    def __init__(self, name=None, pose=None):
        Entity.__init__(self, name, pose)
        self.links = []
        self.joints = []
        self.plugins = []


xmlr.reflect(Model,
             parent_cls=Entity,
             params=[
                 xmlr.AggregateElement('link', Link, var='links'),
                 xmlr.AggregateElement('joint', Joint, var='joints'),
                 xmlr.AggregateElement('plugin', Plugin, var='plugins')
             ])

xmlr.end_namespace('sdf')
Beispiel #4
0

class Link(Entity):
	def __init__(self, name = None, pose = None, inertial = None, kinematic = False):
		Entity.__init__(self, name, pose)
		self.inertial = inertial
		self.kinematic = kinematic

xmlr.reflect(Link, parent_cls = Entity, params = [
	xmlr.Element('inertial', Inertial),
	xmlr.Attribute('kinematic', bool, False),
	xmlr.AggregateElement('visual', Visual, var = 'visuals'),
	xmlr.AggregateElement('collision', Collision, var = 'collisions')
	])


class Model(Entity):
	def __init__(self, name = None, pose=None):
		Entity.__init__(self, name, pose)
		self.links = []
		self.joints = []
		self.plugins = []

xmlr.reflect(Model, parent_cls = Entity, params = [
	xmlr.AggregateElement('link', Link, var = 'links'),
	xmlr.AggregateElement('joint', Joint, var = 'joints'),
	xmlr.AggregateElement('plugin', Plugin, var = 'plugins')
	])

xmlr.end_namespace('sdf')
Beispiel #5
0
    Link,
    parent_cls=Entity,
    params=[
        xmlr.Element("inertial", Inertial),
        xmlr.Attribute("kinematic", bool, False),
        xmlr.AggregateElement("visual", Visual, var="visuals"),
        xmlr.AggregateElement("collision", Collision, var="collisions"),
    ],
)


class Model(Entity):
    def __init__(self, name=None, pose=None):
        Entity.__init__(self, name, pose)
        self.links = []
        self.joints = []
        self.plugins = []


xmlr.reflect(
    Model,
    parent_cls=Entity,
    params=[
        xmlr.AggregateElement("link", Link, var="links"),
        xmlr.AggregateElement("joint", Joint, var="joints"),
        xmlr.AggregateElement("plugin", Plugin, var="plugins"),
    ],
)

xmlr.end_namespace("sdf")
Beispiel #6
0
    Link,
    parent_cls=Entity,
    params=[
        xmlr.Element("inertial", Inertial),
        xmlr.Attribute("kinematic", bool, False),
        xmlr.AggregateElement("visual", Visual, var="visuals"),
        xmlr.AggregateElement("collision", Collision, var="collisions"),
    ],
)


class Model(Entity):
    def __init__(self, name=None, pose=None):
        Entity.__init__(self, name, pose)
        self.links = []
        self.joints = []
        self.plugins = []


xmlr.reflect(
    Model,
    parent_cls=Entity,
    params=[
        xmlr.AggregateElement("link", Link, var="links"),
        xmlr.AggregateElement("joint", Joint, var="joints"),
        xmlr.AggregateElement("plugin", Plugin, var="plugins"),
    ],
)

xmlr.end_namespace("sdf")