Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending URScript commands for gripper have no effect #77

Closed
ingmar12345 opened this issue Jan 13, 2020 · 22 comments
Closed

Sending URScript commands for gripper have no effect #77

ingmar12345 opened this issue Jan 13, 2020 · 22 comments

Comments

@ingmar12345
Copy link

ingmar12345 commented Jan 13, 2020

Summary

I am trying to control the Robotiq 2f-85 gripper on the UR5 by sending URScript commands.

I am publishing the commands to the /ur_hardware_interface/script_command topic

Example:

rostopic pub -1 /ur_hardware_interface/script_command std_msgs/String "rq_open()"

rq_open() and rq_close() are used to open and close the gripper. The gripper is activated before executing these commands.

The script commands work fine when executing them as separate Script Code nodes on the PolyScope tablet.

Why won't the commands work when publishing them to the /ur_hardware_interface/script_command topic?

The ROS driver is running on both the robot side and PC side.

I am running ROS Kinetic on Ubuntu 16.04 Xenial natively on a laptop PC.

Versions

  • ROS Driver version: 0.0.3
  • Affected Robot Software Version(s): 3.9.1
  • Affected Robot Hardware Version(s): CB3.0 (will upgrade soon to CB3.1)
  • Robot Serial Number: 2015351381
  • UR+ product(s) installed: n/a
  • URCaps Software version(s): Robotiq_grippers 1.2.1, External Control 1.0.1

Impact

The coupling between the UR5 and the Robotiq gripper will be upgraded soon to a (wireless) interface through the wrist socket, which results in that the gripper cannot be controlled through the official Robotiq driver anymore.

Use Case and Setup

The objective is to control the Robotiq 2F-85 gripper without the need of the Robotiq driver but in a simple way. That is why I want to use the URscript commands.

Steps to Reproduce

Make sure the Robotiq 2F-85 Gripper is installed to the UR5 robot, in case of a USB cable, plug it in the controller.

  • Run ur_robot_driver on both the the robot side (external control) and ROS side (pc)
  • Install the robotiq_grippers URcap, make sure the led turns blue on the Robotiq gripper
  • Publish gripper commands (strings) in the following order to the topic called /ur_hardware_interface/script_command
    rq_reset() -> rq_activate() -> rq_open() -> rq_close()

Expected Behavior

I expected the gripper to perform opening and closing operations.

Actual Behavior

The gripper didn't move at all.

Workaround Suggestion

