<< Prev        Next >>

ID : 2894

Sample Program for a Sensor Tracking

The below describes programming example of the sensor tracking.
This program is designed for workpieces whose length are less than the tracking range.

Example

Sensor tracking is achieved by the following three programs.

  1. "Main program"

    Main program is a initialization program with regard to the circular tracking.

  2. "Workpiece detection program"

    Workpiece detection program is a program that detects workpiece positions and saves the obtained data into tracking buffer.

  3. "Tracking motion program"

    The tracking motion program obtains the positional data of the workpiece from the tracking buffer area, and then executes tracking and picking up operation by use of obtained positional data.

1. Main program (SensorTracking.pcs (PCS:280B)

Clear the tracking buffer area of conveyor 1, and then start detecting a trigger from sensor signal.

TrackInitialize 1, 0

Execute workpiece detection program and tracking motion program concurrently.

Run Sensor
Run Tracking

2. Workpiece detection program (Sensor.pcs (PCS:2KB)

Detect a rising edge.

Wait IO[48] = OFF
Wait IO[48]

Add the latest sensor detection coordinates (encoder value) to the tracking buffer as much as the number of workNum.
In this case, it is possible to add userdata up to the number of workNum as variant-type array.

TrackSetSensor 1, workNum, arrayUser

3. Tracking motion program (Tracking.pcs (PCS:2KB)

With a TrackStart command, move a robot arm to the home position before starting the circular tracking.
Please note that executing any commands designed for non-tracking mode, such as Move command, will interrupt the tracking motion. (Commands whose name do not start from "Track" will interrupt the tracking motion.)

Move P, P[50]

The main loop for the tracking and pick-up motion that is executed whenever a workpiece is detected.
In this program, turning ON of an internal I/O is specified as the loop continuation condition so that the loop can be stopped in the middle of the program.

Do
    P[10] = TrackTargetPos(1)

    ...

    TrackApproach P, P[10], 50

    ...

LOOP UNTIL IO[128] = ON

This is the processing within the loop.

Pick up a workpiece from the tracking buffer and then set it to the tracking target work.
If there are no workpieces detected, the program will wait until workpiece is detected and its data is stacked in the tracking buffer.

    P[10] = TrackTargetPos(1)

Start the tracking mode. The robot does not start its motion at the timing of this command execution.
The robot starts its motion once a tracking motion command, such as TrackApproach, is executed.

    TrackStart 1

Wait until the tracking target work enters the tracking range.

    Wait TrackInRange(1), 10000, timeoutFlg

With performing the catch up motion in order that the robot moves with the turntable speed, move the robot arm to the approach position which is 50 mm above of the tracking target work.

    TrackApproach P, P[10], 50

With the catch up motion, move the robot arm to the tracking target work.

    TrackMove P, P[10]

With the catch up motion, move the robot arm to the depart position which is 50 mm above of the tracking target work.

    TrackDepart P, 50

Terminate the tracking mode. Stop the catch up motion and reduce the robot arm speed until the robot fully stops.
If the workpiece moves across the downstream limit of the tracking range before executing this command, an error will be issued.

    TrackStop

Place the picked workpiece to the ejection position.

    Approach P, P[52], 50

ID : 2894

<< Prev        Next >>