Circular Tracking using functions blocks (MELFA Basic VI)

Circular Tracking using functions blocks (MELFA Basic VI)

The article presents a library for supporting circular tracking function.
If you are interested in linear tracking applications, refer to the article below:

"Copyright © Mitsubishi Electric Europe B.V.

IMPORTANT !

These Function Blocks are demo versions that are only  intended to demonstrate program functions and provide general orientation for  your software choices. They are not suitable for use in real applications! "

"Improper use of demo versions in applications can lead to serious malfunctions  and damage! Programs for real applications must always be configured for the  individual application by trained staff and tested thoroughly before being  used.

Mitsubishi Electric cannot assume any liability if these examples are used in real applications."


Library description

The library contains functions for parameterization of circular tracking: fnCircTrkParam(), function for recalculation of tracking based on incoming data: fnCircTrkRecalc() and a function implementing the tracking sequence fnTrkCircular(). These functions allow you to start circular tracking with picking or placing a single detail.

Tracking parameterisation - fnCircTrkParam()

With this function, we can set up basic adjustments for tracking. The following is a description of the arguments of the function:
value = fnCircTrkParam(mOffsetZ, mAccel, mDecel, mSyncDly, mTimeout, mHandOpen)

Argument
Description
mOffsetZ
height of passage over the workpiece (shift in the Z axis)
mAccel
acceleration of tracking
mDecel
deceleration of tracking
 mSyncDly
 time delay for synchronising speed between robot and rotary table
 mTimeout
 timeout of tracking function - after this time workpiece is dropped from buffer
mHandOpen 
direction of action of the gripper (0 - closing, 1 - opening)

Values returned by functions:

Value
Description
1
correct parameter setting
(other)
an error in parameter appeared - no need for implementation for now


Tracking calibration - fnCircTrkRecalc()

This function is recalibrating tracking zones based on incoming workpiece position.
Pvalue fnCircTrkRecalc()

This function requires no input parameters. It works on data provided from tracking buffer.
This function has one output value. It returns offseted position of tracking start position.
Output position should be used for next function in order to speed up operation.

Tracking sequence - fnTrkCircular()

value fnTrkCircular(pWait, pReady, mHandDly, mHandNo)

The function is responsible for the implementation of the sequence of picking / placing the workpiece in tracking movement. The following is a description of the arguments of the function:

Argument
Description
pWait
position of waiting for workpiece
pReady
position of the starting the tracking
mHandDly 
delay for the gripper to maintain operation
mHandNo
gripper (valve) number

Values returned by the function:
Value
Description
 1
correct operation
-1
Error - workpiece passed while tracking
-2
Error - workpiece passed before tracking
-3
Error - workpiece radius mismatch
-4
Error - buffers count mismatch


Sample project description

In the attachment there is a workspace which consist of all library files and programs operating on circular tracking. Brief description of included programs is written below.

Program name
 Description
TRK
 Main program works in the order to pick workpiece in tracking and place it on the pallet
A1
 initial configuration program for real application (online)
CAM
 vision sensor program for real application (online)
VAR
 Global variable program
A1SIM
 initial configuration program (simulation)
CAMSIM
 vision sensor program (simulation)
FUNLIB
 Standard functions library
PARAMSETUP
 Initial parameter program
CIRCLETRKLIB
 Conveyer circular arc tracking library


Starting tracking using the library

Detailed information on how to start tracking can be found in the instructions (file bfp-a3520.pdf).
Provided project can be used in two versions - in order to prepare simulations and for creating real, final application.
Due to no hardware used in simulation some data needs to be generated / provided in different way.

Wiring of encoder 

Details in chapter 5 of the instruction manual.
When wiring encoder to the robot controller, keep in mind these few important notes:
  1. when the TRMODE parameter is set to 0, it makes it impossible to read the encoder pulses. Run PARAMSETUP program or set TRMODE manually.
  2. table rotation should generate impulses that increases M_enc value. In other case tracking function might not work properly. To switch encoder direction, simply switch A and B phase wiring of encoder.
  3. external 5V power supply (i.e. from encoder PS) should be provided to robot controller.



Rotary table calibration

It is essential to provide the value of pulses per revolution for the rotary mechanism. This value should be set in A1 program.
Start, end and stop zones should be all in the range of robot movement.
It is recommended to teach positions for zones at the very end of table (marked as black circles).
These points are used to measure the centre of rotation for all following pieces.


Tracking zones should be taught in the fixed order!
Based on the graphics above:
Green  zone - Position P_TrkStart
Yellow zone - Position P_TrkEnd
Red      zone - Position P_trkStop

