Estimate the Orientation of a Target Coordinate System

Overview

This chapter contains examples of how to use FB_TeachingOrientation to estimate the orientation of a target coordinate system with reference to the coordinate system of the robot.

Fixed Coordinate System

If the target coordinate system is not moving, a grid with known positions can be used as a reference for estimating the orientation.

NOTE:
  • The grid must have a minimum of six points; each set must contain a minimum of two points.

  • It is important that the X direction of the grid is aligned to the direction of the X axis of the orientation to teach.

  • If the reference grid is printed on a sheet of paper, the alignment of the grid to the X and Y axes of the target system to teach influences the result of the estimation.

Procedure for Using the Provided Teaching Grid

Step

Action

1

Start by printing the provided teaching grid. In this example the Reference Grid.

2

Place the printed teaching grid on the physical coordinate system to teach, ensuring that the X and Y axes drawn on the grid are aligned as much as possible with the equivalent axes of the system to teach. Any misalignment between the teaching grid orientation and the coordinate system to teach influences the estimated orientation.

NOTE: Ensure that the teaching grid cannot move with respect to the surface of the system on which it is placed.

3

Define an instance of the teaching function block:

fbTeachingOrientation : FB_TeachingOrientation;

4

Call the method SetNumberOfSamplesPerSet to set the number of samples that are stored for each set. In this case the teaching grid is composed of three sets, each one containing two samples.

The called method provides a value of 2 as input:

fbTeachingOrientation.SetNumberOfSamplesPerSet(
    i_udiValue := 2, //number of samples in each set in this example
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);

5

(Optional)

The teaching requires touching points with the robot on the surface of the other system to teach. This procedure is performed with a tool mounted on the robot. The cartesian pose transformation introduced by a tool can be described with ROB.IF_RobotConfiguration.ConfigureTool. Then the tool can be selected with the method ROB.IF_RobotMotion.SetTool. Once a tool is set, the feedback ROB.IF_RobotFeedback.rstRefPositionTCP accounts for that.

If a rotation of the tool could influence the TCP position, the orientation must be considered, and it is then required to configure the robot so that the orientation is properly handled (see ROB.IF_RobotConfiguration.MapComponentToDrive).

6

Move the robot to a position where it is aligned to the circle marked with the number 1 inside Set 1, as displayed in the graphic.

7

Call the method AddSample to store the position of the TCP:

fbTeachingOrientation.AddSample(
    i_stTCPPosition := stCurrentTCPPosition,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);

Where the variable stCurrentTCPPosition is of type SE_MATH.ST_Vector3D and its value can be obtained for example from the property ROB.IF_RobotFeedback.rstRefPositionTCP.

NOTE: After calling AddSample a first time for the selected set, the value of udiNumberOfSamplesInActiveSet increases by one.

8

Move the robot to a position where it is aligned to the circle marked with the number 2 inside Set 1, as displayed in the graphic.

9

Call the method AddSample to store the position of the TCP:

fbTeachingOrientation.AddSample(
    i_stTCPPosition := stCurrentTCPPosition,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);
NOTE: After calling AddSample a second time for the selected set, the set is completed and the value of udiNumberOfCompleteSets increases by one.

10

Move the robot to a position where it is aligned to the circle marked with the number 1 inside Set 2, as displayed in the graphic.

11

Call the method AddSample to store the position of the TCP:

fbTeachingOrientation.AddSample(
    i_stTCPPosition := stCurrentTCPPosition,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);

12

Move the robot to a position where it is aligned to the circle marked with the number 2 inside Set 2, as displayed in the graphic.

13

Call the method AddSample to store the position of the TCP:

fbTeachingOrientation.AddSample(
    i_stTCPPosition := stCurrentTCPPosition,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);

14

Move the robot to a position where it is aligned to the circle marked with the number 1 inside Set 3, as displayed in the graphic.

15

Call the method AddSample to store the position of the TCP:

fbTeachingOrientation.AddSample(
    i_stTCPPosition := stCurrentTCPPosition,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);

16

Move the robot to a position where it is aligned to the circle marked with the number 2 inside Set 3, as displayed in the graphic.

17

Call the method AddSample to store the position of the TCP:

fbTeachingOrientation.AddSample(
    i_stTCPPosition := stCurrentTCPPosition,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg
);

18

Call the method EstimateOrientation to estimate the orientation of the target coordinate system based on the acquired sets of samples:

stEstimatedOrientation := fbTeachingOrientation.EstimateOrientation(
    i_etOrientationConvention := ROB.ET_OrientationConvention.ZYX,
    q_xError => xError,
    q_etResult => etResult,
    q_sResultMsg => sResultMsg,
    q_stRotationMatrix => stRotationMatrix //structure of type SE_MATH.ST_Matrix3D
);
NOTE:
  • stEstimatedOrientation is a structure of type ST_MATH.ST_Vector3D that contains the orientation described as roll, pitch and yaw angles, according to the orientation convention provided as input.

  • The estimated orientation represents the orientation of the target coordinate system with reference to the coordinate system of the robot. In addition to the returned value, the method also returns an equivalent description of the estimated orientation in the form of a 3D rotation matrix.