Home Programming

Discussion

Left ArrowBack to discussions page
sebastianreasebastianrea Posts: 8 Apprentice
edited February 18 in Programming
Hi community :) 
I have made a program for my UR-10 where the operator can enter different values, respectively 44, 46, 48 and 50. This input changes a distance the robot travles in the program. If the operator enters a different values, for an example 40, the robot will not do as attended. However the robot will still run the program.
I need to stop the program if the values 44, 46, 48 or 50 isnt entered at the start up of the program. 
i already made an if task that says:

If travel_distance≠active_distances
  -stop program

active_distances are my 4 values 44,46,48 and 50, but how do i bind them correctly to the variable.
if i where to write:
active_distances: 44 or 46 or 48 or 50 in the command task
the program stops anyway when i try to start the program with one of the values entered in the start

How can i do this? and is there a better way to do it?
- Sebastian

Best Answers

  • bcastetsbcastets Vacuum Beta tester Posts: 327 Handy
    Accepted Answer
    Here below is an example of program structure you could use to validate the input of the operator.


  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,216 Handy
    Accepted Answer
    You can also try length([1,2,3,4]) depending on your version the get_list_length may not be a supported API call.

    Matt
  • sebastianreasebastianrea Posts: 8 Apprentice
    edited February 22 Accepted Answer
    You can also try length([1,2,3,4]) depending on your version the get_list_length may not be a supported API call.

    Matt
    Hey Matt, thanks very much, length([1,2,3,4]) seems to work for the program

Comments

  • sebastianreasebastianrea Posts: 8 Apprentice
    Hi bcastets thanks for the answer, i have the CB3 version, but i will try to do this
  • sebastianreasebastianrea Posts: 8 Apprentice
    bcastets said:
    Here below is an example of program structure you could use to validate the input of the operator.


    I have copied your program ro my CB3 but i cant really figure out what get_list_length is?
    And it gives me an error message when it gets to 
    If value=acitveDistances[i]

    What could be wrong? or is it simply because i cant copy it to my CB3
  • bcastetsbcastets Vacuum Beta tester Posts: 327 Handy
    get_list_length is an integrated script function with return the length of a list.

    I suppose "if value=distance[i]" is not working because you have to use the equal with the question mark.
  • sebastianreasebastianrea Posts: 8 Apprentice
    edited February 22
    bcastets said:
    get_list_length is an integrated script function with return the length of a list.

    I suppose "if value=distance[i]" is not working because you have to use the equal with the question mark.
    I figured i used it wrong, my program now works perfect. Thank you so very much
Sign In or Register to comment.
Left ArrowBack to discussions page