I am having difficulty getting the controller to register a Modbus baud of 115200 for the gripper. It has been working but now keeps giving me an error. Sometimes it tells me that the baud rate is 32512 which is not in any of the parameters.
Code run:
#!/usr/bin/env python3
Software License Agreement (BSD License)
Copyright (c) 2020, UFACTORY, Inc.
All rights reserved.
Author: Vinman vinman.wen@ufactory.cc vinman.cub@gmail.com
“”"
Example: Control the bio gripper through the modbus of the end tool
“”"
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(file), ‘…/…/…’))
from xarm.wrapper import XArmAPI
from configparser import ConfigParser
parser = ConfigParser()
parser.read(‘…/robot.conf’)
try:
ip = parser.get(‘xArm’, ‘ip’)
except:
ip = input(‘Please input the xArm ip address[10.1.10.199]:’)
if not ip:
ip = ‘10.1.10.199’
arm = XArmAPI(ip)
time.sleep(0.5)
arm.clean_warn()
arm.clean_error()
arm.motion_enable(True)
arm.set_mode(0)
arm.set_state(0)
set tool gpio modbus baudrate
code = arm.set_tgpio_modbus_baudrate(115200)
print(‘set_tgpio_modbus_baudrate, code={}’.format(code))
time.sleep(2)
get tool gpio modbus baudrate
code = arm.get_tgpio_modbus_baudrate()
print(‘get_tgpio_modbus_baudrate, code={}’.format(code))
time.sleep(2)
arm.motion_enable(False)
Output
“C:\Users\My Indoor Farm\PycharmProjects\pythonTK\venv\Scripts\python.exe” “C:/Python Files/xArm-Python-SDK/example/wrapper/common/ResetArm.py”
is_old_protocol: False
version_number: 1.6.5
send(17): 00 02 00 02 00 01 11
recv(17): 00 02 00 02 00 02 11 00
send(16): 00 03 00 02 00 01 10
recv(16): 00 03 00 02 00 02 10 50
send(13): 00 04 00 02 00 01 0d
recv(13): 00 04 00 02 00 03 0d 50 04
[clean_error], xArm is not ready to move
[SDK][ERROR][2021-01-05 20:59:15][base.py:268] - - API → clean_error → code=1
send(11): 00 05 00 02 00 03 0b 08 01
ControllerError, code: 19
recv(11): 00 05 00 02 00 02 0b 50
send(13): 00 06 00 02 00 01 0d
recv(13): 00 06 00 02 00 03 0d 50 04
[motion_enable], xArm is not ready to move
send(19): 00 07 00 02 00 02 13 00
recv(19): 00 07 00 02 00 02 13 50
send(12): 00 08 00 02 00 02 0c 00
recv(12): 00 08 00 02 00 02 0c 00
send(13): 00 09 00 02 00 01 0d
recv(13): 00 09 00 02 00 03 0d 00 00
[set_state], xArm is ready to move
send(128): 00 0a 00 02 00 04 80 09 0a 0b
ControllerError had clean
recv(128): 00 0a 00 02 00 06 80 50 00 00 7f 00
send(15): 00 0b 00 02 00 01 0f
recv(15): 00 0b 00 02 00 04 0f 50 13 00
[SDK][ERROR][2021-01-05 20:59:16][base.py:268] - - API → set_tgpio_modbus_baudrate → code=22
set_tgpio_modbus_baudrate, code=22
send(128): 00 0c 00 02 00 04 80 09 0a 0b
recv(128): 00 0c 00 02 00 06 80 50 00 00 7f 00
get_tgpio_modbus_baudrate, code=(1, -1)
send(11): 00 0d 00 02 00 03 0b 08 00
recv(11): 00 0d 00 02 00 02 0b 50
send(13): 00 0e 00 02 00 01 0d
recv(13): 00 0e 00 02 00 03 0d 50 04
Process finished with exit code 0