Access $SYSTEM_TIMER in Karel

  • Hi everybody,

    I am looking for a way to count the time when the servos of my robot are on. I found the $SYSTEM_TIME[1].SRV_TOT variable that would do the job but I can't access this variable with my Karel program. I am on a R30iB mini plus controler.


    Thanks!


    :smiling_face:

  • Here is my Karel code:


    IF Day <> $SYS_TIME.$DAY THEN


    IF $SYSTEM_TIME[1].SRV_TOT - Memo_SRV_TIME > 480 THEN

    TIMER_DAY[i] = $SYSTEM_TIME[1].SRV_TOT - Memo_SRV_TIME - 480

    ELSE

    TIMER_DAY[i] = 0

    ENDIF


    Memo_SRV_TIME= $SYSTEM_TIME[1].SRV_TOT

    i=i+1

    ELSE

    Day = $SYS_TIME.$DAY

    ENDIF





    And this is the error:



    C:\Users\NMARILLE\Documents\My Workcells\Arvis2\loc_timer.kl(45)

    45 IF $SYSTEM_TIME[1].SRV_TOT - Memo_SRV_TIME > 480 THEN

    ^ ERROR

    Id must be defined before this use. Id: $SYSTEM_TIME


    thanks

  • Hello HawkME,


    I still have the same error, and in my program $SYSTEM_TIME[1].$SRV_TOT is not written in yellow like other system variables.


    Do you have an idea?

Advertising from our partners