Read servo position with PLC

How can I read the position of a servo controller in order to relay it back to a PLC via a signal?

I can use the getJointValue method to return the position in Python, but I am struggling to then assign this to a signal so a PLC can read it.

Thanks

I read the value of the servo position and convert it to an int. Then I print assign the value to the signal. I print both the signal value and the signal object itself to verify it still exists.
image
image
But on the connectivity tab, the value is always only 0

Hy,

Hmmm could it be that you map an PLC Output to your Signal? And could it be that the PLC overwrites its value cyclic?

Regards
Feature

1 Like

In your script you are not using vcSignal.signal(newValue) but instead assigning to the .Value property which does not trigger the signal.

1 Like

Hy,

Ui jes, I thought too complicated… :face_with_spiral_eyes:

1 Like

Yes, this was my problem.

I was trying to assign the value of signals using: Load.Value = True
The correct way to do it is Load.signal(True)
(Just in case anyone comes looking for the same answer)