Discussion

Left ArrowBack to discussions page
faizerdfaizerd Posts: 2 Recruit
edited June 2017 in Integration
Hello,

We have a robot UR10 with a 2 finger gripper connected to the Robot controller through one of the USB port. We can manage to control the robot using the modern driver and ROS on another network computer. The gripper works using the teach pendant but we want to use ROS also to control the gripper and are unsure how to do this, as all the tutorials for using the gripper with ROS that we have found are for controlling it directly attached to a computer or network, not through a UR arm. Any idea where to start with this?

Thanks,
Faiz

Comments

  • David_LevasseurDavid_Levasseur Posts: 97Beta Tester Beetle Handy
    To my knowledge, you can't do that with the ROS package as it is. You can only control the gripper if it is connected directly to the computer.
  • carlosjosergcarlosjoserg Posts: 37Tactile Sensor Beta Testers Handy
    Hi @faizerd, by "modern driver" you mean this one: https://github.com/ThomasTimm/ur_modern_driver   right?

    There might be a way that you can try using the gripper connected to the teach pendant that don't use the robotiq ROS packages, but you'd still need the Robotiq URCaps. I've never tried this, but I think it might be feasible.

    That driver subscribes to a topic called "ur_driver/URScript", where you can publish any script that you want and it'll execute on the robot side, including gripper commands by using the robotiq URcaps functions.

    So what I would do, is to write in Polyscope the program you'd want to do. And then access the robot files and check the program you just made and see how the actual script is. That script you can send it via the topic mentioned above and it'll do exactly the same. You will see commands like these 
    rq_set_pos_norm(pos_norm)
    rq_set_speed_norm(speed_norm)
    rq_set_force_norm(force_norm)
    
    Where all arguments goes from 0-1, for instance, or whatever other commands you use in your program.

    It's very likely that you'd need to send also the Robotiq preamble that you will find in the URCaps files here, where all Robotiq functions are defined, and you might need to call "rq_init_connection(gripper_sid=9)" to init the gripper everytime...

    Now that I'm writing it, it seems a bit of overwork with the only advantage that you don't have an USB until the PC. If that is not a strict constraint, I'd strongly suggest to integrate in the PC using ROS, given that you need it anyway for the UR.



  • tianxiangtianxiang Posts: 6 Apprentice

    It's very likely that you'd need to send also the Robotiq preamble that you will find in the URCaps files here, where all Robotiq functions are defined, and you might need to call "rq_init_connection(gripper_sid=9)" to init the gripper everytime...


    @carlosjoserg, I am reading your post on controlling the gripper that is connected to the UR controller from a remote computer. I checked the .script file from a gripper open/close program, if I understand your idea correct, we need to send the preamble functions like the one below named "rq_set_pos"?

    def rq_set_pos(pos, gripper_socket="1"):
        rq_set_var(GTO,0, gripper_socket)
        rq_set_var(POS, pos, gripper_socket)
        gPRE = rq_get_var(PRE, 3, gripper_socket)
        pre = (gPRE[1] - 48)*100 + (gPRE[2] -48)*10 + gPRE[3] - 48
        sync()
        while (pre != pos):
              rq_set_var(POS, pos, gripper_socket)
              gPRE = rq_get_var(PRE, 3, gripper_socket)
              pre = (gPRE[1] - 48)*100 + (gPRE[2] -48)*10 + gPRE[3] - 48
              sync()
       end
    end

    There is a while loop here keep checking if pre==pos, do you think we can send this function and while loop line by line to the ur_driver/URScript node? B
  • tianxiangtianxiang Posts: 6 Apprentice
    I haven't been able to use the ROS topic ur_driver/URScript to control the gripper.

    I inserted the following functions into the UR teach pad, they work and the gripper can be activated and then close as I expected.
    • socket_set_var(“ACT”, 0, “1”)   # Deactivate gripper 1
    • sleep(0.5)     # Wait for 0.5 sec to write the registration “ACT”
    • socket_set_var(“ATR”, 0, “1”)   # Set the gripper as normal
    • sleep(0.5)     # Wait for 0.5 sec to write the registration “ATR”
    • socket_set_var(“ACT”, 1, “1”)  # Activate the gripper
    • sleep(3.0)     # Wait for 3 sec because the gripper will move in activation
    • socket_set_var(“GTO”, 0, “1”)  # Stop, don’t move
    • sleep(0.5)     # Wait for 0.5 sec to write the registration “GTO”
    • socket_set_var(“POS”, 255, “1”) # Set the gripper position (0 is fully open, 255 is fully close)
    • sleep(0.5)    # Wait for 0.5 sec to write the registration “POS”
    • socket_set_var(“GTO”, 1, “1”)    # Move according to the POS setting
    • sleep(5.0)    # Wait for 5 sec for the gripper to move
    • socket_set_var(“GTO”, 0, “1”)   # Reset, don’t move when it is activated again next time
    • sleep(0.5)   # Wait for 0.5 sec to write the registration “GTO”
    • socket_set_var(“POS”, 0, “1”)   # Reset to fully open position
    • sleep(0.5)   # Wait for 0.5 sec to write the registration “POS”
    Then I tried to follow @carlosjoserg idea of publishing these to the ur_driver/URScript topic. The gripper does not do anything.

    I tried to publish a "power off" to the topic, and it works, the power is turned off, so that topic is good.

    I checked the log on the teach pad, whenever I send the "socket..." message, there is a "Program socket_set_var started", immediately followed by a "Program socket_set_var stopped". So I guess it is the timing issue? In order for it to work, it should not stop so quickly?

    I am fairly new to ROS, so I could be doing something totally wrong, if anyone has any idea, please let me know.

    Thanks.

    Tianxiang
  • carlosjosergcarlosjoserg Posts: 37Tactile Sensor Beta Testers Handy
    Posting here so people can follow up the answer on github: https://github.com/ThomasTimm/ur_modern_driver/issues/162
  • tianxiangtianxiang Posts: 6 Apprentice
    Just an update. I now can remotely open and close the gripper, but it is by directly communicating from the PC to the UR5 though the robot IP, and from the PC to the gripper though the socket.

    The commands I sent are:

    socket_close("gripper_socket")
    socket_open("127.0.0.1",63352,"gripper_socket")
    set_analog_inputrange(0,0)
    set_analog_inputrange(1,0)
    set_analog_inputrange(2,0)
    set_analog_inputrange(3,0)
    set_analog_outputdomain(0,0)
    set_analog_outputdomain(1,0)
    set_tool_voltage(0)
    set_runstate_outputs([])
    set_payload(0.85)
    socket_set_var("SPE",255,"gripper_socket")
    sync()
    socket_set_var("FOR",50,"gripper_socket")
    sync()
    socket_set_var("ACT",1,"gripper_socket")
    sync()
    socket_set_var("GTO",1,"gripper_socket")
    sync()
    sleep(0.1)
    socket_set_var("POS",0,"gripper_socket")
    sync()
    sleep(2.0)

    For using the ur_driver/URScript ROS topic, I still couldn't make it work so far. It will be awesome if some experts here could try to let me know how that works.

    Thanks everyone.

    Tianxiang
  • akashpakashp Posts: 2 Recruit
    Hello , Its possible to control Robotiq Gripper through ROS package using this package https://github.com/ros-industrial/robotiq and look into this issue https://github.com/ros-industrial/robotiq/issues/14 which tells modification needed to work with gripper action server.This package hasnt be modified since long but still with modification works for C-model grippers.It works good for me.
Sign In or Register to comment.
Left ArrowBack to discussions page