Пример #1
0
        parent_transformation = Transformation()
        for item in itertools.chain(parent_link.visual, parent_link.collision):
            if not item.init_transformation:
                item.init_transformation = parent_transformation
            else:
                parent_transformation = item.init_transformation

        joint._create(parent_transformation)

        for item in itertools.chain(child_link.visual, child_link.collision):
            item.init_transformation = joint.current_transformation

        return joint


URDFParser.install_parser(RobotModel, 'robot')
URDFParser.install_parser(Material, 'robot/material')
URDFParser.install_parser(Color, 'robot/material/color')
URDFParser.install_parser(Texture, 'robot/material/texture')

if __name__ == '__main__':
    import os
    import doctest
    from compas import HERE
    from compas.geometry import Sphere  # noqa: F401
    from compas.robots import GithubPackageMeshLoader  # noqa: F401

    ur5_urdf_file = os.path.join(HERE, '..', '..', 'tests', 'compas', 'robots',
                                 'fixtures', 'ur5.xacro')

    robot = RobotModel("robot", links=[], joints=[])
Пример #2
0
                 type=None,
                 visual=[],
                 collision=[],
                 inertial=None,
                 **kwargs):
        self.name = name
        self.type = type
        self.visual = visual
        self.collision = collision
        self.inertial = inertial
        self.attr = kwargs
        self.joints = []
        self.parent_joint = None


URDFParser.install_parser(Link, 'robot/link')
URDFParser.install_parser(Inertial, 'robot/link/inertial')
URDFParser.install_parser(Mass, 'robot/link/inertial/mass')
URDFParser.install_parser(Inertia, 'robot/link/inertial/inertia')

URDFParser.install_parser(Visual, 'robot/link/visual')
URDFParser.install_parser(Collision, 'robot/link/collision')

URDFParser.install_parser(Origin, 'robot/link/inertial/origin',
                          'robot/link/visual/origin',
                          'robot/link/collision/origin')
URDFParser.install_parser(Geometry, 'robot/link/visual/geometry',
                          'robot/link/collision/geometry')
URDFParser.install_parser(MeshDescriptor, 'robot/link/visual/geometry/mesh',
                          'robot/link/collision/geometry/mesh')
URDFParser.install_parser(Box, 'robot/link/visual/geometry/box',
Пример #3
0
        return self.type in [Joint.PLANAR, Joint.PRISMATIC]

    def scale(self, factor):
        """Scale the joint origin and limit (only if scalable) by a given factor.

        Parameters
        ----------
        factor : :obj:`float`
            Scale factor.

        Returns
        -------
        None
        """
        self.origin.scale(factor)
        if self.is_scalable():
            self.limit.scale(factor)


URDFParser.install_parser(Joint, 'robot/joint')
URDFParser.install_parser(ParentLink, 'robot/joint/parent')
URDFParser.install_parser(ChildLink, 'robot/joint/child')
URDFParser.install_parser(Calibration, 'robot/joint/calibration')
URDFParser.install_parser(Dynamics, 'robot/joint/dynamics')
URDFParser.install_parser(Limit, 'robot/joint/limit')
URDFParser.install_parser(Axis, 'robot/joint/axis')
URDFParser.install_parser(Mimic, 'robot/joint/mimic')
URDFParser.install_parser(SafetyController, 'robot/joint/safety_controller')

URDFParser.install_parser(Origin, 'robot/joint/origin')