If order is wrong, robot might operate on tracking in wrong direction and cause damages to station.


Camera calibration and detection settings

In the case of tracking with a vision system, the camera should be calibrated, as a result of which we will obtain a relationship between the coordinates of the photo and the location of points in the robot space.
An example of how to perform such a procedure for Cognex cameras can be found in the manual (chapter 9).


Then define the task of detecting elements and set the parameters of communication with the robot.


Camera and Buffer Handler

The project includes CAMSIM, and CAM programs used to save positions to the tracking buffer.
CAMSIM simulates operation with camera by generating random position. Inside this program user can modify the region, where workpiece position might be generated. Configured region might be highlighted by selecting all Prange() positions and checking their location on 3D Monitor window.
In the case of the CAM program, communication with the camera is established, functions are used to trigger a photo, as well as to read and process data.
As an output of both programs, position and distance between this position and circle center (movement radius), is loaded on buffers.
It is important to note that for circular tracking 2 tracking buffer are used:
  1. first buffer is used in a standard way, to provide proper tracking sequence
  2. second buffer keeps original position sent by Vision sensor or generated by camera simulation. This value is used to calibrate tracking function just before tracking have started. In case of this buffer there should be no value provided for encoder nor selected encoder should not generate pulses. 

Tracking application general insights

  1. TCP point of robot gripper (tool centre point, roughly the position of picking component) should be coaxial or at least close to last rotation axis of robot. When this shift is big and the orientation of handled workpieces changes, it might cause shortage of robot working envelope. When TCP is coaxial with last axis, orientation of the workpiece has no impact on working envelope of robot.
  2. Function fnCircTrkRecalc() should work seamlessly, but in some cases of application there might be required some simple adjustments inside library, for example adding or subtracting one full rotation of C coordinate (2*M_PI)
  3. In case of sensor tracking (where input position is fixed), fnCircTrkRecalc() can be triggered only once on the beginning of the program
  4. There is also additional library, called FUNLIB included in the project. It helps to reduce amount of code for a simple, repetitive operation. User can apply it in many other applications.
The description of the arguments of functions is in the file FUNLIB

Configuring project for making simulation

Required programs:
  1. PARAMSETUP
  2. VAR
  3. A1SIM
  4. CAMSIM
  5. TRK
  6. CIRCLETRKLIB
  7. FUNLIB
Unused programs:
  1. A1
  2. CAM
Follow these steps in order to create circular tracking simulation:
  1. Import specified programs to your workspace
  2. Run PARAMSETUP once. This operation is required to be done just once per whole workspace.
  3. Restart simulation.
  4. Open A1SIM program and perform configuration based on the description in the code. In case of simulation modification, reopen this program again to adapt simulation layout.
  5. When saving program, make sure to check last option of saving external (global) variables.

  6. Run A1SIM once. This operation is required to be done after every startup of simulation.
  7. Open 
  8. Open TRK program and make sure that CAMSIM program will operate in this application. Update Phome and Pwait positions.
  9. Perform any further modification based on your needs, like tracking offset, override speed, picking/placing static sequence, etc.
  10. Run TRK program.

Configuring project for making real application

Required programs:
  1. PARAMSETUP
  2. VAR
  3. A1
  4. CAM
  5. TRK
  6. CIRCLETRKLIB
  7. FUNLIB
Unused programs:
  1. A1SIM
  2. CAMSIM
Follow these steps in order to create circular tracking real application:
  1. Import specified programs to your workspace
  2. Run PARAMSETUP once. This operation is required to be done just once per whole workspace.
  3. Restart robot controller.
  4. Make sure that encoder is working properly. When rotary table rotates in expected direction, encoder should increase the M_enc() value in robot variables. 
  5. Open A1 program on Teaching Pendant. Go through all the instructions inside the program. This operation is required to be done after each layout modification.
  6. Perform camera calibration and configuration based on manufacturers documentation.
  7. Provide camera configuration in Ethernet settings of RC. (Online -> Parameter -> Communication parameter -> Device & Line)
  8. Open CAM program. Perform modification based on the camera communication configuration and job used.
  9. Open TRK program and make sure that CAM program will operate in this application. Update Phome and Pwait positions.

  10. Perform any further modification based on your needs, like tracking offset, override speed, picking/placing static sequence, etc.
  11. Test TRK program carefully and perform further updates till reaching appropriate effect.

Attachments:
File name
Description
_Circular Vision Tracking Sample.7z
RTT3 Workspace
bfp-a3520.pdf
Manual