I would like to get integer data from a PLC (Twincat) via SimPro in OfficeLite. It is clear to me that such questions are not welcome here, but unfortunately the Kuka Support could not help me.
I wanted to link a server int variable to an int signal of the robot component, convert it into bits with Python and write it individually on the inputs in the robot executor, should that be possible ?
Would appreciate help …
I don’t really get what part does OfficeLite play in this, but yes you should be able to use Connectivity to read some integer variable from TwinCAT using either the Beckhoff ADS or OPC UA and get the value to an integer property or signal in VC.
Then you’ll need to have a Python script register to value change event of that signal or property, extract the bits and trigger Boolean signals connected to a signal map. I don’t remember now but there might also be a method in the signal map API to trigger / signal a port directly.
One caveat to remember is that VC Integer signals and properties are 32-bit signed so you shouldn’t connect a 32-bit unsigned variable to them or it can overflow.
What role do the listeners play in the signals, are these basically change events?
Can I leave it blank if I use an OnValueChange event in the Python script?
There are two functions with the BooleanSignalMaps, I tried it with output () because I can use true / false with it, setPortSignal () probably only works with a vcBooleanSignal.
So if that should work in principle I have to try again tomorrow … thanks.
I have another question, is it possible to change signals from a Python script in a vcBooleanSignalMap that is defined as digital inputs in a robot executor ?
I cant get it working…thanks.
I don’t see why not. You’ll probably need to have a Boolean signal behaviour assigned to each signal map port you want to use and then trigger the signal behaviour ( mySignal.signal(val) ) for it to work.
Note that if you connect signal map ports using the signal connections UI, it will actually create hidden signal behaviours (and interfaces) for you. You can still access those hidden behaviours through API.
I actually want to convert integer or string variables into bits and write them directly to the inputs of the robot executor, preferably without a connection, something like this:
def OnSignal( signal ):
bits = format(signal.Value, '016b')
i = 1
for b in bits:
But it looks like you cannot change the inputs directly and only linked outputs.
What is the difference between these two variants:
As far as I know the robot controller behaviour doesn’t really have any separate inputs or outputs that would work independently. It just has Boolean signal maps associated to it and signal maps are just holders for signal behaviours i.e. the ports don’t function without having separate signals in them.
The whole truth might be more complicated than that but I think your issue is you are trying to avoid creating signal behaviours for each of your inputs and that won’t work. Just create the boolean signals for each input port you actually use, assign them to the signal map and then trigger the signals and it should work fine.
Ok thanks, then I have to make it the hard way, maybe I can automate some of it because I have a lot of data to link, hopefully there will be no performance problems with hundreds of connections in the end.