Esempio n. 1
0
    def pre_procedure(self):
        """Pre fabrication setup, speed, acceleration and initial pose."""
        # for safety
        self.retract_needles()

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

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

        # Initial configuration
        log.debug("Sending move to safe joint position")
        self.send_and_wait(
            MoveToJoints(
                self.set_joint_pos.start,
                self.EXTERNAL_AXES_DUMMY,
                self.speed.travel,
                self.zone.travel,
            ))
def test_speeds():
    with RosClient() as ros:
        client = compas_rrc.AbbClient(ros)
        client.run()

        # Confirm start on flexpendant
        client.send(PrintText("Confirm start by pressing play."))
        client.send(compas_rrc.Stop())

        # The speed and acceleration values are then overriden here
        client.send(compas_rrc.SetMaxSpeed(SPEED_OVERRIDE, SPEED_MAX_TCP))
        client.send(compas_rrc.SetAcceleration(ACCELERATION,
                                               ACCELERATION_RAMP))
        client.send(PrintText(f"Speed override: {SPEED_OVERRIDE} %"))
        client.send(PrintText(f"Max TCP speed: {SPEED_OVERRIDE} mm/s"))
        client.send(PrintText(f"Acceleration: {ACCELERATION} %"))
        client.send(PrintText(f"Acceleration ramp: {ACCELERATION_RAMP} %"))

        client.send(compas_rrc.SetTool(client.pick_place_tool.name))
        client.send(compas_rrc.SetWorkObject("wobj0"))
        client.send(PrintText(f"Tool: {TOOL}"))
        client.send(PrintText(f"wobj: {WOBJ}"))

        if TEST_JOINT_POS:
            for i in range(N_TIMES_REPEAT_LISTS):
                speed = START_SPEED + SPEED_INCREMENTS * i
                client.send(
                    PrintText(f"Speed: {speed} mm/s, Zone: {ZONE} mm.", ))

                client.send(compas_rrc.StartWatch())
                for pos in JOINT_POS:
                    client.send(
                        MoveToJoints(pos, client.EXTERNAL_AXES_DUMMY, speed,
                                     ZONE))

                # Block until finished and print cycle time
                client.send(compas_rrc.StopWatch())
                cycle_time = client.send_and_wait(compas_rrc.ReadWatch(),
                                                  timeout=TIMEOUT)
                client.send(PrintText(f"Cycle took {cycle_time} s."))

        if TEST_FRAMES:
            for i in range(N_TIMES_REPEAT_LISTS):
                speed = START_SPEED + SPEED_INCREMENTS * i
                client.send(
                    PrintText(f"Speed: {speed} mm/s, Zone: {ZONE} mm.", ))

                client.send(compas_rrc.StartWatch())
                for frame in FRAMES:
                    client.send(
                        MoveToFrame(
                            frame,
                            speed,
                            ZONE,
                            motion_type=MOTION_TYPE,
                        ))

                # Block until finished and print cycle time
                client.send(compas_rrc.StopWatch())
                cycle_time = client.send_and_wait(compas_rrc.ReadWatch(),
                                                  timeout=TIMEOUT)
                client.send(PrintText(f"Cycle took {cycle_time} s."))

        client.close()
Esempio n. 3
0
def test_speeds(run_conf, run_data):
    rob_conf = run_conf.robot_client

    # Compose up master, driver, bridge
    compose_up_driver(rob_conf.controller)

    pick_station = run_data["pick_station"]

    # This context manager sets up RosClient, inherits from AbbClient
    # with added fabrication specific methods
    # On exit it unadvertises topics and stops RosClient
    with AbbRcfFabricationClient(rob_conf, pick_station) as client:
        # Sends ping (noop) and restarts container if no response
        client.ensure_connection()

        client.log_and_print("Confirm start by pressing play.")
        # Confirm start on flexpendant
        client.confirm_start()

        # Sends move to start position, retracts needles and sets the defaults
        # speed and acceleration values.
        client.pre_procedure()

        # The speed and acceleration values are then overriden here
        client.send(compas_rrc.SetMaxSpeed(SPEED_OVERRIDE, SPEED_MAX_TCP))
        client.send(compas_rrc.SetAcceleration(ACCELERATION,
                                               ACCELERATION_RAMP))
        client.log_and_print(f"Speed override: {SPEED_OVERRIDE} %")
        client.log_and_print(f"Max TCP speed: {SPEED_OVERRIDE} mm/s")
        client.log_and_print(f"Acceleration: {ACCELERATION} %")
        client.log_and_print(f"Acceleration ramp: {ACCELERATION_RAMP} %")

        if PICK_ELEMENT:
            # Sends instruction to pick up element from first position
            # Subsequent calls picks up from next positions
            client.pick_element()

        client.send(compas_rrc.SetTool(client.pick_place_tool.name))
        client.send(compas_rrc.SetWorkObject("wobj0"))
        client.log_and_print(f"Tool: {TOOL}")
        client.log_and_print(f"wobj: {WOBJ}")

        if TEST_FRAMES:
            for i in range(N_TIMES_REPEAT_LISTS):
                speed = START_SPEED + SPEED_INCREMENTS * i
                client.log_and_print(
                    f"Speed: {speed} mm/s, Zone: {ZONE} mm.", )

                client.send(compas_rrc.StartWatch())
                for frame in FRAMES:
                    client.send(
                        MoveToFrame(
                            frame,
                            speed,
                            ZONE,
                            motion_type=MOTION_TYPE,
                        ))

                # Block until finished and print cycle time
                client.send(compas_rrc.StopWatch())
                cycle_time = client.send_and_wait(compas_rrc.ReadWatch(),
                                                  timeout=TIMEOUT)
                client.log_and_print(f"Cycle took {cycle_time} s.")

        if TEST_JOINT_POS:
            for i in range(N_TIMES_REPEAT_LISTS):
                speed = START_SPEED + SPEED_INCREMENTS * i
                client.log_and_print(
                    f"Speed: {speed} mm/s, Zone: {ZONE} mm.", )

                client.send(compas_rrc.StartWatch())
                for pos in JOINT_POS:
                    client.send(
                        MoveToJoints(pos, client.EXTERNAL_AXES_DUMMY, speed,
                                     ZONE))

                # Block until finished and print cycle time
                client.send(compas_rrc.StopWatch())
                cycle_time = client.send_and_wait(compas_rrc.ReadWatch(),
                                                  timeout=TIMEOUT)
                client.log_and_print(f"Cycle took {cycle_time} s.")