Programming

Also checkout the new CB3 forum

Programming hints and tips for Universal-Robots. Select a topic from the drop down menu.

Disclaimer: While the Zacobria Pte. Ltd. believes that information and guidance provided is correct, parties must rely upon their skill and judgement when making use of them. Zacobria Pte. Ltd. assumes no liability for loss or damage caused by error or omission, whether such an error or omission is the result of negligence or any other cause. Where reference is made to legislation it is not to be considered as legal advice. Any and all such liability is disclaimed.

If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.

Author:
By Zacobria Lars Skovsgaard
Accredited Universal Robots support Centre and Forum.

Also check out the CB3 forum



107 thoughts on “Programming

  1. Ludo

    Hi
    Is it possible to retrieve an information when an emergency stop is activated?
    I would like to retrieve this information in order to restart the program with a confirmation button
    I found a way to do it with the external emergency stops but not with that of the ur10 controller…

    Thanks

    Reply
    1. zacopressadmin Post author

      Hi Ludo

      Thanks for your question.

      For safety reasons a local emergency stop should also be locally reset and acknowledged – otherwise the purpose of an emergency stop is diluted.

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum



      Reply
  2. Ludo0

    Hello ! Sorry for my bad English i’m French… I hope you will understand me…
    I try to add a Force function in my program for more security because the robot go to a more “dangerous” place at this moment (pinch and more).
    It looks like:

    MoveA
    Home
    1st_point
    var_plan_GP≔Line_GP_var
    offset_GP≔p[0,y_GP,0,0,0,0]
    Line_GP_var≔pose_trans(var_plan_GP,offset_GP)
    MoveL
    1st_point
    2nd_point
    if force () < 60
    3rd_point
    else
    2nd_point
    Pop-up

    Thread_1
    var_1:= force ()
    wait: 0.01

    But I have a problem…
    When I use this function, the robot go to the 1st and the 2nd point, and the Pop-up comes instantly instead to continue to the 3rd point.
    When I watch the force in real time with the Tread_1, the force value is between 30 and 50N.
    The TCP, the weight of the tool and the gravity point are ok (I think), they were calculated via a 3D CAD software (CATIA V6).
    I don't know what to do more… I hope you have an idea for me…

    Thank you.
    Ludovic.

    Reply
    1. zacopressadmin Post author

      Hello Ludovic

      Thanks for the question

      It would be good to know if the force momentaraly is high e.g. when reaching 2nd_point.

      maybe consider to log the force similar to this below. Notice the line before “Home” and the extra lines in the Thread. And then monitor the variable “max_force”.

      MoveA
      max_force:=0
      Home
      1st_point
      var_plan_GP≔Line_GP_var
      offset_GP≔p[0,y_GP,0,0,0,0]
      Line_GP_var≔pose_trans(var_plan_GP,offset_GP)
      MoveL
      1st_point
      2nd_point
      if force () < 60
      3rd_point
      else
      2nd_point
      Pop-up

      Thread_1
      var_1:= force ()
      if var_1 > max_force
      max_force := var_1
      wait: 0.01

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum



      Reply
  3. dan

    Hey there,

    Having an issue blending out of a circle move. I have no problem blending into a circle move but I can not seem to figure out how to get the same amount of blend out of the arc. So it’s nice and smooth going in and jerks coming out as I am changing the direction by 90 degrees.

    Any ideas would be appreciated. Thank you in advance.

    Reply
    1. zacopressadmin Post author

      Hey Dan

      Thanks for the question.

      90 degrees is a substantial change of direction so that might need a bigger blend radius. And also the speed will have an influence of the smoothness of the move – if the speed is high and the blend radius is low and turning is 90 degree might need a lower speed.

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum



      Reply
  4. Claudiu.A

    Hello,

    We are trying to program an UR10 robot for picking up parts from a box, checking their orientation, regripping and then loading a machine with them.
    I’m checking the orientation of the part by rotating it around its own axis in front of two lasers, starting from a predetermined position.
    I want to save that offset on RZ and reuse it for other waypoints, rotating them just around the Z axis of the gripper – it is not the same axis as the tool flange -. Any way I can get this done?

    Best regards,
    Claudiu

    Reply
    1. zacopressadmin Post author

      Hello Claudiu

      Thanks for the question.

      It is possible to work with each cartisian element (e.g. Rz or Z) as a variable.

      And then reinsert the variable back to the list in the position of Rz or Z containing the position.

      Some example can be found at this link.

      http://www.zacobria.com/universal-robots-knowledge-base-tech-support-forum-hints-tips/knowledge-base/position-variables-1/

      The command “pose_trans” can be used if the reference should be the TCP point.

      The command “pose_add” can be used if the reference should be the base of the robot.

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum



      Reply
  5. mona

    Hello,

    Presently I am writing a program for speech recognition. I want to interface that program to UR 5 robotic arm via microcontroller. To write a program in the microcontroller I am not understanding about the digital input ports of UR5 robot (8 digital inputs are meant for what?)

    Reply
    1. zacopressadmin Post author

      Hello Mona

      Thanks for the question.

      Digital inputs are inputs that can sense a signal state that only can have two values which are 1 or 0 (also called True or False – and also called High or Low).

      Digital inputs are typical used to connect sensors such as photo sensors or proxmity sensors which output only have two values either High or Low and in this case for UR the high is a 24 Volt signal and low is 0 volt. Digital inputs are typical used for example to detect if an item is in place – like if a photo sensor is flagged or not flagged then the output state of the sensor change and that information can be detected by a digital input and then the infrmation can be used in the robot program to take action based on a desired state.

      Different from the digital inputs are the Analogue inputs. Analogue inputs can sense a range of values such as 0 to 24 volt or 4mA to 20mA where the vaues also can be in between. Analogue inputs are for example used to sense a temperature or a force where there can be many values in between the lowest value and highest value.

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum

      Reply
      1. Mona

        As you known UR 5 is an industrial robotic arm and it is already programmed. In my case, I am writing a program in micro controller for speech recognition (so movement of robotic arm is done by speech). I don’t know the behavior of each digital input pin of UR5. Without knowing this information I can’t write the program.
        My question is, how to know the behavior of each pin (example: relative move to the left, right, forth or back) ?

        Reply
        1. zacopressadmin Post author

          Hello Mona

          I am not sure when you write “it is already programmed” what that refers to in this case ?, but by default the UR robot do nothing when a signal is applied to a Digital input if there is no user program made in the robot.

          From your messages it sounds like maybe there is a user program loaded – so If there is a user program loaded in the robot – maybe a person has written a program – then it is necessary to analyse what that program does. Maybe you can list the program you refer to ?

          Author:
          By Zacobria Lars Skovsgaard
          Accredited Universal Robots support Centre and Forum.

          Also check out the CB3 forum

          Reply
  6. Mary

    Lars,
    I am having an issue that I don’t know if it is a programming problem or if there is something more going on. I am loading a part onto a chuck, running a program and then unloading. I will adjust the waypoints so that the robot loads exactly on to the chuck and is in the right place to pick up and everything. If I stop the program and move the robot at all, all of the waypoints get thrown off slightly (maybe each waypoint is half an inch to the left of where it should be). Do you know what could be causing these problems?
    Thanks!
    Mary

    Reply
      1. Mary

        Lars,
        Yes, I don’t move the robot at all and the waypoints still get thrown off. I have a TCP set.

        Here’s the program:
        Program
        Robot Program
        MoveJ
        Waypoint_14
        Waypoint_1
        Gripper Close
        Waypoint_2
        Waypoint_3
        Waypoint_4
        Waypoint_17
        MoveL
        drop
        Gripper Open
        Waypoint_5
        Waypoint_18
        ‘Waypoint_6′
        ‘Waypoint_7′
        ‘Waypoint_8′
        Wait: 5.0
        ‘Waypoint_9′
        Waypoint_19
        ‘Waypoint_15′
        Waypoint_16
        Gripper Close
        MoveL
        Waypoint_10
        Waypoint_11
        Waypoint_12
        Waypoint_13
        Gripper Open
        Halt

        Reply
  7. Ron Klein

    We are using a UR10 that does a lot of pallet destacking and stacking. The pallets coming in do not always have the same amount of pieces on them. I can manually go into the program each time and change the variable for the subroutine to start in the correct position. However I need this to be user friendly. Is there a way I can have a popup display that I can enter my value into and pass to the program at startup as soon as the run program button is pushed.

    Reply
    1. zacopressadmin Post author

      Hi Ron

      Thanks for your question.

      Yes there is a way to make a variable as an “operator” input.

      When making the program it is possible insert a variable with the “Assignment” under Advanced tab. And when defining the variable under the “Command” tab it provides an option to make the variable source as “Operator” (located at top right corner in the “Command” screen) – and a user text to be displayed on the screen can also be entered for example – “Enter amount”.

      This will create a Popup messages when the program is executed and the operator are prompted with a popup messages that provide an opportunity to enter data. And the data entered by the operator will enter into the variable.

      Then this variable can be used in the program for further action – for example as the variable for a subroutine.

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum

      Reply
      1. Ron Klein

        Thanks for the information. I was able to get our program working by using some screens with operator input where I manipulate the cnt_1 variable and the cnt_2 to tell where the stacks and pallet start and stop. I also use it when I get partial piles coming in or what a partial pallet going out.

        Reply
  8. Thomas

    Hello,

    We have a project with an UR at the moment and I´m very impressed of your joystick application.
    We want to use something different, but we also want to control the robot along the tool axis with a small button. the problem we have is, that the robot moves a bit longer than we push the button.
    So my question: Which function do you use or how do you thop it that precisely?

    regards from austria,
    Thomas

    Reply
      1. Thomas Lankmair

        Hi,

        Thanks for the last reply.
        We do exactly this, so we are on the right way.

        You have to input a time when using speedl. How do you solve this?
        We still have the Problem that it moves for example 1 second longer after we send stop.

        Regards,
        thomas

        Reply
        1. zacopressadmin Post author

          Hi,

          Yes and thats why a stopl is send to overwrite the speedl and thereby stop. You might consider to send the stopl command through port 30002.

          Regards
          Zacobria

          Reply
          1. Thomas Lankmair

            Hi,

            So you send the speedl and stopl on different ports, right?

            Regards,
            thomas

          2. zacopressadmin Post author

            Hi Thomas

            The Joystick solution is a product we sell.

            Regards
            Zacobria

  9. Lars Dolleris

    Hi Lars,

    Is it possible to monitor a DI, during the program ?
    E.g.:
    Run the first part of the program and if DI1 becomes high, then set DO1 high and stop robot. Run a another section of the program without monitoring DI1 and the final part with monitoring DI1 again.

    regards,
    Lars Dolleris

    Reply
    1. zacopressadmin Post author

      Hi Lars

      Thanks for your question.

      Depending what you intend to have the program there might be many different ways to construct your program to achieve this.

      On way is to have the first part of the program in a loop that keeps running until the DI is True.
      The when the DI1 becomes True then set DO1 to High (True) and maybe do some more intermediate things.

      After the intermediate things is done then in this case the program can loop back to the top and monitor DI1 again which was you intention.

      You can also have another loop again below the intermediate part. Or you can also have the monitoring part of DI1 in a Thread and then set variables based on the status of DI1 and then use these variables in the main program. A thread will run parallel to the main program

      Program
      Loop DI1 = False
      Do some stuff…

      DO1 = True
      Stopj(5.0)
      Do some other stuff…


      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Support Forum.

      Reply
  10. Kevin Hess

    Hi Zacopressadmin,

    I am running into an issue with programming my UR5 robot. I am using a loop command inside an if statement to pattern a relative move which is relative to the position the robot stopped when a prox switch is triggered. The issue is that there are 120 relative moves and by the end there is a huge amount of error in the position due to the accuracy of the movements. The second way I thought about performing this action was with exact positioning, but I don’t know how to store the position where the robot stops when the prox is triggered as a variable and then add/subtract from the x and y positions. Any help would be much appreciated!

    Kind Regards,
    Kevin Hess

    Reply
    1. zacopressadmin Post author

      Hi Kevin

      Thanks for your question.

      You can use variable Waypoints and then you can change their Pose values. The p indicate it is a pose and the Pose is defined as p[X, Y, Z, Rx, Ry, Rz]

      var_1≔get_actual_tcp_pose()
      var_2≔p[0.0,0.0,0.05,0.0,0.0,0.0]

      var_3≔pose_trans(var_1,var_2)

      MoveL
      var_3

      Var_1 is a variable and will get the actual position of the robot.
      Var_2 is a variable and is set to a value – in this case the Z value is 50.
      Var_3 is a Waypoint that has been created as a variable waypoint and the pose of Variable 3 is now transformed from the actual position with the variable 2.

      Then the MoveL and var_3 underneath moves the robot 50 mm in Z direction.

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
  11. Roshidi

    Hi Zacopressadmin,
    I have 4 inputs (4 foot switches) that required to activate 4 processes. I want the UR5 to attend the process base on FIFO basis by just 1 press from each switch. Please assist.

    Reply
    1. zacopressadmin Post author

      Hi Roshidi

      Thanks for your questions.

      It might be different ways to program this depending on how and when the activation is likely to happen and if there should be any priority involved.

      You might consider using Thread or Event that monitor the Inputs and then set variables for activation and priority when each input is activated and then use the variables to check on in the main program instead of the inputs.

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
  12. James

    Hi, when using an offline program to create a route for an UR10, is it possible for the UR10 to move along the path using the Circular Move function or it’s only possible to move using MoveP? The offline program is creating the path based on a CAD/CAM file of a shoe with very sharp turn at the top of the shoe. Using MoveP (with the OLP) I always get protective stop warning just as the robot is about making the sharp turn. However, Circular Move works fine when I use the pendant to create the route for UR10 manually. Not sure if UR allows OLP to make use of its Circular Move. Thank you.

    Reply
    1. zacopressadmin Post author

      Hi

      Thanks for your email.

      What does OLP stand for ?

      You should be able to make the same move with script commands as the moves from a polyscope GUI program.

      If you already have a running program in the polyscope GUI then it can be a help to look in the script file that automatically has been created.

      Like is shown in this example.

      http://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/movep-process-move-circular-move/

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
      1. James

        Thank you, we will try to run it first based on the concept you provided and come back. OLP is offline programming.

        Reply
  13. guyz

    Does UR can be programmed to control another UR arm? I want to be able to move an arm by moving another arm so it will mimic the end effector position. I would like to control it as master/slave with force feedback, like teleoperation with force feedback.

    Reply
      1. guyz

        Thank you for your answer.
        Unfortunately “maybe” is not enough.
        i have to be sure before im buying to robots :)

        Reply
  14. Jack

    Hi Zacopressadmin,

    Thanks for your reply.
    I found this instruction manual for installing URSim in windows.
    http://ur-update.dk/URsupport/Software/URSim/Virtual_machines/HowToRunURsimInWindowsOperatingSystem.pdf

    In the very beginning of the instruction it is mentioned:
    “URsim will only run in a Linux operating system.”

    They provide a virtual machine that has the URSim in it in order to use in Windows.
    When you said there is a windows version, do you mean using virtual machine? or actually there a windows version available? If so, I appreciate if you can send me a link.

    Thanks,
    Mohsen

    Reply
  15. Jack

    Hi Zacopressadmin,

    Thank you. It is god to know UR simulator, but it seems it is just for Linus and not Windows. Please correct me if I am wrong.

    Thanks,
    Mohsen

    Reply
  16. Jack

    Hi Zacopressadmin,

    Thanks for your comment.
    Apparently, it does offline programming for Universal robot arms, but I am not sure if it can be used as a virtual controller so that the computer thinks that there is an actual robot controller connected to it . Do you have any comment on this?

    What I am trying to do is to model my robotic scene in the software and use a master device like a joystick to communicate with the virtual controller through ModBus or … and actually manipulate the robot in the model using the joystick. This I could do using ABB robot by help of RobotStudio, and I’d like to do the same for my new project with Universal robots.

    Thanks,
    Jack

    Reply
  17. Jack

    Is there any software with virtual controller for Universal Robots (similar to RobotStudio for ABB robots) for modeling the robotic scene and testing the robot program before developing the setup?

    Thanks,
    Jack

    Reply
  18. b0x4it

    Hello,

    I am wondering how smooth/fast it is possible to control a UR10 using a master device e.g. joystick/mouse in a master-slave fashion?

    I tried this with ABB robots, but because of lack of low-level access, there was a considerable delay between hand and TCP movements which produced jaggy and delayed movements.

    How is the movements of Universal robots in such master-slave scenario is comparable to robot arms like DLR MIRO and da Vinci robot arms? :

    Reply
    1. zacopressadmin Post author

      Hello B

      Thanks for your question.

      Smooth and Fast is a balancing act that is contradicting – not because of the robot, but because of physics like speed-mass-momentum-inertia-accleration-deccleration etc…

      You can see some examples on UR robot motion with joystick we made here

      https://www.youtube.com/watch?v=7dcB62vsTwg

      Here the setting is slow to mid speed.

      But the speed could be set much faster – up to the speed capacity of the robot like 1 m/Sec – but then the smoothness will be affected – escecially when changing direction.

      I do not know the other robots you mention, but the UR can make pretty nice moves as you can see – even better at slower speed.

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
      1. Jack

        Hello Zacopressadmin,

        Thanks for your reply and the video.
        In this setup, the delay between hand and robot movements is significantly low. Is it possible to produce such low-latency master-slave movements with Universal robots?

        Thank you,
        Jack

        Reply
        1. zacopressadmin Post author

          Hi Jack

          I have seen similar response time on the UR – try and let us know the result.

          Author:
          By Zacobria Lars Skovsgaard
          Authorised Universal-Robots Distributor.

          Reply
  19. Matthias

    Dear admin,

    I’m sorry, I just realized that I put my question below the wrong tab.

    could you please give me a hint on how to control a machine traffic light by the robot?
    I’ve got to deal with two different conditions:
    – Robot is in a safe state so that a person can enter the Robot working space (Emercency Stop, Safety Stop)
    – Robot is working as intended and it is not safe for a person to enter the working space
    If I use a thread to control the traffic light by a digital output, does the thread-program also stop when there is an interruption of the main program (for example due to a safety stop because of a collision)?
    Unfortunately I can not make use of the Robot moving digital output since I have to wait for a digital input signal at some point of the main program and this may cause a misunderstanding.
    I really hope you can help me.
    Thanks in advance!

    Matthias

    Reply
    1. zacopressadmin Post author

      Hi Matthias

      Thanks for your question.

      I am not sure how your light should work – but if it is related to safety then it is better to use the build in function because normally safety functions should not be programmed – because a programmer can make error and the thread might also stop – and then the light might not function as intended.

      There are also inputs for safety purposes – and safety functions should properly have priority over other programming functions.

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
  20. Matthias

    Dear zacopressadmin,

    I’ve got a rather complicated problem and I really hope you can help me out in this.

    I’m integrating a UR5 (CB3) into an existing packaging system. The UR5 is positioned after a filling machine. The robot takes the filled parts out of the machine, handles them and puts them into packaging trays.
    Now, if there is a fault in the machine that takes more than about five minutes, the robot shall move into a monitored position. This shall be implemented in view of the fact that in Germany the robotarm is not seen as category 3 system according to ISO 13849 (the CB3 is a category 3 system). In the secured/monitored position the robotarm is monitored by a sensor (NO switch or NC switch). Sensor and robot control system together form a category 3 system to protect against an unexpected start of the robot arm. If the robotarm makes an unintended movement the control system shall initialize a safeguard stop/emerceny stop. When the fault of the machine is cleared the operating person reactivates the robotarm (by acuating a button) and the robot continues in automative operating.
    I really don’t know how to write the code or how to connect the plugs to the control terminals so that the control system initializes a safety stop when the signal of the sensor is low since the signal is low normally in automatic mode. And on the other hand how shall I “break free” from the secured position?
    I brooded about that little problem all day but i really got nowhere.

    Have you ever had a similar case of application and can you give me some hints?

    Thanks in advance!

    Regards

    Matthias

    Reply
    1. zacopressadmin Post author

      Hi Matthias

      Thanks for your question.

      The robot has inputs that can be wired to trigger safety stops. The manual gives a good example on how to implement an external safety stop detector – and also how to implement an external reset button for such safety stop. Also example of additional emergency stop is provided if you an emergency stop to be issued.

      From your description it looks like that you know when the robot will move into the monitored position i.e. when there is a fault on the filling/packing machine – so maybe You can consider that when when/if this fault happen – then make the move into monitored position a safe move – and then by wire trigger a safety stop that only can be reset with an external reset button. Or if you want to make the safety stop before the robot move into monitored stop – then you need to wire so the safety stop is triggered when (timing) you want the safety stop to happen – if that’s after 5 minutes then you maybe need a safety PLC to run that timer. It depends on your site conditions and local regulations which I don’t know – so this is just general ideas you can consider.

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
  21. Stijn

    Hello,

    I want to change the orientation (if posible) the position of the base coordiates.
    Is this possible or is there a workaround so i don’t have to change all coordinates in my script file?

    Regards,
    Stijn

    Reply
    1. zacopressadmin Post author

      Hi Stijn

      Thanks for your question.

      I think you need to prepare your program for changing the cordinate references.

      Try and check out this example using the Features and see if that can help

      http://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/features-screen/#comment-119092

      http://www.zacobria.com/temp/universal-robots-zacobria-feature-line-1.jpg

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Distributor.

      Reply
      1. Stijn

        Thanks for your reply!

        I now understand how to do it on the Teach pendant.

        But is this also possible if i have a schript file with predefined positions? Will the new reference also apply on a scrip file which is inside the program?

        Regards,

        Stijn

        Reply
        1. zacopressadmin Post author

          Hi Stijn

          Thanks for your question.

          It depends a little how you have made your script program, but I would think you can do it by applying some mathematics as part of your waypoints in the script program.

          Try and look at the script command

          pose_trans(p_from, p_from_to)

          Then you can maybe consider to design you program that a part of your waypoint coordinates is a variable – and when you change the variable then the origin change.

          Regards
          Zacobria

          Reply
          1. Stijn

            Hello,

            Thanks! I didn’t know the script code could read variables inside move-functions so that problem is solved.

            One question though:

            We want the tool to constantly stay perpendicular to a path that its following. We already have some ideas to calculate the rotations at any given point.

            Are there standard procedures to get the correct rotation angles? (Rx,Ry,Rz)

            Regards,

            Stijn

          2. zacopressadmin Post author

            Hi Stijn

            Thanks for your question.

            There is a script command d2r(d) which makes a simple math calculation from degree to radians but that in itself will not make a perpendicular move.

            You might take a look at the Force function and the Motion mode. That one can make moves perpendicular to the TCP Y axis – applying some force though.

            Author:
            By Zacobria Lars Skovsgaard
            Authorised Universal-Robots Distributor.

          3. Stijn

            The pose_trans function seems to do his job perfectly now!
            Also we can now stay perpendiculair with the help of some pre-calculations for the script.

            The only thing that bothers me is that the Z-axis of the tool is upside down, is there a way to change this?

            Thanks for your help so far!

            Greetings,

            Stijn

          4. Stijn

            Yes I have made a New plane, but because the tool’s Z-axis is upside down I all Z-values of my generated script have to be negative, and it will at some point cause problems, because other people are going to work with it.

            Therefore I want to change the tool’s axis-orientation

            Greetings,

            Stijn Lohuis

          5. zacopressadmin Post author

            Hi Stijn

            When you give a positive Z value – which direction do you want the robot to go in seen from the tool head ?

            Regards
            Lars

          6. Stijn

            I want to have the z-axis positive towards let’s say the ceiling. In normal configuration, the robot toolhead will then turn upside down (because the z-axis of the tool is positive outwards from the tool flange.

            But I dont want the tool to be facing the ceiling when Rz rotation is set to zero, but towards the ground. I have made that possible, but know the z-axis of the new plane is facing the ground.

            So in order make possible what I would like, the z-axis of the toolhead needs to be adjusted by 180 deg.

            Long story short: Is it possible to change the toolpoint orientation?

            Hope my explanation was clear!

            Greetings,
            Stijn

          7. zacopressadmin Post author

            Hi Stijn

            Thanks for your question.

            I just tested.

            When I give a positive Z value in the pose command – the robot moves towards the ceiling – and the tool head is pointing downwards.

            speedl([0.0,0.0,0.5,0.0,0.0,0.0],1.2,0.5)

            Author:
            By Zacobria Lars Skovsgaard
            Authorised Universal-Robots Distributor.

          8. Stijn

            Hello,

            I see that your’re using speedl, the thing is that we must use the movep command (because of set of points as script).

            I guess if it doesn’t work I have to work with the negative Z values.

            Thanks for your help!

            Stijn.

  22. Brendan

    Hi Lars

    I’ve been doing it on the GUI, and using the simple single line Script tool, since I haven’t worked out a way to select an array AND add the array element specifier [X] using the Assignment tool.

    Brendan

    Reply
    1. zacopressadmin Post author

      Hi Brendan

      I just tested and it works if you just use an = sign for both case. I can assing an element from the array to a variable and I can assing that variable to another element in the same array – and it changes.

      Regards
      Lars

      Reply
  23. Brendan

    Hi Again,

    I think one of my basic problems is the syntax when assigning a value to one element of an array. I can read one element OK. Test:=Array[2]
    But, Array[2]:= Test doesn’t work.

    How should this be handled?

    Thanks
    Brendan

    Reply
    1. zacopressadmin Post author

      Hi Brendan

      Are you writing the program in the UR GUI programming – or are you writing a UR script program for this example ?

      Regards
      Lars

      Reply
  24. Brendan

    Hi Lars,

    I think I found it, but I don’t understand why the fault does not occur immediately. If I suppress the lines which re-calculate TempPose2 and Meas_Top_2, then the problem does not occur. (I commented both, but I expect only one is the problem.) Is it likely to be caused by one of these poses not being declared already?

    TempPose[2]≟Temp_Height+Thick_2
    Meas_Top_2≔TempPose

    Please tell me something basic, what is the difference between ≟ and ≔ ??

    Thanks V much.

    Brendan

    Reply
    1. zacopressadmin Post author

      Hi Brendan

      I normally use ≟ when it is an If statement – like it indicates a check and compare which is a kind on question, but I am not sure if that the main intention.

      Regards
      Lars

      Reply
  25. Brendan

    Hello Lars,

    Thanks for coming back so fast.

    Here is a section of the program from the text file. It doesn’t seem to matter where I put the call tio the subroutine, the result is always the same. As I said, the subroutine seems to work OK when it was as an independent program.

    What it is doing is finding the top of a stack of plates, and then calculating how many plates there are in the stack. That part of it works fine. This text has the 10 sec wait at the end, and the failure doesn’t occur until that 10 secs is done.

    Thanks

    Program
    BeforeStart
    Call SubP_Initialise
    Call SubP_Socket
    Call Comms

    Robot Program
    MoveJ
    Park
    Call Dip_Stacks
    MoveJ
    Park
    Loop
    ‘This is the main program loop’
    While not RobRun or not digital_in[7] and not PauseCycle
    ‘waiting for go conditions’

    Dip_Stacks
    ‘Check height of magazine after door close’
    Status≔42
    MoveJ
    Park_1
    ‘Find and store top of stack 2′
    If Plate_2_Enable
    Status≔52
    MoveL
    Feed_2_Clear
    Set Sol1_On=On
    BailOut≔ False
    While not Vac1_Made and not BailOut
    ‘Look for Vac 1 made’
    Wait: 0.01
    Status≔15
    If Tool_Limit>4
    BailOut≔ True
    Wait: 0.01
    NewMess≔ True
    Wait: 0.2
    MoveL
    Feed_2_Bot
    If not Vac1_Made and BailOut
    ‘Plate not found’
    Status≔130
    Wait: 0.01
    Else
    TempPose≔get_actual_tcp_pose()
    TempBot≔Feed_2_Bot
    Wait: 0.01
    Temp_Height≔TempPose[2]
    TempStack≔(TempPose[2]-TempBot[2])/Thick_1
    Set Sol1_On=Off
    TempPose[2]≟Temp_Height+Thick_2
    Meas_Top_2≔TempPose
    MoveL
    Feed_2_Clear
    Wait: 0.01
    MoveJ
    Park
    Wait: 10.0
    Wait: 0.01

    Reply
  26. Brendan Fogarty

    Hello Lars and all,
    Sorry, I think I posted this in the wrong place first time.

    I am having a problem with a subroutine. The UR controller shuts down when the end of the sub routine is reached. It is not a command within the subroutine which causes this. I added a 10 sec wait at the end to test, and the shutdown occurs after the 10 seconds. I have also run the content of the subroutine as a separate program, and it works fine.

    The error message on the pendant is “Robot has changed mode from OK to No Controller”

    This has all been programmed on the pendant, so the structure should be correct.
    What should I be looking for?

    Thanks

    Brendan

    Reply
    1. zacopressadmin Post author

      Hi Brendan

      Thanks for your question.

      I need to see the code that is running on the UR and then I can test it.

      What should the program return to after finish the Subroutine ?

      Regards
      Zacobria

      Reply
      1. Kevin

        Hi,

        I have a change mode issue too,
        When the robot starts a pop-up comes: “Robot mode changed from->NO CONTROLLER to->ROBOT SHUTDOWN”

        And when i want to start my program an other pop-up comes: ” Robot mode changed from->OK to->BEING INATIALISATION”

        I don’t know what is the cause, i tried with an other simple program and there is no problem. I think that it comes from my program but i don’t know where it is.

        Thank you for your answer.

        Reply
        1. zacopressadmin Post author

          Hi Kevin

          Thanks for your question.

          It is a good initiative you have made by testing with other programs to verify that the robot is good.

          It might be caused by a deadlock of the program – or the processor too busy for example if there are many “If” statements which are heavy on a processor – or if there are many “Threads” – or if there is something in a “Thread” that is tacking up too much time and thereby not leaving any time for the robot normal main program and functions.

          Maybe also show your program so more information is available.

          Author:
          By Zacobria Lars Skovsgaard
          Accredited Universal Robots support Centre and Forum.

          Also check out the CB3 forum

          Reply
          1. Kevin

            I used an older program to resolve my problem, but this is happening again. When the robot pass from a subroutine to another, it switch the mode from OK to Initialisation.

            Here is my program:

            DéplacementA
            ang_repos1
            pt_traj_cote
            Pt_traj_table
            Appeler sp_prisep_equer
            Appeler sp_reglage_pt_e

            sp_prisep_equer
            prise piece equerre
            pt_equerre_rel≔pose_add(Pt_equerre,p[-p_longueur/2,p_largeur/2,p_hauteur+.02,0,0,0])
            pt_equerre_bas≔pose_add(pt_equerre_rel,p[0,0,-.03,0,0,0])
            p_equ_deg≔pose_add(pt_equerre_rel,p[0,0,0.05,0,0,0])
            DéplacementA
            Pt_traj_table
            ‘p_equ_deg’
            pt_equerre_rel
            Si force()<50
            DéplacementL
            pt_equerre_bas
            Régler aspiration=On
            Attendre: 1.5
            p_equ_deg≔pose_add(pt_equerre_rel,p[0,0,0.05,0,0,0])
            DéplacementA
            p_equ_deg
            Pt_traj_table
            pt_traj_cote
            Pt_traj_machine

            sp_reglage_pt_e
            Régler etau1=On
            Pt_traj_machine_var≔Pt_traj_machine
            pt_etau1_var≔pose_add(pt_etau1,p[-p_largeur/2,p_longueur/2,var_pronf_m,0,0,0])
            pt_et1_app≔pose_add(pt_etau1_var,[0,0,.05,0,0,0])
            DéplacementA
            Pt_traj_machine
            pt_et1_app
            pt_etau1
            Pop-up
            Stop

          2. Kevin

            Yes it happened at the same position at the same time.

            I found what was my problem, i did an addition of position but i forgot a letter in my subroutine “sp_reglage_pt_e”.

            Thank you.

  27. jaejunLee

    Hello.
    I really appreciate to this homepage, zacobria!
    It was really helpful when I started UR5.
    Thank you very much.

    Now I want to ask two things.

    1. We have to make UR5 collaborate with human. So we cannot generate trajectory when programming.
    And the trajectory will change frequently. Thus the distances between adjacent waypoints are small.
    We tried two methods.
    A. We sent move commands directly through Socket(30002 Port).
    We send move function periodically, and there was no checks about completion of movement.
    movej and movep showed different behaviors.
    If new motion command has arrived while moving to last waypoint,
    “movej” stops and start accelerating again. This behavior make robot vibrate.
    But “movep” doesn’t stop. So the movement is much much more smoother than movej.
    But we suffer from the security stop of ZERO RADIUS.
    “movep” showed better motion but in slow motion and when the way point changes sharply,
    It vibrates or stops.
    I think URScript is high-level control interface and it doesn’t suffice for this case.
    Would you tell us your opinion?

    2. Do you have any idea about C-API that can access directly to Low-level Robot Controller?
    In URScript Document, and many papers mention that the C-API exists.
    But I couldn’t find anything about it.
    If you have any idea about it, would you help us?

    Best Regards
    JaeJun

    Reply
    1. jaejunLee

      I’m sorry I forgot to write B in first question.

      B. Second method was the client-server example.
      The difference with one in Zacobria is we didn’t send position, but delta position.
      And in script, there are 2 threads, one is in charge of receiving dx data from HOST PC.
      another thread calls move function like movep, movej…
      But once move function started, the move function never returns until robot reach goal position.
      So the robot cannot response to new goal position until it reach at previous goal position.
      Is there any way to disable this blocking behavior of move function?

      Reply
      1. zacopressadmin Post author

        Hi JaeJun

        Can you try to use another programming method than Thread or maybe only one Thread ?

        Because Threads runs in parallel i.e. virtually at the same time – and it looks like more things happen at the same time that you do not wish.

        Regards
        Zacobria

        Reply
    2. zacopressadmin Post author

      Hi JaeJun

      Thanks for your question.

      1. It sounds like you wish to achieve some very specific path of motion. Maybe consider to move just one joint at a time in a direction you wish – maybe try SpeedJ or SpeedL and StopJ or StopL commands mentioned in the script manual.

      2. I know C-API is possible, but I have no experience in using that. I think you can find information’s about that on the ROS community.

      Regards
      Zacobria

      Reply
  28. Mirco

    Hello Lars,

    thanks for your help.

    I using the Build-in Force function because I my idea was that I have more control that the Waypoint_up is reached.

    I’ve done some force measurements and compared internal measurement of the robot with a force sensor. Here you have gathered experience, how big can be a short overswing?

    Regards
    Mirco

    Reply
  29. Mirco

    Hello
    your example for the force as an object was helpful.

    I need some more information to understand, how it works correctly. At the Waypoint_Start must the Tool already under Force (Force >0)? In my program is at the Waypoint_Start nearly 0 Force. Is it the reason that the Tool isn’t move exactly on the path?
    Because I see that the Tool is turning (Rx). In my case it isn’t a big problem because between the waypoints are only a few millimetre.

    BR
    Mirco

    Reply
    1. zacopressadmin Post author

      Hi Mirco

      Thanks for your question.

      Are you using the build-in Force function – or the mathematic expression method ?

      If you are using the build-in Force function then my experience is like you say – i.e. it is best to have the force applied already at the waypoint so the robot is guided in the correct direction – i.e. like touch and then press something into position.

      Regards
      Lars

      Reply
  30. Hillebrand

    Hello,
    i have some Problems with the force function.
    Im trying to use this function to assembling a cover by defined force fitting.
    I drive over the element and use the force function in type point and base functionality. I define the z axis with force and 5mm/s. Here is the problem that the tool is not moving exactly in Z, the moving comes only from the shoulder and the tool is turning only in RY.
    So, I tried the force function in type point and tool functionality. This is totally not working, because the robot accelerate different axis and stops. Like an singularity failure.
    What´s wrong? Have some more detailed information’s for the force function?

    BR

    Reply
    1. zacopressadmin Post author

      Hi Claudia

      Thanks for your question.

      1.
      If you use the Force object in the GUI then then you need a physical edge or device to guide the robot because the robot is seeking outside the path to find some resistance as force.

      2.
      Or you might consider using the force function as an equation – then the robot will stay on the path.

      See this example.

      http://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/force-feedback-function/

      Regards
      Zacobria

      Reply
  31. James

    Hi, I have a very elementary question

    How do you get the computer to communicate with the UR5 robot?

    I have an ethernet cable connecting the computer and robot, and I’ve currently setup the UR5′s Network as Static Address with the IP address as 192.168.0.9 and Subnet mask as 255.255.255.0. Everything else is left as 0.0.0.0. I’ve also checked that the subnet mask for my computer is the same as the robot.

    I have tried pinging the robot from my computer, (both in windows and ubuntu), but for either cases, the robot just isn’t pinging back.

    Also, with running the python code, would running it straight from python suffice? or would I need to publish it?

    Regards.

    Reply
    1. zacopressadmin Post author

      Hi James

      Thanks for your question.

      Your setup on the robot looks ok.

      Are you connecting to the Ethernet through a hub or switch so the robot and PC is connected to the same access point ?

      It is correct that the subnet can be the same – but the PC IP address itself should also be within the same subnet i.e. properly something like 192.168.0.xx and of cause different as the robots IP address :)

      Regards
      Lars

      Reply
      1. James

        Thanks for the quick reply.

        Im not quite sure what you mean by hub and switch.

        The robot is connected to the computer directly via Ethernet cable. Also from what I can tell, there is only 1 Ethernet port for the UR5 and 1 Ethernet port for my computer, unless I’m missing something.

        I apologies for not being very concise; this is my very first time interfacing a computer with a robot.

        Regards.

        Reply
        1. zacopressadmin Post author

          Hi James

          OK I see – then you might need to use a crossed Ethernet cable.

          It is better to use a simple access point.

          Regards
          Zacobria
          Universal-Robot distributor

          Reply
  32. Julio Ortega

    Thank you kindly for your help. Now, I am wondering about how to save variables from the last program run. it would be great if you can tell me more about this?

    thank you again,

    Julio Ortega

    Reply
    1. zacopressadmin Post author

      Hi Julio

      When you make a robot program – then point at “Robot Program” you can select “Set Initial Variable Values”.

      Then a new line is inserted on top of your program called “Init Variables” – click on that – and then you can set you variables to a desired value – e.g. Var_1 = 0 – and then you can tick “Keep value from previous run”.

      Then the variable will beset to 0 the first time – and then afterwards contain the value it had from previous program run.

      Regards
      Lars

      Reply
  33. Julio Ortega

    I’m using the UR10 + a 3 finger gripper to transfer multiple parts from a box to a conveyor. Lets say that while the program is executing the robot crashes into a part making the “SECURITY STOPPED” window come up and of course the robot to stops. After clicking “OK” on the “SECURITY STOPPED” window and trying to “PLAY” the program again; the “AUTOMOVE” tab opens forcing me to move the robot to the start position of the program and not just any safe position away from the crash point. I do not want to start my program again from the beginning I just want to move the robot to a safe position and restart my program at the last line executed before crashing.
    Is there any way I can do this?

    I hope I’m a little more clear this time.

    Thank you,

    Julio Ortega

    Reply
    1. zacopressadmin Post author

      Dear Julio

      Yes if you control the movement from an external device by sending the coordinates as script commands to the robot then you can achieve something like this.

      You have acknowledged the safety stop for safety reason and then you can send coordinates from the external host that is the same position as your home position. Then have some logic in your program so you know where you have reached in the path and then continue to send your coordinates from there.

      You still need to “Play” the program, but since it is already in the home position it will begin.

      You can also save variables from last program run in order to continue from where you left.

      Regards
      Lars

      Reply
  34. Julio Ortega

    Is it possible to restart a script program exactly before a crashing point (security stopped) so it continues executing the program without going to the AutoMove Tab?

    Reply
    1. zacopressadmin Post author

      Hi Julio

      Thanks for your question.

      I am not sure if I understand your question correct, but the program execution should not restart when there will be a safety stop.

      Maybe I need a little more information for what is the intention.

      Regards
      Lars

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>