Help with INTP-322 Alarm code

  • Dear All,


    I wrote a Karel program that receives joint angles via TCP/IP protocol and moves the robot to desired position, which is working fine. Then I copied the same code and saved with other name. Now strange thing is that when I run the new program, it throws INTP-322 Alarm code with line number. Below is the code.


    CNV_REL_JPOS(j,act_jnt,stat)


    Even I have checked the variables by writing them to user panel, all of them are initialized properly.


    Now my question is that why I am getting Alarm code, while the exactly same code is running without having any problems in other program.


    Could any one help me to understand and resolve this issue. By the way I am working with R-30iA controller.


    Thanks for your time in advance.


    Regards,
    Naresh

  • Place your Ad here!
  • The description for the error is "KAREL program error. The argument value of a built-in routine was wrong."


    Are you executing the program on the very same controller as the older version?
    Are the variable definitions in the same .KL file as the rest of the program? Have you copied them together with the rest of the source code?

  • Hello bidzej,


    First of all thanks for your reply.


    Yes I am running the both programs on the same controller. variables are also same. Basically It is the same code, the only difference is change in program name.


    Regards,
    Naresh

  • Interesting... Are all the variables local, or does anything come from another program (FROM: instruction after the definition)?
    I have no sensible idea why this could happen :hmmm: Would be best if you could post the whole code here...

  • Hello bidzej,


    yes, all the variables are local. Here is the sample code


    PROGRAM manlmode
    %NOLOCKGROUP
    VAR
    comm_port : FILE
    j : ARRAY[6] OF REAL
    stat : INTEGER
    jnt : JOINTPOS
    vel_ : REAL
    jnt1 : STRING[14]
    test : STRING[54]
    xj, yj, zj, rxj, ryj, rzj, id,vels : STRING[15]
    CONST

    BEGIN

    MSG_DISCO('S3:',stat)
    MSG_CONNECT('S3:',stat)
    OPEN FILE comm_port('rw','S3:')

    RUN_TASK('MOVEJ',0,TRUE,TRUE,1,stat)

    START_LOOP ::

    READ comm_port (id::0::2)
    READ comm_port (xj::0::2)
    READ comm_port (yj::0::2)
    READ comm_port (zj::0::2)
    READ comm_port (rxj::0::2)
    READ comm_port (ryj::0::2)
    READ comm_port (rzj::0::2)
    READ comm_port (vels::0::2)
    WRITE('id:',id, CR)


    CNV_STR_INT(id,cur_id)

    IF(cur_id = 2) THEN

    CNV_STR_REAL(xj, j[1])
    CNV_STR_REAL(yj, j[2])
    CNV_STR_REAL(zj, j[3])
    CNV_STR_REAL(rxj, j[4])
    CNV_STR_REAL(ryj, j[5])
    CNV_STR_REAL(rzj, j[6])
    CNV_STR_REAL(vels,vel_)
    WRITE('vel:',vel_,CR)

    CNV_REL_JPOS(j,jnt,stat)
    SET_JPOS_REG(1,jnt,stat)

    ENDIF

    DELAY (50)
    GO TO START_LOOP
    END manlmode

  • ok, try changing the definition of the variable j from ARRAY[6] OF REAL to ARRAY[9] OF REAL - the length of the array must be equal or greater than the number of joints in the system, and 9 is the default value...

  • I even tried that, but it didn't work. I still have the same alarm code :wallbash:. Its really very strange that old application is working but not new one. I need these two applications because user should able to select from one of these two applications to move the robot either in manual mode or in auto mode.


    RUN_TASK('MOVEJ',0,TRUE,TRUE,1,stat)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners