memory, flag, cyclic flag

  • Hi,
    I wanna to mark a position.
    ---when comes to the point (abcdp5) I need to activate and another bool output.
    ---how to take out a boolean signal as soon as the robot comes to the point.
    ---Can I use a flag or cyclic flag or dummy variable? I am sure about the difference between flag, cyclic flag and dummy variable? can you please tell the difference? :help:
    GLOBAL DEF ABC()
    .
    .
    .
    PTP ABCDP5 ;(when the robot reached this point I need to send out a boolean signal)
    DUMMY_VARIABLE=TRUE ;(?????will this work or with flag is better, is that when robot moves from abcdp5... dummy_variable will be false)
    .
    .
    END


    GLOBAL XYZ()
    .
    .
    .
    IF (DUMMY_ VARIABLE == TRUE) THEN ;(i am using that dummy_variable here from abc()
    CYLINDER FORWARD == TRUE
    END IF
    .
    .
    END


    hope i have explained. If you not clear plz reply. I can also explain more. can you please help.
    Thank you. waiting for your reply. thank you :merci:

  • you need to declare variable before you can use it. there are different places where variables can be declared and this will determine scope - local or global. if you want convenience of monitoring variable and being able to access it from other programs, you will want it to be global.


    simplest way to make variable global is to declare it in $config.dat, preferably under USER section.
    the other easy way is to make own data list:
    - login as expert
    - create a new program such as myGlobals, note: make sure to select Expert module (creates SRC and DAT files)
    - delete SRC file as it is no longer needed (this way you can open it later on when not Expert)
    - declare your variables (unlike declaring them in $config.dat, here you need to use keyword GLOBAL)


    example:

    Code
    DECL GLOBAL BOOL myFlag = false
    DECL GLOBAL BOOL cylExtended = false
    DECL GLOBAL INT myCounter = 0
    DECL GLOBAL REAL offeset = 50.0 ; mm


    you may also omit initialization ( "= value" part) if you like. this way value will not be retained when you reboot. if initialized here, then value will be stored and you can check it out later on. you can still choose if you want to clear or initialize them on program start (normally in the INI section of a program).

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Thank you for your reply. The problem is, I need to activate a signal after the robot reaches point abcdP5. so here should i use dummy variable or flag or cyclic flag?????
    what is the difference between flag and cyclic flag?

  • Hi,
    $flag[] - systems variable, that change by command in a program.
    Example:
    PTP p1
    $flag[1]=true
    IF $flag[1]==true THEN
    PTP HOME
    ENDIF


    $cycflag[] declared one time and is cyclically active at the robot level
    only.
    Example:
    $cycflag[1]=$in[1] and $in[13] ;declaration cycle flag. Boolean expression is cyclically
    evaluated and updated.


    IF $cycflag[1]==true THEN
    PTP HOME
    ENDIF


    If need to activate signal after reach point usually use variable.


    PTP p1
    DUMMY_VARIABLE=TRUE
    ;variable still active
    PTP p2

  • Hi Forgeur,
    Thank you for your reply :merci:.
    As far I understood your reply.
    $Flag[1]= will be true as soon the robot comes to point p1. what will happen to this falg1, if the robot moves to to next point p2? Is that $Flag[1] will be true? :help:when will falg[1] will turn false? :help: For making this Flag[1] false should I have again make it false? :help:


    $cycflag will be true as the two inputs will be true and it will false if any of the one signal is false. :help:


    PTP p1
    DUMMY_VARIABLE=TRUE
    PTP P2 , As soon as the robot reaches P1 the dummy variable will be true. What will happen to this variable(dummy_variable) if the robot goes to point P2? when will this variable dummy_variable will be false? :help:


    Thank you :merci:

  • what will happen to this falg1, if the robot moves to to next point p2?
    flag[1] will be true until execute the new command $flag[1]=false.


    $cycflag will be true as the two inputs will be true and it will false if any of the one signal is false.
    Yes.


    What will happen to this variable(dummy_variable) if the robot goes to point P2
    Variable will not changes.
    Variables can be change only any command. :justice: Or reboot system when a variable didn't declare in dat file (look post panic mode).

Advertising from our partners