RobotStudio event

How to select the testsignal you want to read using of EGM system?

Dear colleagues,

I stumbled upon a problem with acquisition of testsignals’ values using EGM system. The egm.protoc file contains message EgmTestSignals as an option in message EgmRobot. I created the C++ library from this file and wrote simple application for reading data from IRC5 controller. All data is read correctly except for testsignals. So I have a few questions. How to select the testsignal you want to read? Should I define it in some way in the controller’s program? What does the index mean in the signal method? Is it the number of testsignal, channel or axis?

If anyone knows anything about it, please help. I tried to define testsignals on different channels, but it didn’t result in a proper reading of data in my application. I checked if Tune Master and Test Signal Analyzer read these testsignals. Both of them were reading correct data. I would like to read the values of force control signals. Unfortunately I can’t use the EgmMeasuredForce message, because the data is transmitted only when the Force Control is active and the robot can’t be moved by activating Force Control.


if (pRobotMessage->has_testsignals())
	{	
		printf("Test_signals size=%d\n", pRobotMessage->testsignals().signals_size());
		for (int k= 0; k <1000; k++)
		{
			printf("Test_signals(%d)=%g\n", k + 1, pRobotMessage->testsignals().signals(k));
		}
		printf("\n");
	}
	else
	{
		printf("No measured signals\n");
	}
The above code checks 1000 indexes from the received EGM message. The results are in the file values_read_from_EGM.txt. None of the testsignal represent a reasonable value. For the comparison, the testsignals_vaules_from_RAPID.txt file contains the testsignal data read by the TestSignRead() RAPID function. I also attach my program to run EGM on the IRC5 controller bellow.

 PROC EGM_Stream_Test()
        
        FCDeact;
        TestSignReset;
        
        TestSignDefine 1,4000,ROB_1,1,0.1;
        TestSignDefine 2,4000,ROB_1,2,0.1;
        TestSignDefine 3,4000,ROB_1,3,0.1;
        TestSignDefine 4,4000,ROB_1,4,0.1;
        TestSignDefine 5,4000,ROB_1,5,0.1;
        TestSignDefine 6,4000,ROB_1,6,0.1;
        TestSignDefine 7,201,ROB_1,1,0.1;
        TestSignDefine 8,202,ROB_1,1,0.1;
        TestSignDefine 9,203,ROB_1,1,0.1;
        TestSignDefine 10,204,ROB_1,1,0.1;
        TestSignDefine 11,205,ROB_1,1,0.1;
        TestSignDefine 12,206,ROB_1,1,0.1;
        TestSignDefine 13,207,ROB_1,1,0.1;
        TestSignDefine 14,208,ROB_1,1,0.1;
        TestSignDefine 15,209,ROB_1,1,0.1;
        TestSignDefine 16,210,ROB_1,1,0.1;
        TestSignDefine 17,211,ROB_1,1,0.1;
        TestSignDefine 18,212,ROB_1,1,0.1;
        
         
        
        EGMStreamStop egmID1;
        EGMReset egmID1;
        EGMGetId egmID1;
        FCCalib EGMtoolF_LD;
        Open "HOME:", \File:= "test_signal_data.txt", file_ref \Bin;
        FOR k FROM 1 TO 18 DO
            testsignals_data{k}:= TestSignRead( k ) ;
            WriteStrBin file_ref,"Channel "+NumToStr(k,0)+ ": " + NumToStr(testsignals_data{k},4);
            WriteStrBin file_ref, "\0D";
        ENDFOR
        Close file_ref;
        
        !FCAct EGMToolF;
        myForceVector:=FCGetForce(\ContactForce);
        egmSt1:=EGMGetState(egmID1);
        TPWrite "EGM state: "\Num:=egmSt1;
        
        IF egmSt1 <= EGM_STATE_CONNECTED THEN
            ! Set up the EGM data source: UdpUc server using device "EGMsensor:"
            ! and configuration "default"
            EGMSetupUC ROB_1, egmID1, "default", "UCdevice"\pose;
        ENDIF
        
        EGMStreamStart egmID1;
        
        TPWrite "EGM state: "\Num:=egmSt1;
        IF egmSt1 <= EGM_STATE_RUNNING THEN
            TPWrite "EGM state: Running";
        ELSE
             TPWrite "EGM state: "\Num:=egmSt1;
        ENDIF
        WaitTime 15;
        EGMStreamStop egmID1;
        EGMReset egmID1;
        FCDeact;

    ENDPROC

Best Answers

Answers