RS SDK - Tool Compensation
Shaun
✭
Hi there,
I am wanting to implement a path offset in the same way as the "Path -- Tool Compensation" feature works (i.e. offset the path to compensate for the radius of the tool). Unfortunately, I'm tying myself in knots with the various Frames, Transforms and Matrices that are involved!
So...
RsTarget.Transform
...gives me the coordinates for the target in the local work object, and...
RsTarget.ReferenceFrame
...gives me the coordinates for the target in the target reference frame. I seem to be able to move the ReferenceFrame by using...
// I want to offset the target by 20mm in the Y-direction of the ReferenceFrame
Matrix4 offsetMatrix = new Matrix4(new Vector3(0, 0.02, 0), new Vector3(0, 0, 0));
target.ReferenceFrame.SetRelativeTransform(target.Transform.GlobalMatrix, offsetMatrix);
...but this doesn't move the actual target point at all.
Am I on the right track? How do I move this target to the required location?
Many thanks!
0
Comments
-
Bump.0 -
I think I've answered my own question (which hopefully somebody can confirm). Here's the solution that I've come up with...// Record the rotation vector of the current targetVector3 oldRotationVector = target.Transform.Matrix.EulerZYX;// I want to offset the target by 20mm in the Y-direction of the ReferenceFrameMatrix4 offsetMatrix = new Matrix4(new Vector3(0, 0.02, 0), new Vector3(0, 0, 0));// Translate the target in the reference frame, although this ends up with the wrong orientationtarget.Transform.SetRelativeTransfom(target.ReferenceFrame.GlobalMatrix, offsetMatrix);// Record this new translation vectorVector3 newTranslationVector = target.Transform.Matrix.Translation;// Set the target matrix to the new translation and the old rotationtarget.Transform.Matrix = new Matrix4(newTranslationVector, oldRotationVector);This seems to work and gives results consistent with the "Tool Compensation" functionality.0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings