How to control adaptive gripper on myCobot 280?

Adaptive gripper is one of the practical auxiliary tools that can be installed on myCobot 280 :mechanical_arm:. So how can we install and control the adaptive gripper on myCobot 280 correctly :thinking:? We will show you in this passage about in Python and Roboflow :star_struck:.

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

3、get_gripper_value()

  • Function: to obtain the data information on the encoder of the gripper.
  • Return value: to obtain the data information of the gripper.

4、set_gripper_int()

  • 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))

time.sleep(1)

#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)

time.sleep(2)

#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)

time.sleep(3)

#Get the position information of joint point 1

print(mc.get_encoder(1))

#Set the gripper to rotate to the position of 2048

mc.set_encoder(7, 2048)

time.sleep(3)

#Set the gripper to rotate to the position of 1300

mc.set_encoder(7, 1300)

time.sleep(3)

#Let the gripper reach the state of 2048 at a speed of 70

mc.set_gripper_value(2048, 70)

time.sleep(3)

#Let the gripper reach the state of 1500 at a speed of 70

mc.set_gripper_value(1500, 70)

time.sleep(3)

#Set the state of the gripper to quickly open the gripper at a speed of 70

mc.set_gripper_state(0, 70)

time.sleep(3)

#Set the state of the gripper so that it quickly closes the gripper at a speed of 70

mc.set_gripper_state(1, 70)

time.sleep(3)

#Get the value of the gripper

print("")

print(mc.get_gripper_value())

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)

time.sleep(3)

gripper_test(mc)

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
  2. click Define New Gripper, fill in Gripper Name as " CAG-1 ” (must be this name), and then click Save
  3. select open or close for Saved status
    6.6.1_3

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

1 Like

myCobot 320 can also use the gripper with different methods~ :sunglasses:

1 Like

Hi @ElephantRobotics :slight_smile:

What’s the difference between these two?

Thank you.

Hi, they are supported by different steering engines, and the white one can only be used on myCobot 280, the Pro can be used in myCobot320 and Pro600 :grinning_face_with_smiling_eyes: Hope that it can help you~

1 Like

Yes, thank you for that :slight_smile: