 Programm
   Variablen-Setup
   Roboterprogramm
     GRIPLINK CONNECT
     Aufruf HOME_Port_0_to_2
     Aufruf GRIP_Port_0_to_2
     Aufruf WSTR_and_Get_Dev_State
     Aufruf Check_S_HOLDING
     Aufruf RELEASE_Port_0_to_2
     Aufruf WSTR_and_Get_Dev_State
     Aufruf Check_S_RELEASED
   HOME_Port_0_to_2
     'Home grippers on ports 0-2'
     GRIPLINK HOME
     GRIPLINK HOME
     GRIPLINK HOME
   Enable_Port_0_to_2
     'Enable grippers on ports 0-2'
     GRIPLINK ENABLE
     GRIPLINK ENABLE
     GRIPLINK ENABLE
   DISABLE_Port_0_to_2
     'Disable grippers on ports 0-2'
     GRIPLINK DISABLE
     GRIPLINK DISABLE
     GRIPLINK DISABLE
   GRIP_Port_0_to_2
     'Grip on ports 0-2'
     GL_GRIP(0, 0, 0, "sock_griplink")
     GL_GRIP(1, 0, 0, "sock_griplink")
     GL_GRIP(2, 0, 0, "sock_griplink")
   WSTR_and_Get_Dev_State
     'Wait for each gripper to finish (WSTR), then read and store its DEVSTATE for evaluation'
     GRIPLINK GET DEV STATE
     GRIPLINK GET DEV STATE
     GRIPLINK GET DEV STATE
   Check_S_HOLDING
     'Global constants mapping numeric device states (0-7) to readable names'
     'S_HOLDING = 5, S_NO_PART= 4 and S_RELEASED = 3'
     If Dev_State_Port0 ≟ S_HOLDING  and Dev_State_Port1 ≟ S_HOLDING  and  Dev_State_Port2 ≟ S_HOLDING
       'All grippers are in S_HOLDING (5)'
     ElseIf Dev_State_Port0 ≟ S_NO_PART  and Dev_State_Port1 ≟ S_NO_PART  and  Dev_State_Port2 ≟ S_NO_PART
       'All grippers are in S_NO_PART (4)'
       Meldung: No workpiece detected at grip points
       Halt
     ElseIf Dev_State_Port0 ≟ S_NO_PART  or Dev_State_Port1 ≟ S_NO_PART  or  Dev_State_Port2 ≟ S_NO_PART
       Meldung: At least one gripper reported S_NO_PART (4). Check workpiece position
       Halt
     Else
       Halt
   Check_S_RELEASED
     'Global constants mapping numeric codes (0-7) to readable names'
     'S_HOLDING = 5, S_NO_PART= 4 and S_RELEASED = 3'
     If Dev_State_Port0 ≟ S_RELEASED  and Dev_State_Port1 ≟ S_RELEASED  and  Dev_State_Port2 ≟ S_RELEASED
       'All grippers are in S_RELEASED (3)'
       Meldung: All grippers are released
     ElseIf Dev_State_Port0 ≠ S_RELEASED  or  Dev_State_Port1 ≠ S_RELEASED  or  Dev_State_Port2 ≠ S_RELEASED
       Meldung: Release not completed on all grippers.
     Else
       Halt
   RELEASE_Port_0_to_2
     'Release on ports 0-2'
     GRIPLINK RELEASE
     GRIPLINK RELEASE
     GRIPLINK RELEASE
