15 Maintenance of robot program
15-122 MELFA-BASIC V or MELFA-BASIC VI instruction
TrRd (reading tracking data)
[Function]
Read position data for tracking operation, encoder data and so on from the data buffer.
[Format]
TrRd
<Position data> [ ,
[
<Encoder data>] [ , [<Model number>] [ , [<Buffer number>] [ ,
[
<Encoder number>]
[ ,
[Pixel data]
] ] ] ] ]
[Terminology]
<Position data
[Position]
>
(cannot be omitted):
Specify a variable that contains workpiece positions read from the buffer.
<Encoder data
[double-precision real number]
>
(can be omitted):
Specify a variable that contains encoder values read from the buffer.
<Model number
[integer]
>
(can be omitted):
Specify a variable that contains model numbers read from the buffer.
<Buffer number
[integer]
>
(can be omitted):
Specify a number of a buffer from which data is read.
1 is set if the argument is omitted.
Setting range: 1 to 4(
The first argument of parameter [TRBUF])
<Encoder number
[integer]
>
(can be omitted):
Specify a variable that contains values of external encoder numbers read from the buffer.
<Pixel data
[position]
>
(can be omitted):
Specify a variable that contains workpiece pixel positions read from the buffer.
[Reference program]
(1) Tracking operation program
1 TrBase P0
' Specify the workpiece coordinate origin at the teaching position.
2 TrRd P1,
M1,
MK
, 1, ME, P3
' Read the workpiece position data from the data buffer.
3 Trk On,P1,M1
' Start tracking of a workpiece whose measured position is P1 and encoder
value at the time of measurement is M1.
4 Mvs P2
' Setting the current position of P1 as P1c, make the robot operate while
following workpieces with the target position of
Inv(P0) * P2
.Add that to the
target location.And tracking.
5 HClose 1
' Close hand 1.
6 Trk Off
' End the tracking operation.
(2) Sensor data reception program
1 *LOOP
2 If M_In(8)=0 Then GoTo *LOOP
' Jump to *LOOP if input signal No
. 8, to which a photoelectronic
sensor is connected, is OFF.
3 M1#=M_Enc(1)
' Acquire data of encoder number 1 at the time when input signal
No. 8 is turned on and store it in M1#.
4 TrWrt P1, M1#,MK
' Write workpiece position data P1, encoder value M1# at
the time
an image is acquired and model number MK in the buffer.
(3) Vision data reception program
1 NVClose
' Close communication line
2 NVOpen “COM2:” As #1
' Open communication line and log on
3 Wait M_NvOpen(1) = 1
' Wait to log on to the vision sensor
4 NVLoad #1, “test”
' Load the vision program
5 NVTrg #1, 5, MTR1”
'
Imaging r encoder value acquisition
6 EBRead #1,””,MNUM,PVS1,PVS2,PVS3,PVS4
' Acquire data of one recognized workpiece
7 MVsX = PV1.X
' Acquire X data
8 MVsY = PVS1.Y
' Acquire Y data
9 MVsC = Deg(PVS1.C)
' Acquire the C data converted to the degree unit
10 PosVS = PVSCal(1, MVsX, MVsY, MVsC)
'
Acquire the position data changed from a pixel to a robot
coordinate
11 TrWrt PosVS, MTR1#, 1, 1, 1, PVS1
' Write data in the buffer
Summary of Contents for CR800 Series
Page 2: ......
Page 12: ......
Page 202: ...18 Appendix 18 190 Calibration sheet ...
Page 203: ......