Transformations
Overview
In RobotStudio transformation is most commonly associated with the process of modifying the position or orientation of an object with respect to various reference frames.
The following example describes how to offset a frame:
// Create a frame.
Frame myFrame = new Frame();
myFrame.Name = "MyFrame_1";
// Add the frame to the station.
station.Frames.Add(myFrame);
// Move the frame 100 mm along the X-axis.
myFrame.Transform.X = myFrame.Transform.X + 0.1;
What is Transformation Matrix ?
When dealing with Transformations, it is very usual to describe in terms of matrices for ease of understanding and calculation.
A typical transformation matrix of an object is a 4 * 4 matrix has the following information:
- Position
- Orientation
- Scaling
This transformation matrix can be defined using a Matrix4 structure in RobotStudio. In RobotStudio any object of type ProjectObject has a corresponding matrix.
R represents the Orientation (Rx, Ry, Rz) and P represents the Position (x, y, z) of the Object. The various transformation matrix properties and methods allow user to get or set the position and orientation of an object with respect to different co-ordinate systems.
The section would highlight the important properties and methods of Transform class.
Properties
Global Matrix property allows user to Get or Set, the Position and Orientation information of an Object with respect to the World (Global) reference frame in a Matrix4 format.
This property represents the current position and orientation of an object with respect to its Parent.
Methods
These methods are primarily used to enable transformation an object from one co-ordinate system into another.
Let us take an example to see the application of this method. Consider that there is a RsTarget created under wobj0 as shown below.
The position and orientation (pose) of the RsTarget is defined with respect to wObj0. If user has to associate it with WorkObject_1, then user can update the RsTarget with the new WorkObject.
As a consequence the RsTarget is repositioned so that the relative distance between WorkObject_1 and the RsTarget is the same as what it was between wobj0 and the RsTarget.
If we do not want to change the position of the RsTarget then we can use the Transformation method SetRelativeTransform to achieve the desired result as explained here.