Welcome to myCobot 320 Arm repository
7.Use of adaptive grippers
Use of adaptive grippers
Python API Usage Instructions
End-of-arm gripper control
1 set_gripper_state(flag, speed, _type_1=None)
Function : Let the gripper enter the specified state at a specified speed
parameter :
flag (int): 0 - open, 1 - close, 254 - releasespeed (int): 1 ~ 100_type_1 (int):1: Adaptive gripper (adaptive gripper by default)2: Five-finger dexterity3: Parallel jaws4: Flexible gripper
Return value:
1 - Complete
2 set_gripper_value(gripper_value, speed, gripper_type=None)
Function : Allow the gripper to rotate to a specified position at a specified speed
parameter :
gripper_value (int): 0 ~ 100speed (int): 1 ~ 100gripper_type (int):1: Adaptive gripper (adaptive gripper by default)2: Five-finger dexterity3: Parallel jaws4: Flexible gripper
Return value:
1 - Complete
3 set_gripper_calibration()
Function : Set the current position of the gripper to zero
Return value:
1 - Complete
4 set_gripper_mode(mode)
Function : Set the gripper mode
parameter:
mode: 0 - transparent transmission. 1 - port mode.
Return value:
1 - Complete
5 get_gripper_mode()
Function : Get the gripper mode
Return value:
mode: 0 - transparent transmission. 1 - port mode.
Simple Case
xfrom pymycobot.mycobot320 import MyCobot320import time# MyCobot320 class initialization requires two parameters:# The first is the serial port string, such as:# linux: "/dev/ttyUSB0"# windows: "COM3"# The second is the baud rate:# M5 version: 115200## Example:# mycobot-M5:# linux:# mc = MyCobot320("/dev/ttyUSB0", 115200)# windows:# mc = MyCobot320("COM3", 115200)# Initialize MyCobot320 objectmc = MyCobot320("COM13", 115200)# Move it to zero positionmc.send_angles([0, 0, 0, 0, 0, 0], 40)time.sleep(3)# The professional adaptive gripper needs to be set to transparent transmission mode before usemc.set_gripper_mode(0)time.sleep(1.5)num = 5while num > 0:# Set the gripper state, open the gripper quickly at a speed of 70, parameter 1 represents the professional adaptive gripper typemc.set_gripper_state(0, 70, 1)time.sleep(3)# Set the gripper state, close the gripper quickly at a speed of 70, parameter 1 represents the professional adaptive gripper typemc.set_gripper_state(1, 70, 1)time.sleep(3)num -= 1num = 3while num > 0:# Set the gripper value to 0, the speed to 70, and parameter 1 represents the professional adaptive gripper typemc.set_gripper_value(0, 70, 1)time.sleep(3)# Set the gripper value to 50, the speed to 70, and parameter 1 represents the professional adaptive gripper typemc.set_gripper_value(50, 70, 1)time.sleep(3)# Set the gripper value to 0, the speed to 70, and parameter 1 represents the professional adaptive gripper typemc.set_gripper_value(0, 70, 1)time.sleep(3)num -= 1# Get the gripper valueprint("gripper value:", mc.get_gripper_value())