Sorry I don't know, I'm no expert on VAL3 alter command.
I do not have a recent VAL3 manual that identifies error code -2.
VAL3 Ref Manual states that the alter function is an option.
Perhaps your controller does not have that alter option installed.
Best path forward is to contact Staubli Applications Engineering Support for answers.
Other than that, some suggestions for your code:
- after enable power, you should put in a wait until powered command, issue an error if not enabled in sufficient time.
- if I was using enable, I would probably start a 2nd task with the purpose of reading & processing your TCP control input signals, then setting appropriate trsf variables. Set in a do-while loop. Then enable this process loop when the altering process starts, bypass the loop when not altered.