【CSEN014】CS Robot end & DH gripper modbus_rtu communication

1. Assume the currently used DH gripper communication rates are as follows, then set the value in tool I/O of CS robot as follows.




2. Can use following code to control gripper open or close or customize. When you use the code, can plug in script in pendant, GripperOpen() or something like that



This is dh_init.script script
# Author:chenliao#elitbot.cn
# Sept.29, 2022
IO_MODE = 0x0402
# set IO mode address is 0x0402
INIT = 0x0100
# set initial mode address is 0x0100
TARGET_WIDTH = 0x0103
# set the range of gripper open or close address is 0x0103
# DH set gripper open or close size is 0-1000%

tool_serial_config(True, 115200, 0, 1,8,True)
# set end communication parameter, the parameter settings refer to the current DH gripper communication data
# enabled:the enabled state of the tool serial communication, boolean type data;
# baud_rate:serial port baud rate,integer type data: 9600,19200,38400,57600,115200,1000000,2000000;
# parity:Parity bits, integer type data:0(none),1(odd),2(even);
# stop_bits:stop bits, integer type data:1,2;
# size:The bit width of the serial port. When not specified, the default parameter 8 is used, and if modbus-rtu is enabled, this parameter is automatically set to 8;
# modbus_rtu:whether modbus-rtu mode is enabled, when not specified, the default parameter False is used, boolean type data.

tool_modbus_write_registers(1, IO_MODE, 0)
# turn off gripper IO mode
tool_modbus_write_registers(1, INIT, 1)
# initialize gripper
sleep(1)
# wait 1s to complete initialization

def GripperOpen():
tool_modbus_write_registers(1, TARGET_WIDTH, 1000)
# define GripperOpen function

def GripperClose():
tool_modbus_write_registers(1, TARGET_WIDTH, 0)
# define GripperClose function

def GripperSet(num):
tool_modbus_write_registers(1, TARGET_WIDTH, num)
#Define a custom open GripperSet function
点击显示全文
赞同0
发表评论
分享

手机扫码分享
0
549
收藏
举报
收起
登录
  • 密码登录
  • 验证码登录
还没有账号,立即注册
还没有账号,立即注册
注册
已有账号,立即登录
选择发帖板块
上传文件
举报
请选择举报理由
举报
举报说明