Hi,
We are trying to establish communication between Keyence VS vision system and UR5. the robot is not receiving the positional data required to execute the vision-guided process. The connection attempts fail despite using the recommended Ethernet settings, socket communication parameters, and Keyence program configuration.
the problem appears in Keyence Utility program, whenever we try to run it on the robot controller, it shows string error. the program is below. Could you please have a look at the code and advise where the problem could be ?
Program
Variables Setup
BeforeStart
Script: KeyVsCommonFunctions.script
KeySetCommParam(“192.168.0.10”, 8500)
KeySetMoveParam(10, 500)
KeyConnect()
Robot Program
result:=KeySendCommand_RBMR()
If result==-1
Popup: Communication Error
If ResultMode==4
result:=KeySendCommand_RBRPW(KeyGetCurrentPose(), 0, 0)
If result==-1
Popup: Communication Error
ElseIf ResultMode==1 or ResultMode == 2 or ResultMode == 3
result:=KeySendCommand_RBCP(0)
If result==-1
Popup: Communication Error
standbyPose:=ResultPose
KeyMove(standbyPose)
idx:=1
status:=1
Loop status==1
result:=KeySendCommand_RBCP(idx)
If result==-1
Popup: Communication Error
If result==1
KeyMove(ResultPose)
result:=KeySendCommand_RBCD(idx)
If result==-1
Popup: Communication Error
idx:=idx + 1
ElseIf result==2
idx:=idx + 1
continue
Else
status:=0
KeyMove(standbyPose)
result:=KeySendCommand_RBCE(2)
If result==-1
Popup: Communication Error
KeyClose()
Halt
What’s the IP address of the robot, and have you enabled all the external facing protocols in the Security settings on the robot?
Hello,
I have already used Keyence scripts for data retrieval.
As i recall, I had no issues retrieving values from the camera, but only when trying to move the robot within a coordinate frame different from the camera’s.
For the KeySetCommParam(“192.168.0.10”, 8500) command to work, the PC, the camera, and the robot must be on the same network.
(Example: PC → 192.168.0.100 | Camera → 192.168.0.10 | Robot → 192.168.0.20)
During my tests, it seems that the camera is, by default, configured with the IP address 192.168.0.14 or 192.168.0.15. Therefore, you should adjust the command accordingly, for example:
KeySetCommParam(“192.168.0.14”, 8500) or KeySetCommParam(“192.168.0.15”, 8500).
I have already asked KEYENCE France for documentation on these scripts, but unfortunately they do not have any.
Thank you Thomas, the IP address in the code is the camera’s one. and all of the camera, my PC and the robot are on the network.
the error message I got each time is Const String error. I contacted Keyence UK many times but they seem not helpful!!
1 Like
Yea I did!! the error seems to be in the script! the message I got when I ran the utility program on the robot
Type error: a list cannot contain this data type: Const String
Hello,
If all three devices are connected to the same network, then the error comes either from the script or from the type of data being sent from the camera software.
I was able to receive the data in both the “Utility” and “Sample” programs.
I also contacted KEYENCE France, but they couldn’t help me. They told me that the script was developed by their team in China or Japan (I don’t remember exactly), and that they do not have any documentation available.
Could you attach a screenshot of the data you want to send from the software?
Kind regards
Not sure what system you have, or even what system our guys were using here, but when I sat down and looked at that system, the coding language uses a slightly archaic method for treating variables as “const” which means they are not allowed to change. If the error is saying the list can’t contain a const string, then you need to stop assigning a constant string to whatever list you’re using.
The part that isn’t obvious is HOW things are being made const. In our case, all variables must be declared BEFORE doing any kind of math or other operations. If you perform an inline declare + assign a value, THAT is how it thinks it needs to be const. What I mean is these two are not identical statements:
var myString = "Hello World"
and
var myString
myString = "Hello World"
The first one instantiates myString as a Constant, and the second one instantiates it as a variable.
Again, not sure if you’ve got the same issue, it just sort of smells the same as what I’ve seen here.