RobotStudio event

How to make a record

Hello 

We have an assignment for school. We want to create a record with multiple data for the height of an object, to see if the object is there, the point where to pick the object up, the color of the object and if the object is a pass or a fail.This is our code but we constantly get an error on line 5

MODULE MainModule
PROC main()

         RECORD Marker1
            !point112; -> this is the point where the Marker is 
            bool booisthere:=0; -> this if to see if the object is there
            !AI_SensorSick 
            num numheight:=5; -> this is to know the height
            bool boolcolor:=0; -> this is to know the color is wright
            bool boolbadpiece:=0;  -> this is to know if the piece passes or fails
         ENDRECORD   
ENDPROC
     
ENDMODULE

Can somebody help us?
Arne

Answers

  • soup
    soup ✭✭✭
    MODULE exampleModule
       
        RECORD exampleRecord
            string aName;
            num aNumber;
            dnum aDNumber;
            pos aPos;
            pose aPose;
            robtarget aRobtarget;
            jointtarget aJointtarget;
        ENDRECORD
       
        PERS exampleRecord exampleArray{5}:=
                                               [["string1", 1, 10, [10,0,0], [[1,0,0],[1,0,0,0]], [[1,0,0],[1,0,0,0],[1,1,0,0],[11,12.3,9E9,9E9,9E9,9E9]], [[1,0,0,0,0,0],[0,9E9,9E9,9E9,9E9,9E9]]],
                                                ["string2", 2, 20, [20,0,0], [[2,0,0],[1,0,0,0]], [[2,0,0],[1,0,0,0],[1,1,0,0],[11,12.3,9E9,9E9,9E9,9E9]], [[2,0,0,0,0,0],[0,9E9,9E9,9E9,9E9,9E9]]],
                                                ["string3", 3, 30, [30,0,0], [[3,0,0],[1,0,0,0]], [[3,0,0],[1,0,0,0],[1,1,0,0],[11,12.3,9E9,9E9,9E9,9E9]], [[3,0,0,0,0,0],[0,9E9,9E9,9E9,9E9,9E9]]],
                                                ["string4", 4, 40, [40,0,0], [[4,0,0],[1,0,0,0]], [[4,0,0],[1,0,0,0],[1,1,0,0],[11,12.3,9E9,9E9,9E9,9E9]], [[4,0,0,0,0,0],[0,9E9,9E9,9E9,9E9,9E9]]],
                                                ["string5", 5, 50, [50,0,0], [[5,0,0],[1,0,0,0]], [[5,0,0],[1,0,0,0],[1,1,0,0],[11,12.3,9E9,9E9,9E9,9E9]], [[5,0,0,0,0,0],[0,9E9,9E9,9E9,9E9,9E9]]]];
                                               
        PROC main()
           
            FOR i FROM 1 TO Dim(exampleArray,1) DO
                TPErase;
                TPWrite exampleArray{i}.aName;
                TPWrite NumToStr(exampleArray{i}.aNumber,0);
                TPWrite DNumToStr(exampleArray{i}.aDNumber,0);
                TPWrite ValToStr(exampleArray{i}.aPos);
                TPWrite ValToStr(exampleArray{i}.aRobtarget);
                TPWrite ValToStr(exampleArray{i}.aJointtarget);
                WaitTime 1;
            ENDFOR

        ENDPROC

    ENDMODULE

  • Thank you very much !!!!