How to control adaptive gripper on myCobot 280?

  • Adaptive gripper is one of the practical auxiliary tools that can be installed on myCobot 280. So how can we install and control the adaptive gripper on myCobot 280 correctly? We will show you in this passage about in Python and Roboflow.
    Installing the gripper
    1.Fasten the adaptive gripper to the top of myCobot with LEGO Tech pieces.

    2.Connect the gripper to the end-effector extension interface of M5 Basic.

    1.Controlling the adaptive gripper in Python
    Introduction of API
    1、is_gripper_moving( )
    Function: to determine whether the gripper is running.
    Return value:
    0: means that the gripper is not running.
    1: means that the gripper is running.
    -1: means an error.
    2、set_gripper_value(value, speed)
    Function: to make the gripper rotate to a specified position at a specified speed.
    Description of parameters:
    value: means the position to be reached by the gripper, ranging from 0 to 256.
    speed: means the speed of rotation, ranging from 0 to 100
    Return value: None
    Function: to obtain the data information on the encoder of the gripper.
    Return value: to obtain the data information of the gripper.
    Function: to set the initial position of the gripper. Set the current position to 2048
    return value: None
    5、set_gripper_state(flag, speed)
    Function: to make the gripper enter a specified state at a specified speed. 、
    Description of parameters:
    flag: 1 means that the gripper is closed, 0 means thatthe gripper is open.
    speed: means the speed at which the gripper reaches a specified state, ranging from 0 to 100.
    Return value: None

    Content of the code

    from pymycobot.mycobot import MyCobot        
    from pymycobot import PI_PORT, PI_BAUD  # When using the Raspberry Pi version of mycobot, these two variables can be referenced to initialize MyCobot
    import time
    #Enter the above code to import the packages required by the project
    def gripper_test(mc):
        print("Start check IO part of api\n")
        # Check if the gripper is moving
        flag = mc.is_gripper_moving()
        print("Is gripper moving: {}".format(flag))
        # Set the current position to (2048).
        # Use it when you are sure you need it.
        # Gripper has been initialized for a long time. Generally, there
        # is no need to change the method.
        # mc.set_gripper_ini()
        # Set joint point 1 to rotate to the position of 2048
        mc.set_encoder(1, 2048)
        # Set six joint positions and let the robotic arm rotate to this position at a speed of 20
        mc.set_encoders([1024, 1024, 1024, 1024, 1024, 1024], 20)
        # Get the position information of joint point 1
        # Set the gripper to rotate to the position of 2048
        mc.set_encoder(7, 2048)
        # Set the gripper to rotate to the position of 1300
        mc.set_encoder(7, 1300)
        # Let the gripper reach the state of 2048 at a speed of 70
        mc.set_gripper_value(2048, 70)
        # Let the gripper reach the state of 1500 at a speed of 70
        mc.set_gripper_value(1500, 70)
        # Set the state of the gripper to quickly open the gripper at a speed of 70
        mc.set_gripper_state(0, 70)
        # Set the state of the gripper so that it quickly closes the gripper at a speed of 70
        mc.set_gripper_state(1, 70)
        # Get the value of the gripper
    if __name__ == "__main__":
        # MyCobot class initialization requires two parameters:
        #   The first is the serial port string, such as:
        #       linux:  "/dev/ttyUSB0"
        #          or "/dev/ttyAMA0"
        #       windows: "COM3"
        #   The second is the baud rate:: 
        #       M5 version is:  115200
        #    Example:
        #       mycobot-M5:
        #           linux:
        #              mc = MyCobot("/dev/ttyUSB0", 115200)
        #          or mc = MyCobot("/dev/ttyAMA0", 115200)
        #           windows:
        #              mc = MyCobot("COM3", 115200)
        #       mycobot-raspi:
        #           mc = MyCobot(PI_PORT, PI_BAUD)
        # Initialize a MyCobot object
        # Create object code here for Raspberry Pi version below
        mc = MyCobot(PI_PORT, PI_BAUD)
        # make it move to zero position
        mc.set_encoders([2048, 2048, 2048, 2048, 2048, 2048], 20)

    If the gripper can not be closed normally, and the temperature of gripper increases, it is the parameter error on gripper. What we should do is to adjust the steering gear parameter of adaptive gripper, change the maximum temperature limit from 70 to 80, maximum torque from 1000 to 400.

    2. Controlling the adaptive gripper in Roboflow
    1.Run RoboFlow, click "Empty Program", enter the program editing interface, and select Basic – Gripper Define New Gripper, fill in Gripper Name as " CAG-1 ” (must be this name), and then click Save open or close for Saved status
    The following video:
    How to control gripper through Coboflow

    Also, myCobot 280 can connect with others end effectors like Camera flange, suction pump, mobile phone holder, etc.