示例#1
0
def pre_procedure(client):
    """Pre fabrication setup, speed, acceleration, tool, work object and initial pose.

    Uses ``fab_conf`` set up using
    :func:`compas_rcf.fab_data.interactive_conf_setup` for fabrication settings.

    Parameters
    ----------
    client : :class:`compas_rrc.AbbClient`
        Client connected to controller procedure should be sent to.
    """
    grip_and_release(
        client,
        fab_conf["tool"]["io_needles_pin"].get(),
        fab_conf["tool"]["release_state"].get(),
        wait_before=fab_conf["tool"]["wait_before_io"].get(),
        wait_after=fab_conf["tool"]["wait_after_io"].get(),
    )

    client.send(SetTool(fab_conf["tool"]["tool_name"].as_str()))
    log.debug("Tool {} set.".format(fab_conf["tool"]["tool_name"].get()))
    client.send(SetWorkObject(fab_conf["wobjs"]["placing_wobj_name"].as_str()))
    log.debug("Work object {} set.".format(
        fab_conf["wobjs"]["placing_wobj_name"].get()))

    # Set Acceleration
    client.send(
        SetAcceleration(
            fab_conf["speed_values"]["accel"].as_number(),
            fab_conf["speed_values"]["accel_ramp"].as_number(),
        ))
    log.debug("Acceleration values set.")

    # Set Max Speed
    client.send(
        SetMaxSpeed(
            fab_conf["speed_values"]["speed_override"].as_number(),
            fab_conf["speed_values"]["speed_max_tcp"].as_number(),
        ))
    log.debug("Speed set.")

    # Initial configuration
    client.send(
        MoveToJoints(
            fab_conf["safe_joint_positions"]["start"].get(),
            EXTERNAL_AXIS_DUMMY,
            fab_conf["movement"]["speed_travel"].as_number(),
            fab_conf["movement"]["zone_travel"].get(ZoneDataTemplate()),
        ))
    log.debug("Sent move to safe joint position")
示例#2
0
    def pre_procedure(self):
        """Pre fabrication setup, speed, acceleration, tool, work object and initial pose.

        Uses ``fab_conf`` set up using
        :func:`compas_rcf.fab_data.interactive_conf_setup` for fabrication settings.

        Parameters
        ----------
        client : :class:`compas_rrc.AbbClient`
            Client connected to controller procedure should be sent to.
        """
        # for safety
        self.retract_needles()

        self.send(SetTool(self.pick_place_tool.name))
        log.debug("Tool {} set.".format(self.pick_place_tool.name))
        self.send(SetWorkObject(self.wobjs.place))
        log.debug("Work object {} set.".format(self.wobjs.place))

        # Set Acceleration
        self.send(
            SetAcceleration(self.global_speed_accel.accel,
                            self.global_speed_accel.accel_ramp))
        log.debug("Acceleration values set.")

        # Set Max Speed
        self.send(
            SetMaxSpeed(
                self.global_speed_accel.speed_override,
                self.global_speed_accel.speed_max_tcp,
            ))
        log.debug("Speed set.")

        # Initial configuration
        self.send(
            MoveToJoints(
                self.set_joint_pos.start,
                self.EXTERNAL_AXIS_DUMMY,
                self.speed.travel,
                self.zone.travel,
            ))
        log.debug("Sent move to safe joint position")
示例#3
0
    def pick_bullet(self, cylinder):
        """Send movement and IO instructions to pick up a clay cylinder.

        Uses `fab_conf` set up with command line arguments and configuration
        file.

        Parameters
        ----------
        client : :class:`compas_rrc.AbbClient`
        picking_frame : :class:`compas.geometry.Frame`
            Target frame to pick up cylinder
        """
        # change work object before picking
        self.send(SetTool(self.pick_place_tool.name))
        self.send(SetWorkObject(self.wobjs.pick))

        # start watch
        self.send(StartWatch())

        self.send(
            MoveToFrame(cylinder.get_egress_frame(), self.speed.travel,
                        self.zone.travel))

        self.send(
            MoveToFrame(
                cylinder.get_uncompressed_top_frame(),
                self.speed.travel,
                self.zone.precise,
            ))

        self.send(WaitTime(self.pick_place_tool.needles_pause))
        self.extend_needles()
        self.send(WaitTime(self.pick_place_tool.needles_pause))

        self.send(
            MoveToFrame(cylinder.get_egress_frame(), self.speed.precise,
                        self.zone.precise))

        self.send(StopWatch())

        return self.send(ReadWatch())
