Robtarget displacement relative to tool coordinates
QueBert1
✭
in RobotStudio
Hello, I have had quite a lot of trouble figuring out what sounds like a simple problem. I have a procedure that accepts 2 robtarget user parameters. These 2 robtargets are the start and end points of a weld. Users should be able to enter these robtargets in either order. I would like for the weld to occur only in the x+ direction relative to the tool. This is my attempt at swapping the targets if they happen to be entered backwards (end point entered first). If the weld procedure executes while target1 is the end point then the tool will end up moving in the x- direction, which is something I don't want.
User inputs are target 1 and target2.
Any ideas where I'm going wrong? I should also mention that the tool can have many different orientations so I attempted to keep all logic relative to the tool.
Thanks for any help you can provide!
User inputs are target 1 and target2.
VAR robtarget target1_pseudo;
VAR robtarget target2_pseudo;
VAR robtarget target2_x_goal;
VAR num xdiff;
VAR temp_target1;
target1_pseudo:=Reltool(target1,0,0,0);
target2_pseudo:=Reltool(target2,0,0,0);
xdiff:=ABS((target1_pseudo.trans.x) - (target2_pseudo.trans.x));
target2_x_goal:=Reltool(target1_pseudo,xdiff,0,0);
IF target2_pseudo.trans.x <> target2_x_goal.trans.x THEN
temp_target1:=target1;
target1:=target2;
target2:=temp_target1;
ENDIF
Any ideas where I'm going wrong? I should also mention that the tool can have many different orientations so I attempted to keep all logic relative to the tool.
Thanks for any help you can provide!
0
Best Answer
-
Had I paid more attention the first time reading, I would have noticed you did use the Reltool function as I suggested. 😬
It is a little difficult following your code and thinking of scenarios of logic on that X plane.
One example: target1_pseudo:=Reltool(target1,0,0,0); target2_pseudo:=Reltool(target2,0,0,0);These seem to me to be doing nothing.
This may also be problematic:xdiff:=ABS((target1_pseudo.trans.x) - (target2_pseudo.trans.x));
Say that target 1 is 100 in the X plane, and target 2 is also 100 in that plane then you have a difference of zero. The targets could be far apart, just not different in X. Then what?
I will suggest that you change nothing. If you have not done so already, step through the code one line at a time. Pause in between, examine the values being produced, changed or unchanged compared to what you might be expecting. This is THE BEST WAY to debug your code. Hitting the start button is no better than tucking in your chin and running head first into the nearest wall. Share your results, please. If I am wrong, I would like to be corrected, and we all can share the knowledge.Lee Justice0
Answers
-
First off, I can tell you that you are finding the difference of robtarget.trans.x vs. another.trans.x. This gives no indication of tool coordinate x direction. It is only the world or workobject difference on that plane.
Admittedly, my higher mathematical skills are my weak point. However, I will point you to a bunch of utilities that might do what you need or at least give you a good starting point on how to determine that which you are asking.
https://github.com/ernell/ABB-RAPID-UTILITY-LIBRARY/blob/master/Contributions/RobertAndersson/lib_rob.sys
As I am writing this, I thought of something that might help: The RelTool function. Many don't realize that it can be used independent of a Move instruction. Maybe if the input points are equal to or greater than a certain number as evaluated by the RelTool function, you can make that work.Lee Justice0 -
lemster68 said:First off, I can tell you that you are finding the difference of robtarget.trans.x vs. another.trans.x. This gives no indication of tool coordinate x direction. It is only the world or workobject difference on that plane.
Admittedly, my higher mathematical skills are my weak point. However, I will point you to a bunch of utilities that might do what you need or at least give you a good starting point on how to determine that which you are asking.
https://github.com/ernell/ABB-RAPID-UTILITY-LIBRARY/blob/master/Contributions/RobertAndersson/lib_rob.sys
As I am writing this, I thought of something that might help: The RelTool function. Many don't realize that it can be used independent of a Move instruction. Maybe if the input points are equal to or greater than a certain number as evaluated by the RelTool function, you can make that work.
Good to know that trans.x generates the world x-coordinate. Even in this case though, shouldn't the world x-coordinate of target2_pseudo match the world x-coordinate of target2_x_goal if target1 and target2 were entered in the correct order?
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings