RobotStudio event

Conveyor Tracking in IRC5 with IRB 360 - objects does not connect with "WaitWojb"

Options
I am trying to set up IRB 360 robot for conveyor tracking, using the option "conveyor tracking" and I am using our own camera system, where we process the images getting from the conveyor through a detection algorithm running in Python and send the selected coordinates to the robot controller via a socket communication. 
I have set up the CTM module, and encoder properly as described in the catalogue, but still struggling to properly do the conveyor tracking process. 

Simply the process does not proceed after the "WaitWobj" instruction and my object does not get connected for tracking. The following is the simple code I used for this and would be glad to have your insights to rectify this issue.

Thanks. 



MODULE MainModule
    
CONST robtarget p10:=[[347.89,-14.07,-8.29],[0.0944229,0.000809102,-0.00206603,-0.99553],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS wobjdata ConveyorTest:=[FALSE,FALSE,"CNV1",[[0,0,0],[1,0,0,0]],[[-1.10085,-59.0968,-1371.1],[0.66196,0.00689091,0.00729099,0.749472]]];
!PERS wobjdata ConveyorTest:=[FALSE,FALSE,"CNV1",[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
CONST wobjdata ConveyorTest1:=[FALSE,TRUE,"",[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
VAR socketdev server_socket;
VAR socketdev client_socket;
VAR string HOST :=  "192.168.125.1";
VAR num PORT := 5050;
VAR string receive_string;
VAR socketdev my_socket;
VAR num retry_no := 0;
VAR Bool SocketAccepted;

!From Camera Variables
VAR bool flag1;
VAR Bool ok;
VAR Bool okConverter;
VAR pos RawData;
VAR string RecievedString;
VAR pos data1;
VAR pos sending_pos;
VAR pos test_point;
VAR pos picking_string;

VAR num N_CurrentDataX;
VAR num N_CurrentDataY;
VAR num N_CurrentDataZ;

VAR num N_PreviousDataX;
VAR num N_PreviousDataY;
VAR num N_PreviousDataZ;

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!SETTINGS!!!!!!!!!!!!!!!!!!!!!!!!
! Working Area Data

CONST num OffsMinX := 200;
CONST num OffsMinY := 200;
CONST num OffsMinZ := 5;
CONST num OffsMaxX := 200;
CONST num OffsMaxY := 200;
CONST num OffsMaxZ := 5;

! Speed Data





VAR Bool B_Status;
CONST robtarget p20:=[[17.99,-32.40,164.96],[0.00062604,0.0960109,0.99533,-0.0100126],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PickSafe:=[[17.96,-32.40,164.65],[0.000626221,0.0960292,0.995328,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
        
CONST robtarget PickAbove:=[[17.96,-32.39,92.39],[0.000626581,0.096065,0.995324,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PickPos:=[[17.58,-21.41,33.19],[0.000625441,0.0959516,0.995335,-0.0100126],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PickAbove2:=[[17.96,-32.39,92.39],[0.000626581,0.096065,0.995324,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PickPos2:=[[17.58,-21.41,33.19],[0.000625441,0.0959516,0.995335,-0.0100126],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];        
CONST robtarget PickAbove3:=[[17.96,-32.39,92.39],[0.000626581,0.096065,0.995324,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PickPos3:=[[17.58,-21.41,33.19],[0.000625441,0.0959516,0.995335,-0.0100126],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];        
CONST robtarget PickAbove4:=[[17.96,-32.39,92.39],[0.000626581,0.096065,0.995324,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PickPos4:=[[17.58,-21.41,33.19],[0.000625441,0.0959516,0.995335,-0.0100126],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];        
             
        
CONST robtarget PlaceSafe:=[[39.12,277.34,146.29],[0.000626221,0.0960292,0.995328,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PlaceAbove:=[[17.42,525.09,178.64],[0.000626221,0.0960292,0.995328,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget PlacePos:=[[17.42,525.08,77.37],[0.000626341,0.0960411,0.995327,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget Place_close_conveyor:=[[75.10,-19.06,24.15],[0.000627001,0.0961067,0.99532,-0.0100125],[0,1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    
    

    PROC main()
        
        ! Create, bind, listen and accept of sockets in error handlers   
        waittime 0.5;
        SocketClose server_socket;
        SocketClose client_socket;
        SocketCreate server_socket;
        SocketBind server_socket, HOST, PORT;
        SocketListen server_socket;
        SocketAccept server_socket, client_socket\ClientAddress:=client_ip;

        AutoCycle:
        !server_messaging;
        SetDO DO_BlowerVSD,1;
        ActUnit CNV1;
        ConfL\off;
        SetDO DO_ConveyorRun,1;
        
        !setDo DO_TrackSync,1;
        P_CameraSequence;
        P_Place;
    
        GOTO AutoCycle;     
        
    ENDPROC
 
    
    PROC P_Pick()  
        
        WaitWObj ConveyorTest\RelDist:=0.5;
        MoveJ PickSafe, v2000, z50, Gripper\WObj:=ConveyorTest;    
        MoveL Offs(Place_close_conveyor, picking_string.x,picking_string.y, picking_string.z) , v1000, z50, Gripper\WObj:=ConveyorTest;
        SetDO DO_VacuumSol, 0;
        waittime 0.5;
        
            
        
    ENDPROC   
 
    PROC P_Place()
        
        MoveJ PlaceSafe, v2000, z50, Gripper\WObj:=ConveyorTest;    
        MoveL PlaceAbove, v2000, z5, Gripper\WObj:=ConveyorTest; 
        MoveL PlacePos, v2000, z0, Gripper\WObj:=ConveyorTest; 
        SetDO DO_VacuumSol, 1;
        WaitDI DI_PressureSW,0;
        MoveL PlaceAbove, v500, z50, Gripper\WObj:=ConveyorTest; 
        MoveJ PlaceSafe, v500, z50, Gripper\WObj:=ConveyorTest;   
        
    ENDPROC  



    PROC P_CameraSequence()
        
        StartTransfer:

        WHILE receive_string <> "PhotoTaken" DO
            SocketSend client_socket \Str := "TakePhoto";
            SocketReceive client_socket \Str := receive_string;
            waittime 0.5;

            okConverter := StrToVal(receive_string,picking_string);
            !SetDo DO_TrackSync,1;
            waittime 0.5;
            !SetDo DO_TrackSync,0;
            
            P_Pick;
            P_Place;
        
        ENDWHILE

    ENDPROC
   
    

ENDMODULE