示例#4
0
def std_move_to_frame(
    frame,
    tool="tool0",
    wobj="wobj0",
    motion_type=Motion.LINEAR,
    speed=200,
    accel=100,
    zone=Zone.FINE,
    timeout=None,
):
    """Move robot arm to target or targets.

    Parameters
    ----------
    frame : :class:`compas.geometry.Frame` or :obj:`list` of :class:`compas.geometry.Frame`
        Target frame or frames.
    tool : :obj:`str`
        Name of tool as named in RAPID code on controller to use for TCP data.
    wobj : :obj:`str`
        Name of work object as named in RAPID code on controller to use for
        coordinate system.
    motion_type : :class:`compas_rrc.Motion`
        Motion type, either linear (:class:`~compas_rrc.Motion.LINEAR`) or
        joint (:class:`~compas_rrc.Motion.JOINT`).
    speed : :obj:`float`
        TCP speed in mm/s. Limited by hard coded max speed in this function as
        well as safety systems on controller.
    accel : :obj:`float`
        Acceleration in percentage of standard acceleration.
    zone : :class:`compas_rrc.Zone`
        Set zone value of movement, (acceptable deviation from target).
    timeout : :obj:`float`
        Time to wait for indication of finished movement. If not defined no
        feedback will be requested.
    """  # noqa: E501
    if not isinstance(frame, Sequence):
        frames = [frame]
    else:
        frames = frame

    with RosClient() as ros:
        # Create ABB Client
        abb = AbbClient(ros)
        abb.run(timeout=5)

        abb.send(SetTool(tool))
        abb.send(SetWorkObject(wobj))

        # Set acceleration data
        ramp = 100  # % Higher values makes the acceleration ramp longer
        abb.send(SetAcceleration(accel, ramp))

        # Set speed override and max speed
        speed_override = 100  # %
        max_tcp_speed = 500  # mm/s
        abb.send(SetMaxSpeed(speed_override, max_tcp_speed))

        # Move to Frame
        for f in frames:
            abb.send(
                PrintText(" Moving to {:.3f}, {:.3f}, {:.3f}.".format(
                    *f.point.data)))
            abb.send(MoveToFrame(f, speed, zone, motion_type))

        if timeout:
            abb.send_and_wait(Noop(), timeout=timeout)
示例#5
0
    def place_bullet(self, cylinder):
        """Send movement and IO instructions to place a clay cylinder.

        Uses `fab_conf` set up with command line arguments and configuration
        file.

        Parameters
        ----------
        client : :class:`compas_rrc.AbbClient`
            Client connected to controller procedure should be sent to.
        cylinder : :class:`compas_rcf.fab_data.ClayBullet`
            cylinder to place.

        Returns
        -------
        :class:`compas_rrc.FutureResult`
            Object which blocks while waiting for feedback from robot. Calling result on
            this object will return the time the procedure took.
        """
        log.debug("Location frame: {}".format(cylinder.location))

        # change work object before placing
        self.send(SetWorkObject(self.wobjs.place))

        # move there with distance sensor TCP active
        self.send(SetTool(self.dist_sensor_tool.name))

        # start watch
        self.send(StartWatch())

        # Safe pos then vertical offset
        for frame in cylinder.trajectory_to:
            self.send(MoveToFrame(frame, self.speed.travel, self.zone.travel))

        self.send(
            MoveToFrame(cylinder.get_egress_frame(), self.speed.travel,
                        self.zone.travel))

        if self.dist_sensor_tool.get("port") is not None:
            dist_diff = self.measure_z_diff(cylinder)

            if self.max_z_diff and self.is_dist_diff_ok(dist_diff):
                self.correct_location(cylinder, dist_diff)
            else:
                raise Exception("Unacceptable distance difference.")

        self.send_and_wait(WaitTime(2, feedback_level=FeedbackLevel.NONE))

        self.send_and_wait(WaitTime(2))

        self.send(SetTool(self.pick_place_tool))

        self.send(
            MoveToFrame(
                cylinder.get_uncompressed_top_frame(),
                self.speed.precise,
                self.zone.precise,
            ))

        self.send(WaitTime(self.pick_place_tool.needles_pause))
        self.retract_needles()
        self.send(WaitTime(self.pick_place_tool.needles_pause))

        self.send(
            MoveToFrame(
                cylinder.get_compressed_top_frame(),
                self.speed.precise,
                self.zone.precise,
            ))

        self.send(
            MoveToFrame(cylinder.get_egress_frame(), self.speed.travel,
                        self.zone.travel))

        # offset placement frame then safety frame
        for frame in cylinder.trajectory_from:
            self.send(MoveToFrame(frame, self.speed.travel, self.zone.travel))

        self.send(StopWatch())

        return self.send(ReadWatch())