How to change the position of a target based on digital input

I’m looking to use a digital input offset to change the z position of a target. The pick and place positions will change based on the diameter of the part entered on our machine. The I/O is connected and a variable exists that converts the DI offset to the proper z value, but how do I create a target that uses this variable to change its position? Since the variable is only one value I would need the rest of the target information but I cannot find where to enter that information.

Create a Pose Variable (p[x, y, z, rx, ry, rz]) and simply modify 3rd element (index 2) to change only the Z value. Then have your Waypoint node configured to use a Variable position, and select this variable that you are modifying.

To elaborate on what Eric said, here’s a snippet of a script which does just that.

In this case, we’re adjusting both the x and z locations based on part dimensions & preferred offsets.

**global gage_home_high = gage_home**

** gage_home_high[0] = gage_home_high[0]-TC_meters + FW_meters - tip_offset**
** gage_home_high[2] = gage_home_high[2]+gage_offset**

** movel(gage_home_high, a=.2, v=.03, t=0, r=0)**

Thank you both for the reply. I am familiar with both of those methods however am not used to the nodes on the teach pendant. Is there software I can download to do this on my computer and type out all the syntax? The pendant seems limited and I am not very experienced with it.

I have my pose variable = [0,0,part_dia,0,0,0] and the waypoint variable is set to the pose variable. When I run the program the robot goes way off to a different position from what the variable is set to, none of the values are the same. I can see that the tool position is not equal to the waypoint position although it had just moved there. Am I forgetting something?

Well you would NOT want to move directly to your pose variable if that’s what you’ve made it. This will try to bring the tool at x= 0, y= 0, which would be centering the tool above the Base of the robot. In order to use a pose structured like that, you’d have to couple that with a pose_add(nominal_position, variable_position).

The tool position being different is probably just due to which reference frame you have selected, so I wouldn’t put a whole lot of stock in that value. It’s really going to come down to use that pose_add() function to offset your point. Either that, or like @dpeva shows, you need to access the index of the ACTUAL variable position (which has valid data in all 6 indices, not just 0s).

That was just an example. [-480,-430,(-105+Part_dia),3,0.8,0.4) is close to what I have and the robot moves to a completely remote position.

How do I get these functions? I’m not even sure I made the Pose Variable correctly, I just made a variable and named it Pose Variable. Like I said there are almost no functions available for me on the pendant? Where are they?

The script manual outlines all the functions you have available. They are all accessible via teach pendant, as they are just URScript.

Otherwise you can just select certain functions from the dropdown boxes. This is an example from the Assignment node:

You can also enter whatever you want via the “Script” node where you can type via pendent or a USB keyboard.

And I’m not sure if those numbers you gave were just another example or what, but that also can’t be correct, as the robot sees everything in meters, and you definitely aren’t going to reach -480 meters out there lol

That did it, and a few other things. I was using mm instead of meters so it was going across the building and I had forgotten the p before my position. I used pose_add() like you recommended to simplify things. Thank you for showing me the script button also, makes things much easier.