Beispiel #1
0
    def load_ur5(self, load_geometry=False, concavity=False):
        """"Load a UR5 robot to PyBullet.

        Parameters
        ----------
        load_geometry : :obj:`bool`, optional
            Indicate whether to load the geometry of the robot or not.
        concavity : :obj:`bool`, optional
            When ``False`` (the default), the mesh will be loaded as its
            convex hull for collision checking purposes.  When ``True``,
            a non-static mesh will be decomposed into convex parts using v-HACD.

        Returns
        -------
        :class:`compas_fab.robots.Robot`
            A robot instance.
        """
        robot_model = RobotModel.ur5(load_geometry)
        robot = Robot(robot_model, client=self)
        robot.attributes['pybullet'] = {}
        if load_geometry:
            self.cache_robot(robot, concavity)
        else:
            robot.attributes['pybullet']['cached_robot'] = robot.model
            robot.attributes['pybullet']['cached_robot_filepath'] = compas.get(
                'ur_description/urdf/ur5.urdf')

        urdf_fp = robot.attributes['pybullet']['cached_robot_filepath']

        self._load_robot_to_pybullet(urdf_fp, robot)

        srdf_filename = compas_fab.get(
            'universal_robot/ur5_moveit_config/config/ur5.srdf')
        self.load_semantics(robot, srdf_filename)

        return robot
Beispiel #2
0
from compas.robots import RobotModel

from compas_fab.backends import RosClient
from compas_fab.robots import Robot

with RosClient() as client:
    model = RobotModel.ur5()
    robot = Robot(model, client=client)

    robot.info()

    assert len(robot.get_configurable_joint_names()) == 6