16.11.2021, 18:41
(This post was last modified: 16.11.2021, 18:45 by Erwin van der Zwart.)
That is logical behavior, if you write to the switch object for example 1/1/1 and your feedback is 1/2/1 then you need to know the value of 1/2/1 before writing to 1/1/1..
grp.checkwrite checks in this case the internal value of the controller of 1/1/1 so the last sended value and this does not check the actual value of the feedback object 1/2/1.. the same counts for Daniels solution, this will get the value of 1/2/1 but writing to 1/1/1 does not change by it.
What you might want to do is send write always to the bus and use grp.write.
If you want to make the write depending on the feedback you need to send the feedback cyclic from the actuator, and make in your script a condition where you compare 1/2/1 with the new value you want to write to 1/1/1.
grp.checkwrite checks in this case the internal value of the controller of 1/1/1 so the last sended value and this does not check the actual value of the feedback object 1/2/1.. the same counts for Daniels solution, this will get the value of 1/2/1 but writing to 1/1/1 does not change by it.
What you might want to do is send write always to the bus and use grp.write.
If you want to make the write depending on the feedback you need to send the feedback cyclic from the actuator, and make in your script a condition where you compare 1/2/1 with the new value you want to write to 1/1/1.