Hello all, I’ve looked through the forums and found a lot of useful information but I finally have a problem I can’t seem to find anything about. For reference, I am new to UR but have used other robotics platforms.
I am trying to move my TCP from a set waypoint (based on a plane feature of course) in a set amount each time I loop the program. To put it another way, I am picking parts which are all lined up and need a subroutine to reach. After I pick the first part, I want to move by an amount to be in position for the second part. And so on and so forth. In this case, I believe I should be able to use a set distance variable X and a counting variable Y to do the math. However, the problem is that I can’t figure out how to work with pose_trans or pose_add to make the new position into what I want.
For example, if I want to travel 1.0" along my plane feature X axis every count of 1, is that not simple? In other robotics I know that this is something simple such as an “offset” or “index” function. Everything in UR has been so simple, therefore I feel I am missing something obvious. Please enlighten me, thanks in advance!
So there’s a couple options here. First off, moving your TCP along a Feature’s reference frame by an arbitrary offset is NOT (in my opinion) a very simple process. I have this link bookmarked, and used it again just today, actually.
His solution works perfectly. The only thing to note is that the “get_actual_tcp_pose()” function can be substituted for any pose you wish to shift along the given feature. So if you wanted to shift, say, some arbitrary point out in space, you’d put that pose there instead of the get_actual_tcp_pose().
(I think he also has one too many closing parenthesis on the second line but no big deal)
You can condense it all into one function call if you’d like. I use this function/script pretty often actually:
def getOffsetRelativeToFeature(x_offset, y_offset, z_offset, feature, poseToShift): return pose_trans(feature, pose_add(pose_trans(pose_inv(feature), poseToShift), p[x_offset, y_offset, z_offset, 0,0,0])) end
If you look at that and think “what the heck is going on”, welcome to the club. I won’t pretend I actually know what’s going on there, all credit goes to the guy in the link. But it will shift x_offset in the x direction, y_offset in the y direction, and z_offset in the z direction of the provided feature’s frame.
Then to call this function from polyscope, be sure to pass whatever offsets you want for x y and z, and pass the CONST version of the feature (found in the Pose dropdown), and then pass whatever pose you want to shift. In your case I think you’d pass “get_actual_tcp_pose().” In your case I would pass your x_offset * loop_counter into the function for your x_offset.
However, all this is to say you might want to check out the Palletizing node built in to polyscope. It is supposed to help make it easier to move your robot to a grid of positions.(I confess I find it somewhat difficult to get right, and tend to avoid it)
Lastly, you can actually just change your feature programmatically at run time and your moves will shift along with it. You can try using an Assignment node, choose the feature from the VARIABLE dropdown (not the Pose dropdown), and just assign it pose_add(feature, p[offset, 0,0,0,0,0]. Just be sure to reassign it to feature_const if your program needs to reset back to the start.
Not exactly sure of your situation. From your post I think you actually want the first method, since you mention specifically wanting to move along your Feature’s reference frame. If that orientation is different than base, that’s definitely the way to go. If it shares the same orientation as base, just shifting the feature is likely an easy alternative.
Thank you so much for the detailed response. Not only the script you are currently using, but linking me to the other comment with more links is incredibly helpful. There is always so much to learn.
After playing with a couple of these options, I believe your thoughts about the Palletizing node maybe be the ultimate answer. I hadn’t payed attention to “Palletizing” since that’s not what I’m doing, but it looks like the motion controls are in there. Best to learn the method intended. Thanks for pointing me in the right direction!
i am really interested in this topic since i am trying to give some offset to a trajectory (it could be both inside a move l or a move p).
Do you think that this approach could be helpful in this case?
Can you provide a little more detail? Is this trajectory already a pose, or are you getting it from external hardware? Do you need to shift it in Base, or across a Feature?
Depending on how you’ve got it coming in, you can potentially do a simple var1 = pose_add(trajectory_pose, offset) and just assign this to a var, then use a MoveL/P to a variable pose and select var1
Leaving this here for anyone else who might need it: