Open DailyNir opened 3 months ago
Hi Nir,
Does it support standard Modbus RTU protocol? If not, you need to use the data transparent transmission function, set is_transparent_transmission=True.
For example: arm.set_tgpio_modbus_baudrate(115200) arm.set_tgpio_modbus_timeout(500,is_transparent_transmission=True) arm.getset_tgpio_modbus_data(is_transparent_transmission=True)
If there are still problems, please share the SN of your robot to support@ufactory.cc, thank you,
Yes. It does support it.
Please advise how to proceed .
Hi Nir,
Then no need to add CRC, we will add it automatically. How about removing 0x49, 0xE2?
tried this and getting the same: #!/usr/bin/env python3
#
#
""" Example: yinshi gripper Control Please make sure that the gripper is attached to the end. """
import os import sys import time sys.path.append(os.path.join(os.path.dirname(file), '../../..'))
from xarm.wrapper import XArmAPI arm = XArmAPI('172.16.1.221') time.sleep(0.5) if arm.warn_code != 0: arm.clean_warn() if arm.error_code != 0: arm.clean_error()
arm.motion_enable(True) arm.set_mode(0) arm.set_state(0) ret=arm.set_tgpio_modbus_baudrate(115200) print('set modbus baudrate, ret = %d' % (ret)) time.sleep(2)
ret = arm.set_tgpio_modbus_timeout(500,is_transparent_transmission=True)
print('set modbus timeout, ret = %d' % (ret))
def calculatecrc16(data): crc = 0xFFFF for pos in data: crc ^= pos for in range(8): if (crc & 1) != 0: crc >>= 1 crc ^= 0xA001 else: crc >>= 1 return crc & 0xFFFF
def build_modbus_command(slave_addr, function, register_addr, write_data): command = [ 0xFA, slave_addr, function, (register_addr >> 8) & 0xFF, register_addr & 0xFF, (write_data >> 8) & 0xFF, write_data & 0xFF ]
# command.append(crc & 0xFF)
# command.append((crc >> 8) & 0xFF)
return command
slave_addr = 0x01 function = 0x06 register_addr = 0x0080 write_data = 0x0001
data_frame = build_modbus_command(slave_addr, function, register_addr, write_data)
print("Built command: ", data_frame)
ret = arm.getset_tgpio_modbus_data(is_transparent_transmission=True, datas=data_frame) print('set modbus, ret = %d' % (ret[0]))
time.sleep(2) ############################### SDK_VERSION: 1.13.8 ROBOT_IP: 172.16.1.221, VERSION: v2.2.2, PROTOCOL: V1, DETAIL: 6,6,XI1304,AC1303,v2.2.2, TYPE1300: [1, 1] change protocol identifier to 3 ControllerError, code: 19 [motion_enable], xArm is not ready to move [set_state], xArm is ready to move set modbus baudrate, ret = 0 ControllerError had clean set modbus timeout, ret = 0 Built command: [250, 1, 6, 0, 128, 0, 1] set modbus, ret = 0 ControllerError, code: 19
same error here also:import os import sys import time
from xarm.wrapper import XArmAPI arm = XArmAPI('172.16.1.209') time.sleep(0.5) if arm.warn_code != 0: arm.clean_warn() if arm.error_code != 0: arm.clean_error()
arm.motion_enable(True) arm.set_mode(0) arm.set_state(0)
ret = arm.core.set_modbus_timeout(20) print('set modbus timeout, ret = %d' % (ret[0]))
ret = arm.core.set_modbus_baudrate(115200) print('set modbus baudrate, ret = %d' % (ret[0])) time.sleep(2) data_frame = [0x01, 0x06, 0x00, 0x80, 0x00, 0x01] ret = arm.core.tgpio_set_modbus(data_frame, len(data_frame)) print('set modbus, ret = %d' % (ret[0])) time.sleep(2)
Hi
Please provide the SN of your robot to support@ufactory.cc, Do you have xArm Gripper? Can you control it normally?
Please try to send the data via 'Settings-Externals-Modbus RTU', take a screenshot of the result to us. Btw, what will be returned by your gripper if you sending [01 06 00 80 00 01]?
I’ll try, it suppose to return same massage . We don't have xarm gripper . I'll send you the SN when I get back to the office Get Outlook for iOShttps://aka.ms/o0ukef
From: Minna @.> Sent: Monday, August 12, 2024 12:25 PM To: xArm-Developer/xArm-Python-SDK @.> Cc: Nir Levy @.>; Author @.> Subject: Re: [xArm-Developer/xArm-Python-SDK] Error code 19 (Issue #116)
Hi
Please provide the SN of your robot to @.**@.>, Do you have xArm Gripper? Can you control it normally?
Please try to send the data via 'Settings-Externals-Modbus RTU', take a screenshot of the result to us. Btw, what will be returned by your gripper if you sending [01 06 00 80 00 01]? image.png (view on web)https://github.com/user-attachments/assets/14226e01-cee8-4fbb-ac58-46b104d6f838
— Reply to this email directly, view it on GitHubhttps://github.com/xArm-Developer/xArm-Python-SDK/issues/116#issuecomment-2283488962, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BBPEH6765DGMPG6USCRONALZRB5RFAVCNFSM6AAAAABMGK7XT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBTGQ4DQOJWGI. You are receiving this because you authored the thread.Message ID: @.***>
[https://res.public.onecdn.static.microsoft/assets/mail/file-icon/png/photo_16x16.png]Screenshot from 2024-08-12 13-26-42.pnghttps://dailyrobotics-my.sharepoint.com/:i:/p/nir/EdLRojwXTYZKoyrN8YZEmboBLlaGwAoUJBdi9a0r_YkHMQ attached is the error also in the studio . i have set all the modbus RTU enables and baudrate 115200. the SN is: XI130412C23L5C [cid:45425cdf-3867-40a1-a74f-7f0b3539abe5]
From: Minna @.> Sent: Monday, August 12, 2024 12:25 PM To: xArm-Developer/xArm-Python-SDK @.> Cc: Nir Levy @.>; Author @.> Subject: Re: [xArm-Developer/xArm-Python-SDK] Error code 19 (Issue #116)
Hi
Please provide the SN of your robot to @.**@.>, Do you have xArm Gripper? Can you control it normally?
Please try to send the data via 'Settings-Externals-Modbus RTU', take a screenshot of the result to us. Btw, what will be returned by your gripper if you sending [01 06 00 80 00 01]? image.png (view on web)https://github.com/user-attachments/assets/14226e01-cee8-4fbb-ac58-46b104d6f838
— Reply to this email directly, view it on GitHubhttps://github.com/xArm-Developer/xArm-Python-SDK/issues/116#issuecomment-2283488962, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BBPEH6765DGMPG6USCRONALZRB5RFAVCNFSM6AAAAABMGK7XT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBTGQ4DQOJWGI. You are receiving this because you authored the thread.Message ID: @.***>
i am using custom gripper with RS485 communication, right now it is connected to AC control BOX 24V GND L_A L_B , this is my code:
import os import sys import time sys.path.append(os.path.join(os.path.dirname(file), '../../..'))
from xarm.wrapper import XArmAPI arm = XArmAPI('172.16.1.209') time.sleep(0.5) if arm.warn_code != 0: arm.clean_warn() if arm.error_code != 0: arm.clean_error()
arm.motion_enable(True) arm.set_mode(0) arm.set_state(0)
ret = arm.core.set_modbus_timeout(20) print('set modbus timeout, ret = %d' % (ret[0]))
ret = arm.core.set_modbus_baudrate(115200) print('set modbus baudrate, ret = %d' % (ret[0])) time.sleep(2) data_frame = [0x01, 0x06, 0x00, 0x80, 0x00, 0x01, 0x49, 0xE2] ret = arm.core.tgpio_set_modbus(data_frame, len(data_frame)) print('set modbus, ret = %d' % (ret[0])) time.sleep(2)
i am getting: SDK_VERSION: 1.13.8 ROBOT_IP: 172.16.1.209, VERSION: v2.2.2, PROTOCOL: V1, DETAIL: 6,6,XI1304,AC1303,v2.2.2, TYPE1300: [1, 1] change protocol identifier to 3 ControllerError, code: 1 servo_error_code, servo_id=1, status=3, code=0 ControllerError had clean servo_error_code, servo_id=1, status=0, code=0 [motion_enable], xArm is not ready to move [set_state], xArm is ready to move set modbus timeout, ret = 0 set modbus baudrate, ret = 0 set modbus, ret = 0 ControllerError, code: 19
please advise how to integrate correctly