Open david-sperling-Genesis opened 2 years ago
Hi, @david-sperling-Genesis You can update the code to the latest, and then try this service (set_tgpio_modbus_timeout/getset_tgpio_modbus_data) to see if it can meet your needs.
# set timeout
rosservice call /xarm/set_tgpio_modbus_timeout 20 true
# transparent transmission modbus data
rosservice call /xarm/getset_tgpio_modbus_data [0x01,0x03,0x00,0x00,0x00,0x01] 5 9 true false
Hi, @david-sperling-Genesis
rosservice call /xarm/getset_tgpio_modbus_data send_data
recv_len
host_id
transparent transmission or not
use port 503 or not
If you specify the use of transparent transmission, you need to add CRC by yourself (if necessary)
I am trying to add a custom EOAT to the xArm7 that communicates over the built-in RS485 A+B wires. I would like to use the
/xarm/set_tool_modbus
service to send new position commands to an arduino (code at bottom) with a RS485 hat. The setup is as follows: I am struggling with the convention for the data packet. For the sake of the issue, I have simplified the use to remove the servo.Based on the Modbus wikipedia page and verified on an online parser, if I want to read the first register, I should send a message of the following form:
slave address, function code, starting address (16-bit), quantity (16-bit), CRC (16-bit)
example:01 03 00 00 00 01 84 0a
(hex)I can send this message to the arduino using a USB to RS485 adapter and QModbus and I receive the appropriate response:
01 03 02 00 64 b9 af
(hex)When I transition to the xArm service and try to send the same command (removing CRC), I receive the following response:
I also receive error C19 [ End Module Communication Error ]
I also tried sending the same command (with CRC) and got the same error and
respond_data: [14, 0, 16, 19, 127]
.Since it works with QModBus and the USB adapter, I think my arduino code works. Now I am just confused as to how I use the
/xarm/set_tool_modbus
service to send the same command. I am also interested in function 0x10 (Write Multiple Holding Registers), but I wanted to simplify the question to a single function.How can I use the
/xarm/set_tool_modbus
to replace my QModBus+Adapter solution?Arduino Code: