'!TITLE "PV_Calibration"

' Attention
' 1. Set IP address and subnetmask so that the robot controller and Panasonic PV locate in the same subnet mask
' 2. Open the TP panel after executing this PacScript 

' IP address of the device
#define IPAddress "192.168.0.2"

Sub Main
	Dim ctrl as Object
	Dim bmp as Object
	Dim sResult as String
	Dim VResult as Vector

	' Establishing a connection
	ctrl = cao.AddController("PV", "CaoProv.Panasonic.PV", "", _
								"conn=eth:" & IPAddress)

	bmp = ctrl.AddVariable("@BITMAP")

	Do
		
		' Storing images so as to pass them to the TP panel
		vars.ItemValue(0) = bmp.Value		

		' Start checking
		sResult = ctrl.Start

		On Error Resume Next

		' Converting results to V-type data
		VResult = "V(" & sResult & ")"

		'Converting results to variables so as to pass them to the TP panel
		vars.ItemValue(3) = POSX(VResult) / 100
		vars.ItemValue(4) = POSY(VResult) / 100

		On Error Goto 0

		Delay 500
	Loop
End Sub