Using the Robotiq driver (http://wiki.ros.org/robotiq), please note that this driver is not compatible with the wireless wrist socket coupling interface for the Robotiq gripper and the UR5.

@fmauch
Copy link
Collaborator

fmauch commented Jan 13, 2020

I don't see a reason, why this should not be working. Just to make sure:

  • You are running a driver version more recent than b223655
  • Are other script commands working?

You could try

rostopic pub /ur_hardware_interface/script_command std_msgs/String "data: 'popup(\"hello\")'"

@ingmar12345
Copy link
Author

Hi,
I tried other script commands and they are working perfectly fine.
It is still strange behaviour that the gripper script commands are not working.

@fmauch
Copy link
Collaborator

fmauch commented Jan 14, 2020

I just realized the following: Probably the gripper URCap generates script in its installation part of program generation. If you don't have a program running (as in a program coming from the TP), then this code doesn't get injected. Probably this code generation creates the functions that you'd like to call.

As soon as you are sending those script commands, any running programs will be stopped and your new script command will be executed as a standalone program. You can try to send the commands as a secondary program. Depending on the actual implementation this could work. Otherwise, you'd have to include the function definitions inside the script that you are sending through the ROS driver. Note, you can extract the generated script code after saving a program on the TP. See here for details.

But as far as I can see, there's nothing wrong with the scripting interface. And I currently do not see an option to change this (if the secondary program does not work). If you agree, please close the issue.

@gavanderhoorn
Copy link
Contributor

@fmauch: would this be something to add to the FAQ? Or perhaps a more extensive doc that explains why things are the way they are and work the way they work?

@fmauch
Copy link
Collaborator

fmauch commented Jan 14, 2020

Yes, that seems reasonable.

@carofel
Copy link

carofel commented Feb 17, 2020

Hi,
I am struggeling with the same issue. I tried to adapt the ros_control.urscript with a secondary programme. Is there an example how to add an additional function and how to handle it with the threads? It is the correct procedure? Hope it didnot miss anything. Thanks in advance.

@fmauch
Copy link
Collaborator

fmauch commented Feb 17, 2020

@carofel Depending on your use-case this might be the correct attempt, but it might as well not be. If you're unfamiliar with URScript, I suggest you start by reading the URScript manual. You can get it from here: https://www.universal-robots.com/download/

However, please let me quickly note that adapting the URScript file to your needs goes beyond the scope of an issue on this driver.

@ingmar12345
Copy link
Author

ingmar12345 commented Feb 17, 2020

Secondary programs may not take any time to execute (https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/secondary-program-17257/)

I’ve tried to pass the function definitions for the gripper as a secondary program to the UR5.
This results in a crash, the fans in the controller stop spinning and I have to do a hard reset.

When trying to pass the external control program as a secondary program it cannot find a connection with the ROS PC.

@Karthik-Ranga
Copy link

I have Robotiq gripper connected to wrist socket. I tried sending the gripper functions through secondary programs but nothing happened. But when I sent the same script file when in remote control mode(through socket), the script executed successfully.

This might be a dumb question. Where to keep/call the script function from? Is there a folder where you need to have script files so the urscript looks for?

when

rostopic pub -1 /ur_hardware_interface/script_command std_msgs/String " "

called
should I call the script file name or the function name within the quotes?

@Karthik-Ranga
Copy link

With use_tool_communication:=false
and sending the script file, I get the below error though.

[ERROR] [1583179698.329217700]: Sending data through socket failed.
[ERROR] [1583179698.329367664]: Could not send program to robot
[ERROR] [1583179698.329474076]: Error sending script to robot

@felixvd
Copy link
Contributor

felixvd commented Mar 10, 2020

We use a Robotiq 2F-85 gripper with a UR5 that is connected to the UR controller (not the wrist connector), which we used to control through UR scripts. I can confirm that those scripts do not work as secondary programs, resulting in a hard crash as reported earlier.

Our workaround (which has been working fine) is to restart the program through the dashboard services.

It would be great if the gripper could be controlled while the robot is moving, but I guess it is not very important for most people.

@Karthik-Ranga
Copy link

We use a Robotiq 2F-85 gripper with a UR5 that is connected to the UR controller (not the wrist connector), which we used to control through UR scripts. I can confirm that those scripts do not work as secondary programs, resulting in a hard crash as reported earlier.

Our workaround (which has been working fine) is to restart the program through the dashboard services.

It would be great if the gripper could be controlled while the robot is moving, but I guess it is not very important for most people.

Did any other scripts worked for you? Like controlling I/O pins or something like that?
In my case, no script works. Sending the script did not crash the robot, but sending through a socket program did result in crash.
I'll try your suggested method on restarting through dashboard services.

@felixvd
Copy link
Contributor

felixvd commented Mar 10, 2020

I haven't tried any other scripts as secondary programs, no. I am not sure what you mean by "sending through a socket program", but I would hope that socket communication and setting I/O would work in a secondary program.

@fmauch
Copy link
Collaborator

fmauch commented Mar 27, 2020

setting I/Os from a secondary program should definitely work.

What you can always do is send arbitrary (working) script code as a primary program and then start the program containing the external control node again using the dashboard client as described by @felixvd above.

If you're not able to execute script code at all, that's something we should take care of. I've lost track of all the different discussions going on here with different problems.

To get back to the original question:

  • We confirmed, that you can indeed send and execute script code to the robot.
  • As far as I can see, the robotiq URCap defines a couple of custom functions such as rq_open() which are being added to each program running on the TP by the respective Installation Node. You will find this script code if you have a look at the generated script code as described here. When you send script code to the robot, this is being executed similar to starting a new shell. The custom functions are not defined here, so the calls don't work.
  • If you want this to work you have to make sure that the function definitions are contained in the script code you send to the robot. Whether it will be possible to execute this as a secondary program or not will depend on the specific script code.

@fmauch
Copy link
Collaborator

fmauch commented Mar 11, 2021

There is one year gone by with this. I'm closing this for now. If anything new arises, feel free to reopen.

@fmauch fmauch closed this as completed Mar 11, 2021
@MilanPadhiyar027
Copy link

Hi, I am facing a similar issue with controlling the Robotiq end-effector using URScript commands through the ROS interface. Do we have any useful workaround or solution now?

@MilanPadhiyar027
Copy link

I have Robotiq gripper connected to wrist socket. I tried sending the gripper functions through secondary programs but nothing happened. But when I sent the same script file when in remote control mode(through socket), the script executed successfully.

This might be a dumb question. Where to keep/call the script function from? Is there a folder where you need to have script files so the urscript looks for?

when

rostopic pub -1 /ur_hardware_interface/script_command std_msgs/String " "

called should I call the script file name or the function name within the quotes?

Hi,
can you please tell how did you send the script in remote control mode?

@fmauch
Copy link
Collaborator

fmauch commented Aug 1, 2022

Hi,
can you please tell how did you send the script in remote control mode?

Regarding remote_control mode, please see https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/blob/master/ur_robot_driver/README.md#remote-control-mode

@Karthik-Ranga
Copy link

I have Robotiq gripper connected to wrist socket. I tried sending the gripper functions through secondary programs but nothing happened. But when I sent the same script file when in remote control mode(through socket), the script executed successfully.
This might be a dumb question. Where to keep/call the script function from? Is there a folder where you need to have script files so the urscript looks for?
when

rostopic pub -1 /ur_hardware_interface/script_command std_msgs/String " "

called should I call the script file name or the function name within the quotes?

Hi, can you please tell how did you send the script in remote control mode?

I have written a blog post on our company website on how to send gripper script commands in remote control mode.
http://axisnj.com/controlling-a-universal-robots-cobot-using-python/

If you have any questions please let me know!

@Yeesha-R
Copy link

@Karthik-Ranga , the link to the blog post does not work. Could you please provide a working link to the blog post? Thanks

@Karthik-Ranga
Copy link

@Karthik-Ranga , the link to the blog post does not work. Could you please provide a working link to the blog post? Thanks

Our company has changed the website. here is the updated link.
https://www.powerflotechnologies.com/single-post/controlling-a-universal-robots-cobot-using-python

@Yeesha-R
Copy link

Yeesha-R commented Apr 2, 2024

@Karthik-Ranga thanks for sharing the link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants