Movement control on a line in the program

  • Hello every body,


    I have this loop:

    " while nNbPrisesAEff>nNbPrisesEff

    //appel trajs

    call T_Prise()

    call T_Depose(0)

    endWhile "


    At the end of T_depose, i have:

    " nMoveIdDegDep=movel(compose(pDep2,world,{150,0,0,0,0,0}),tPic,mDegL_H)

    break

    endSwitch

    // attente dégagement degagement depose pour declarer fin depose

    wait(getMoveId()>=nMoveIdDegDep) "


    The problem is that, despite of " wait(getMoveId()>=nMoveIdDegDep) ", the controller does several loop like if the instruction getMoveId does not exist.

    The only way to avoid that is to put a WaitEndMove() instruction. But it generates stop point that causes loss of time...


    How can i do plz ?

  • Hello,

    You have different other "Case" in "T_Depose".

    Are you sure that the line "nMoveIdDegDep=..." is executed.

    Can you controle the value of "nMoveIdDegDep" when the robot execute the loops ?


    To debug, you can :

    - Use the debug mode to control which instruction are executed.

    - Create an independant task to memorise the value of "getMovveId"


    ... Pas de soucis pour l'aide :smiling_face:

  • Hi, the condition wait(getMoveId()>=nMoveIdDegDep) is always true.

    The getMoveId will be always between the current movement, nMoveIdDegDep + .xx, which xx is the percentage of completion, example, if nMoveIdDegDep=10, getMoveID could be 10.52 if it is at 52% of completion.

    You need to add something to stop it!


    Example: wait(getMoveId()>=nMoveIdDegDep+0.5), it will wait until complete 50% of the move!

  • Hello,


    Thks for the reply.


    Are you sure that the line "nMoveIdDegDep=..." is executed. >>see below

    Can you controle the value of "nMoveIdDegDep" when the robot execute the loops ? >> i already used it in a another task to monitor a part counting when the part is placed and it works well


    To debug, you can :

    - Use the debug mode to control which instruction are executed. >> so i have tested with the debug mode and the execution seems correct...

    - Create an independant task to memorise the value of "getMovveId" >>I have to do...



    Here is the entire code of T_Depose:


    " switch x_nNumDepose

    case 1

    // vers dépose 1 = côté aval rivière

    movel(compose(pDep1,world,{150,0,0,0,0,0}),tPic,mAppL_H)

    if nNumTrajEc==nTRAJ_APP_DEP1 >>only in manual mode<<

    movel(pDep1,tPic,mArret)

    call PauseToTeachPt("Apprentissage Point dépose 1","Vérifier/teacher le point")

    else

    movel(pDep1,tPic,mFinL_H) >>only in automatic mode<<

    endIf

    movej(appro(pDep1,{0,0,-nCoteDegDevetisseur,0,0,0}),tPic,mFinJ_V)

    nMoveIdDegDep=movel(compose(pDep1,world,{150,0,0,0,0,0}),tPic,mDegL_H)

    break

    case 2

    // vers dépose 2 = côté amont rivière

    movel(compose(pDep2,world,{150,0,0,0,0,0}),tPic,mAppL_H)

    if nNumTrajEc==nTRAJ_APP_DEP2 >>only in manual mode<<

    movel(pDep2,tPic,mArret)

    call PauseToTeachPt("Apprentissage Point dépose 2","Vérifier/teacher le point")

    else

    movel(pDep2,tPic,mFinL_H) >>only in automatic mode<<

    endIf

    movej(appro(pDep2,{0,0,-nCoteDegDevetisseur,0,0,0}),tPic,mFinJ_V)

    nMoveIdDegDep=movel(compose(pDep2,world,{150,0,0,0,0,0}),tPic,mDegL_H)

    break

    endSwitch

    // attente dégagement degagement depose pour declarer fin depose

    wait(getMoveId()>=nMoveIdDegDep)

    waitEndMove() "

  • Hi, the condition wait(getMoveId()>=nMoveIdDegDep) is always true.

    The getMoveId will be always between the current movement, nMoveIdDegDep + .xx, which xx is the percentage of completion, example, if nMoveIdDegDep=10, getMoveID could be 10.52 if it is at 52% of completion.

    You need to add something to stop it!


    Example: wait(getMoveId()>=nMoveIdDegDep+0.5), it will wait until complete 50% of the move!

    I am going to test that.

    Thanks.

  • Hello,

    Your program is correct but you call the program with the value 0 (call Depose(0)).

    In your program, you don't test this value in the Switch case.

    The value of nMoveIdDegDep keep the last value ( probably a low value, less than getMoveId).

    CQFD


    1- Change the call function if 0 is wrong.

    2- Test always all the values in your Switch function , for example :

    switch x_nNumDepose

    case 1

    // vers dépose 1 = côté aval rivière

    //...

    nMoveIdDegDep=movel(compose(pDep1,world,{150,0,0,0,0,0}),tPic,mDegL_H)

    break


    case 2

    // vers dépose 2 = côté amont rivière

    //...

    nMoveIdDegDep=movel(compose(pDep2,world,{150,0,0,0,0,0}),tPic,mDegL_H)

    break

    default

    // Defaut de parametre

    wait(false)

    break

    endSwitch


    Best regards

    Edited once, last by Galet ().

Advertising from our partners