xArm-Developer / xarm_ros

ROS packages for robotic products from UFACTORY
https://www.ufactory.cc/
BSD 3-Clause "New" or "Revised" License
196 stars 147 forks source link

Robotiq gripper control #194

Closed nitish3693 closed 10 months ago

nitish3693 commented 11 months ago

Hi @vimior ,

Could you please suggest the steps to control Robotiq hand-e gripper using the ROS.

Could the gripper_move service be used ?

If the Tool Modbus communication method is needed. Could you please suggest what the uint8(unsigned char) data array in the service set_tool_modbus format is ?

How would we send the open and close or a particular position commands using the service set_tool_modbus ?

vimior commented 11 months ago

@nitish3693

  1. You cannot use gripper_move to control robotiq, this can only control xarm_gripper
  2. Control robotiq can refer to the following steps
    • Use the set_tgpio_modbus_baudrate service to set the baud rate to 115200
    • Use getset_tgpio_modbus_data to control robotiq, and the sent data refers to the robotiq protocol, here is an example
    • Reset:
    • send_data: 0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    • respond_len: 6
    • Activate:
    • send_data: 0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
    • respond_len: 6
    • Set_Pos:
    • send_data: 0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x09, 0x00, 0x00, pos, speed(0xFF), force(0xFF)
    • respond_len: 6
    • Close:
    • send_data: 0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x09, 0x00, 0x00, 0xFF, speed(0xFF), force(0xFF)
    • respond_len: 6
    • Open:
    • send_data: 0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x09, 0x00, 0x00, 0x00, speed(0xFF), force(0xFF)
    • respond_len: 6
nitish3693 commented 11 months ago

Hi @vimior thanks for the suggestion, however i was not able to find the service set_tgpio_modbus_baudrate in the active service list when using the xarm. PFB the document containing the list of active services:

servicelist.txt

rosservice call /xarm/config_tool_modbus "baud_rate: 115200
timeout_ms: 20" 
message: "set_modbus_baudrate, ret=0 | set_modbus_timeout, ret=0"
ret: 0

and then tried the activate/reset services which causes the xArm to go into error state C33

rosservice call /xarm/getset_tgpio_modbus_data "{send_data: '0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00', respond_len: 6, host_id: 0, is_transparent_transmission: false, use_503_port: false}" 
ret: 20

Handeee

vimior commented 11 months ago

@nitish3693 Sorry, I forgot there is a host_id parameter, the value should be 9

nitish3693 commented 11 months ago

Thanks @vimior for the suggestion I will test that. Should i use the service config_tool_modubus in place of set_tgpio_modbus_baudrate

vimior commented 11 months ago

@nitish3693 Yes.

nitish3693 commented 11 months ago

Hi @vimior thanks for your suggestion earlier. We conducted a test today with suggested host_id, PFB the service call and responses :


rosservice call /xarm/config_tool_modbus 115200 20
message: "set_modbus_baudrate, ret=0 | set_modbus_timeout, ret=0"
ret: 0

rosservice call /xarm/get_tgpio_modbus_baudrate 
data: 115200
ret: 0

rosservice call /xarm/getset_tgpio_modbus_data "{send_data: '0x09,0x10,0x03,0xE8,ox00,0x03,0x06,0x01,0x00,0x00,0x00,0x00,0x00', respond_len: 6, host_id: 9, is_transparent_transmission: false, use_503_port: false}" 
ret: 0
message: ''
respond_data: [0, 0, 0, 0, 0, 0]

The getset_tgpio_modbus_data service call returned with the value 0 but it caused the,

[ERROR] [1690962446.850880161]: [ns: /xarm/] Controller Error detected! C33: [ Controller GPIO Error ]

Please not we are using the Hand-E gripper connected using the instruction in : http://help.ufactory.cc/en/articles/3997200-guide-to-use-the-robotiq-gripper-on-ufactory-xarm

The settings used in the xArm studio : xArmSetup.docx

We are able to open and close the gripper using the blockly program :

image

vimior commented 11 months ago

@nitish3693 image Is this a typo? We don't have this mechanical claw on hand now, so we can't judge the problem very well, so I hope you can reproduce it again, and then download the log from the studio immediately and provide it to us, so that we can troubleshoot the problem. Studio -> Settings -> System -> Log -> Download

nitish3693 commented 11 months ago

Hi @vimior that was the typo here.

Replicating the issue again :

nitish@nitish:~$ rosservice call /xarm/config_tool_modbus "baud_rate: 115200
timeout_ms: 20" 
message: "set_modbus_baudrate, ret=0 | set_modbus_timeout, ret=0"
ret: 0
nitish@nitish:~$ rosservice call /xarm/get_tgpio_modbus_baudrate 
data: 115200
ret: 0
message: "ret = 0, current baud_rate = 115200"
nitish@nitish:~$ rosservice call /xarm/getset_tgpio_modbus_data "{send_data: '0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00', respond_len: 6, host_id: 9, is_transparent_transmission: false, use_503_port: false}" 
ret: 0
message: ''
respond_data: [0, 0, 0, 0, 0, 0]

Log files are here :

XI130412C23L34_2023-08-03_09-32-55.tar.gz

penglongxiang commented 11 months ago

Hi @nitish3693, please try this command instead: $ rosservice call /xarm/getset_tgpio_modbus_data "{send_data: [0x09, 0x10, 0x03, 0xE8, 0x00, 0x03, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], respond_len: 6, host_id: 9, is_transparent_transmission: false, use_503_port: false}"

Instead of ' ', use [ ] to enclose the data.

nitish3693 commented 11 months ago

Hi @penglongxiang thanks for your suggestion. The services are now working without the errors.

penglongxiang commented 11 months ago

@nitish3693 Glad to know it works, the previous way may interpret the content inside ' ' as ASCII characters but not hex values.

nitish3693 commented 11 months ago

Hi @penglongxiang @vimior could this service getset_tgpio_modbus_data operate at 50Hz command frequency ?

When this service is used at 50 Hz the indicator light in the gripper goes continuous blue showing it is receiving commands but the gripper stops responding to changes in the position of the finger.

Could it be because the service is getting clogged with the requests and then does not function properly ?

vimior commented 11 months ago

@nitish3693 Is the 50HZ command to control the opening and closing of the robotiq? For your use, the getset_tgpio_modbus_data interface forwards the command to the robotiq. The interface itself does not limit the frequency. As for how to execute it, it depends on the logic of the robotiq, but I I think there is a problem if 50HZ has been controlling the opening and closing.

nitish3693 commented 11 months ago

Hi @vimior yeah 50Hz is the frequency we want to use to call the service to send different positions of the gripper.

vimior commented 11 months ago

@nitish3693 With a frequency of 50HZ, robotiq may not have completed the last action. I don’t know the logic of robotiq receiving a new action before completing the previous action.

nitish3693 commented 10 months ago

Thanks @vimior @penglongxiang for the support.

nitish3693 commented 10 months ago

The issue with the control at 50Hz was with the buffering in the commands. Due to the buffer the commands were not updating and old commands were being transmitted to Gripper.

Solved by limiting the buffer size of the command topic.