Hello VC Team!
I am using KUKA.Sim, and I am currently facing an issue with data exchange between the variables in the Properties and the variables in the KRL file within the PROGRAM.
Ultimately, what I want to achieve is to communicate with an external system via OPC UA while KUKA.Sim is executing a KRL program, so that I can receive real-time data from the external source and assign it to the variables in the KRL program.
For example, I want to receive the TCP coordinates of the robot through OPC UA and assign them to a variable ‘Pos’ declared in the KRL program, and then generate KRL commands to move the robot to that TCP. As far as I know, it is not possible to directly access the variables in a KRL program through OPC UA, so I am trying to declare variables in MODELING → Properties and link them with the KRL program variables, but I am unsure of how to do this.
Could you please let me know if there is a method for this, whether it be through the Python API or any other approach? Additionally, if there is a better way to establish real-time communication with an external system during the execution of a KRL program, I would appreciate your advice.
Thank you @ChrisS !
I really appreciate you taking the time to respond. Unfortunately, the solution you provided is something I have already looked into through the same YouTube clip, so it addresses issues I had already resolved. What I’m truly looking for is to control the global variables I declared in KRL Program via OPC UA when the KRL program runs under the PROGRAM section of KUKA.Sim.
To explain with an example: in the KRL program, I want to use global variables like REAL COM_VALUE4 = 0 and DECL E6AXIS COM_E6AXIS, which I’ve already declared in the $config.dat file, and I want to be able to manipulate these variables when the KRL program runs. Specifically, I want to communicate with these global variables via OPC UA. Ultimately, while a loop-type KRL program is running, I would like to assign specific values to the pre-declared COM_E6AXIS KRL global variable through OPC UA communication, and then use COM_E6AXIS to generate KRL motion commands.
If you need further clarification, please feel free to ask. I’m really eager to solve this issue.
As of right now there is no direct interface to do this. You can only connect Boolean IOs to the robot as far as I know. But you are able to configure signal variables on KRL side by grouping such Boolean inputs. I think this approach could also work for OPC UA variables.
Check out this post, which shows a very basic example on how to define such signals (Send_Value_Robot_To_Robot.vcmx)
Hi @mastu!
I have applied the solution you provided right away. As a result, I was able to establish communication via OPC UA → Signal (boolean) → $config.dat, but there is still a critical issue remaining. I don’t want to only handle the Boolean variable type in the config.dat, but also other variable types like Real, so I can assign values related to coordinates to the variables in config.dat.
The method you suggested only allows communication of true/false values, which does not meet my needs. Additionally, based on my research, KUKA Signals can only be set as Boolean. I would like to know if there is a way to use Real signals instead of just Boolean signals.
Additionally, if my explanation was unclear, please let me know. Once again, thank you for your help.
Hi @jaehong,
good to hear that it worked out so far. You can check out the second example of the post I mentioned above (16bit_Real_Signal_Sensor_Example).
In that example you will find a signal decleration in the config.dat where 16 boolean signals are grouped so that they are interpreted as an integer value. After that the integer is divided by 10 in the robot program to “cast” it to a real value. So this certainly is a workaround which will be quite extensive if you want to connect a lot of int/real “signals” with the robot.
If anybody knows a better approach I would also be very eager to see the solution.