Sample Conveyor Tracking Program

The following is a sample GPL conveyor-tracking program.  It assumes that parts will come down the conveyor and pass a sensor that sets a digital input signal.  When each part is in range, this program will move the robot from a safe position, through an approach position, to a position just above the part.  The system will dwell for 1 second and track the part on the moving conveyor.  The robot will then return to the safe location until the next part is detected.

This sample program includes the manual teaching of all positions and a continuous loop that automatically tracks any parts that come down the conveyor.  If required, the accuracy of the part position could be improved by utilizing encoder latching instead of the simple signal polling method that is employed.

To execute this procedure, perform the following steps.

  1. Ensure that you have performed all of the conveyor setup that has been described in the previous sections and that Robot #2 has been configured as a conveyor robot module.  If the robot number is different, edit the CNV_ROB constant in the program.
  2. Ensure that the first DIO signal (10001) is connected to the part sensor.  If some other signal is used, edit the PART_PRESENT constant in the program.
  3. Stop the conveyor belt and clear the conveyor of all parts.
  4. Load the following GPL program into your controller and begin its execution.
  5. Start the conveyor and place a part upstream of the part sensor.  When the part passes the sensor and comes into the range where the robot can reach it, stop the conveyor.
  6. Position the robot's tool just above the part and press the "Teach" button on the pop-up displayed by the sample application.
  7. Move the robot to a safe position that is above the conveyor.  Ensure that the robot is in computer mode with power on.
  8. Press the "Go" button on the next pop-up when you are ready to track sample parts.
  9. Start the conveyor and feed parts.  The sample program will track each part that comes down the conveyor.

The following is the complete sample program.  No global data need to be defined for this program.

Public Sub MAIN
Dim belt1 As New RefFrame
Dim
loc1 As New Location
Dim
safe As New Location
Dim
pf1 As New Profile
Dim
msg As String
Dim
btn_idx As Integer

Const PART_PRESENT As Integer = 10001' Part sensor DIO signal
Const CNV_ROB As Integer = 2 ' Robot #2 is the conveyor

belt1.Type = 2 ' Conveyor reference frame
belt1.ConveyorRobot = CNV_ROB ' This is the conveyor robot
loc1.RefFrame = belt1 ' loc1 is belt relative
loc1.ZClearance = 25.4

pf1.Speed = 20 ' Move slow
pf1.Straight = True ' Must be Cartesian motion

' Manually define part location relative to the belt.

While (Not Signal.DIO(PART_PRESENT))' Wait till part comes down
Controller.SleepTick(1)
End While
belt1.ConveyorOffset = Robot.WhereAngles(CNV_ROB).Angle(1)

msg = "Stop the conveyor when the part is in range of the "
msg &= "robot. Position robot over the part and press Teach."
Controller.Showdialog("Teach", msg, btn_idx)
loc1.Here ' Record belt rel position

' Automatically track a series of parts on the conveyor.

msg = "Move robot to a safe position. Send parts down the "
msg &= "conveyor and press Go to momentarily track each part."
Controller.Showdialog("Go", msg, btn_idx)

Robot.Attached = 1
safe.Here ' Record safe location

While True
While
(Signal.DIO(PART_PRESENT))' Wait until no part
Controller.SleepTick(1)
End While
While (Not Signal.DIO(PART_PRESENT))' Wait until next part
Controller.SleepTick(1)
End While
belt1.ConveyorOffset = Robot.WhereAngles(CNV_ROB).Angle(1)

Move.Approach(loc1,pf1) ' Go touch the part
Move.Loc(loc1,pf1)

Move.Delay(1) ' Demonstrate tracking

Move.Approach(loc1,pf1) ' Back to safe position
Move.Loc(safe,pf1)
End While



End Sub