Using Variables in Cell.src

  • Hi,
    I am fairly new to KUKA robot programming. I am trying to do something that seems straight forward, but...


    In some cases an axis ends up out of the valid range. For example, we may encounter a singularity which causes axis 4 to go to 185.5 degrees. Valid range is +/-185 degrees. In cell.src we call PTP $AXIS_ACT; but this gives us an error because it is outside the valid range. So, I implemented the following code:


    ;Move axis back in range if they are out of valid range
    ;Axis 1
    IF $AXIS_ACT_MEAS.A1 >= 170 THEN
    PTP {A1 167}
    ENDIF
    IF $AXIS_ACT_MEAS.A1 <= -170 THEN
    PTP {A1 -167}
    ENDIF
    ;Axis 2
    IF $AXIS_ACT_MEAS.A2 >= 45 THEN
    PTP {A2 42}
    ENDIF
    IF $AXIS_ACT_MEAS.A2 <= -190 THEN
    PTP {A2 -187}
    ENDIF
    ;Axis 3
    IF $AXIS_ACT_MEAS.A3 >= 156 THEN
    PTP {A3 153}
    ENDIF
    IF $AXIS_ACT_MEAS.A3 <= -120 THEN
    PTP {A3 -117}
    ENDIF
    ;Axis 4
    IF $AXIS_ACT_MEAS.A4 >= 185 THEN
    PTP {A4 182}
    ENDIF
    IF $AXIS_ACT_MEAS.A4 <= -185 THEN
    PTP {A4 -182}
    ENDIF
    ;Axis 5
    IF $AXIS_ACT_MEAS.A5 >= 120 THEN
    PTP {A5 117}
    ENDIF
    IF $AXIS_ACT_MEAS.A5 <= -120 THEN
    PTP {A5 -117}
    ENDIF
    ;Axis 6
    IF $AXIS_ACT_MEAS.A6 >= 350 THEN
    PTP {A6 347}
    ENDIF
    IF $AXIS_ACT_MEAS.A6 <= -350 THEN
    PTP {A6 -347}
    ENDIF


    When I run this code it errors with KSS 1443. This appears to be happening because the first axis move is relative. So, I wanted to use a variable to determine how far I needed to move my out of range axis. Something like:
    REAL MOVE_AXIS


    IF $AXIS_ACT_MEAS.A4 >= 185 THEN
    MOVE_AXIS=182-$AXIS_ACT_MEAS.4
    PTP {A4 MOVE_AXIS}
    ENDIF


    However, WorkVisual is not happy with this. Any ideas on how to move my axis back into a valid range before calling PTP $AXIS_ACT?


    Much Thanks!
    bwait

  • Hi
    Go to monitor> Variable> Signal> type "$softp_end[4]". this will show the software limit setting in the positive direction for A4 (for example current value is 180 change new value to 185). You can modify value if you require, just be sure that it is before the physical hard stops.


    you can then repeat this for $softn_end[4] for the axis travel in the negative direction A4 (for example if current value is -20 change new value to - 180). And just change the number inside the bracket for other axis. May be this helps :beerchug:

    Edited once, last by Captain ().

  • @Capitain:
    Are you sure, that extension of axis limits is good advice, especially A4? Robot can cut cables inside or damage other parts of A4 axis. This is the worse thing you can do, if you want to avoid singularities.


    bwait:
    You can declare AXIS or E6AXIS variable and write something like this:
    E6AXIS TEMP_POS


    For A1 axis:
    TEMP_POS=$AXIS_ACT
    IF $AXIS_ACT_MEAS.A1 >= 170 THEN
    TEMP_POS.A1=167
    ENDIF


    PTP TEMP_POS


    If you write something like this, you will program movement inside your limits.
    Don't expand your limits more, than you have in robot documentation, if you don't want to have mechanical and/or electrical problems with your mechanical unit.


    And one more thing. Cell.src is not runing continously and you can't avoid singularities and movements outside of limits in this way. Cell.src is normally selecting program to run, and when other program is running, your "rules" will not be executed. You have to avoid wrong positions during planning and programming your motions, not during program execution.

  • If the issue is wrist singularities, opening up the A4 and A6 soft-limits won't fix the problem -- it will merely let the axes get further before they fault. The real fix is, don't make motions through the singularity.


    Tecnically, A4 and A6 should (on most robots) be physically capable of endless rotation -- they have no hard stops. However, this can definitely create issues with any end-effector cabling that crosses over the wrist from the A3-A4 link to the A6 mounting flange.



    As Animisiewaz already pointed out, you can create an E6AXIS variable, modify it, then use that variable in a PTP command.
    Basically, motion commands (PTP, LIN, etc) cannot accept hard-coded Structures that contain variables inside the curly braces {}. So:

    Code
    DECL E6AXIS MultiAxisVariable
    DECL REAL SingleAxisPosition
    SingleAxisPosition=45.0
    MultiAxisVariable.A4=45.0
    
    
    PTP {A4 SingleAxisPosition} ; this is ILLEGAL
    
    
    PTP MultiAxisVariable ; this is LEGAL
  • Thank you Captain, SkyFire, & animisiewaz! I appreciate your replies!


    Based on your replies I understood my mistake and implemented the following code for axis 1:
    ;Axis 1
    IF $AXIS_ACT_MEAS.A1 >= 170 THEN
    PTP {A1 167}
    ENDIF
    IF $AXIS_ACT_MEAS.A1 <= -170 THEN
    PTP {A1 -167}
    ENDIF


    I have implemented similar code for all 6 axis and it works sometimes...


    When it does not work, it errors with "Impermissible start move." When I look at the axis value via the pendant it is very close to the limit (i.e. 170.26 for axis 1). Any ideas on why I am getting this error occasionally? With a value outside the limits I specified, I would think that it should move to 167 every time.


    Much Thanks!
    bwait

  • You don't distinguish jog and programmed motion. Programmed motion is only possible if axis is NOT at the limit (axis must be inside operating range).

    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

    Edited once, last by panic mode ().

  • "Impermissible start motion" usually occurs when you have not achieved BCO before running the programmed motion. This happens most often when a LIN motion is used before a PTP has been completed, but I've also seen it with PTP motions when the command position is not fully characterized. One (slightly risky) workaround is to perform a PTP $AXIS_ACT command, or a deliberate move to a fixed location (like $HOME) at the beginning of your program before attempting to use any of these "partial" PTP commands.

  • Thank you SkyeFire & panic mode for your replies!


    panic mode:
    I am a little confused. Sometimes the PTP command works to move the axis back in the valid range. Is this a problem because I am very close to the axis limit? It seems to be successful when I am further away from the axis limit (i.e. 172.5 when limit is 170). What would you suggest to do to handle this? My goal is to get the axis back in a valid range so PTP $AXIS_ACT does not give an error when executed.


    Skyfire:
    Originally I was calling PTP $AXIS_ACT when the axis was out of the valid range. This resulted in an error. So, I implemented the code to move the axis back into valid range before calling the PTP $AXIS_ACT command. Seems we have a chicken and an egg problem here. Any ideas on where to go from here?


    Thanks!
    bwait

  • Well, normally, you shouldn't even be able to reach (much less exceed) the Soft Limits programatically. Only by manually jogging. And in that case, it's a 'safety' requirement (machine safety, like BCO, rather than operator safety) for someone to manually jog the robot clear of the Soft Limits before programmed motion is allowed.

  • Thanks SkyeFire!


    I agree that normally you shouldn't even be able to reach the soft limits programmatically. We are using RSI to control the robot and sometimes we get into a singularity or go too fast towards a limit (and can't stop quickly enough) which is how we end up exceeding the software limits. We provide position data to the RSI interface and it calculates the associated angles and moves the robot to reach the requested position...


    Is it possible to programmatically change the axis limits? If so, I could change the limit(s), PTP $AXIS_ACT, move to a valid position inside the previous limits, & then reset my limit(s). I looked in the integrator manual and a few other places but can't find this anywhere.


    Thanks,
    bwait

  • It is possible. $SOFTx_LIMIT[ ] arrays are not write-protected from the program level.


    However, if you hit a limit, I'm not certain that you can recover automagically by opening the limit and then running PTP $AXIS_ACT -- once the fault is active, you may still be forced to manually clear the error in Teach mode. Since the soft limits are used to prevent equipment collisions, KUKA did not want to make it easy for people to cheat their way around them.


    A better approach might be to add PID elements to your RSI (not simple, I know) that "push" the axes away from the soft limits as they are approached. Ideally, these "pushbacks" would achieve equilibrium with your commanded motion before tripping the limit errors.


    Or an RSI safety cutout -- if any axis comes closer than 1deg to a limit, all the command inputs to the MOVECORR or AXISCORR objects are forced to 0, and an application error raised. Not exactly pretty, but it could avoid running right into the limits.


    Avoiding singularity over-speed is harder -- that might require tracking the realtime axis velocities for A4 and A6 into RSI, and applying negative gain to the RSI motion command inputs as those axes approach their velocity maxima.

    Edited once, last by SkyeFire ().

  • Thanks Skyefire!


    We are on the same wavelength. I am currently pursuing all of your suggestions (or at least something very similar).


    Thanks,
    bwait

Advertising from our partners