1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. Fanuc Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

Abort the current motion and return home with a DI?

  • gpunkt
  • November 16, 2023 at 9:17 AM
  • Thread is Unresolved
  • Online
    gpunkt
    Reactions Received
    119
    Trophies
    6
    Posts
    456
    • November 16, 2023 at 9:17 AM
    • #1

    Hi,
    Need to know the best way to accomplish the following function:

    *CRX-robot (with Mini Plus controller)
    *Robot performs a slow linear motion over a relative large distance

    *Robot is in Local mode (as opposed to Remote -controlled through UOP)

    I would like to, at the push of a button (connected to a DI in the controller), abort the current motion and call a homing routine.

    This cannot be done with a Macro (Motion Group is already locked by another task), nor with a Monitor/Condition solution.

    I don't want to split the motion up into smaller increments, and check for this button to be pushed after each motion instruction (too much coding and not a general solution).

    Is my only choice to switch over to Remote and start using additional push buttons for Start and Stop functions?

    I'm thinking that this "abort and go to home"-button will be used in a BG-logic program something like this:

    Code
    [PSEUDO CODE]
    
    ! Check Sequence Step
    IF (R[1: Step #] < 10) OR (R[1: Step #] > 80), R[1: Step #] = 10
    ! Check if Sequece is running
    IF R[1: Step #] > 10, F[100: Sequence is running] = ON
    
    ! Jump to current step in the sequence
    JMP LBL[R[1: Step #]]
    
    ! Step 10: Stop prg?
    LBL[10]
    IF DI[1: Abort and go Home] AND F[23: UO 3 PRG RUNNING] THEN
        F[4: UI 4 STOP] = ON
        R[1: Step #] = R[1: Step #] + 10
        R[2: Counter/Timer] = 0
    ENDIF
    JMP LBL[999]
    
    ! Step 20: Wait a few cycles
    LBL[20]
    R[2: Counter/Timer] = R[2: Counter/Timer] + 1
    ! Use a counter that increments for n cycles to measure that a time has passed
    IF R[2: Counter/Timer] > n THEN
        R[1: Step #] = R[1: Step #] + 10
        R[2: Counter/Timer] = 0
    ENDIF
    JMP LBL[999]
    
    ! Step 30: Wait for prg to be stopped
    LBL[30]
    IF !F[23: UO 3 PRG RUNNING) THEN
        F[6: UI 6 START] = ON
        R[1: Step #] = R[1: Step #] + 10
    ENDIF
    JMP LBL[999]
    
    ! Step 40: Wait a few cycles
    R[2: Counter/Timer] = R[2: Counter/Timer] + 1
    ! Use a counter that increments for n cycles to measure that a time has passed
    IF R[2: Counter/Timer] > n THEN
        R[1: Step #] = R[1: Step #] + 10
        R[2: Counter/Timer] = 0
    ENDIF
    JMP LBL[999]
    
    ! Step 50: Try to restart from Main
    F[6: UI 6 START] = OFF
    R[1: Step #] = R[1: Step #] + 10
    JMP LBL[999]
    
    ! Step 60: Check if running again
    LBL[60]
    R[2: Counter/Timer] = R[2: Counter/Timer] + 1
    ! Use a counter that increments for n cycles to measure that a time has passed
    IF F[23: UO 3 PRG RUNNING) THEN
        ! Program is running (from Main) again, SUCCESS!
        R[2: Counter/Timer] = 0
        R[1: Step #] = 10
        F[100: Sequence is running] = OFF
    ENDIF
    IF R[2: Counter/Timer] > n THEN
        R[1: Step #] = R[1: Step #] + 10
        R[2: Counter/Timer] = 0
    ENDIF
    
    ! Step 70: Prg not running, try to reset
    LBL[70]
    F[5: UI 5 RESET] = ON
    R[1: Step #] = R[1: Step #] + 10
    JMP LBL[999]
    
    ! Step 80: Wait a few cycles
    R[2: Counter/Timer] = R[2: Counter/Timer] + 1
    ! Use a counter that increments for n cycles to measure that a time has passed
    IF R[2: Counter/Timer] > n THEN
        ! Try the start procedure again
        R[1: Step #] = 30
        R[2: Counter/Timer] = 0
    ENDIF
    JMP LBL[999]
    
    
    LBL[999]
    END
    Display More

    Basically a simple sequence for getting the timing for the UOP signals correct in order to first abort the running program and then initiate the main program with the start signal. If needed, perform a reset before trying to start.

    I will set the CSTOPI for ABORT = TRUE

    and START for CONTINUE only = FALSE

    in the SYSTEM CONFIG MENU.

    Also I will make the required mapping of Flags to the correct UO/UI signals

    I will also make another BG Logic program where I monitor the pushbuttons mapped to the UI-signals and disregard these if the sequence is running:

    Code
    IF !F[100: Sequence is running] THEN
        F[4: UI 4 STOP] = DI[4: UI 4 STOP]
        F[5: UI 5 RESET] = DI[5: UI 5 RESET]
        F[6: UI 6 START] = DI[6: UI 6 START]
    ENDIF
    END
        

    What do you think?

    Is there a better/easier way to accomplish my desired functionality?

  • Sergei Troizky
    Reactions Received
    67
    Trophies
    6
    Posts
    650
    • November 16, 2023 at 1:02 PM
    • #2

    Why not use SKIP in the move instruction(s)?

    Do it well right away. It will become bad by itself.

  • Online
    gpunkt
    Reactions Received
    119
    Trophies
    6
    Posts
    456
    • November 16, 2023 at 2:28 PM
    • #3

    Yes, the SKIP solution could work for this instance, but I'm looking for a more general solution, one such that you wouldn't have to add the SKIP to every motion instruction, and also not having to be performing a motion instruction for this function to work.

  • Online
    hoitzing
    Reactions Received
    24
    Trophies
    1
    Posts
    128
    • November 16, 2023 at 3:28 PM
    • #4

    I suppose using KAREL could work as the ABORT_TASK function allows you to abort a specific task. Then you could have a main program that simultaneously runs your motion program as well as an observer that can cancel the program (and its motion) and then do whatever you need it to do.

    I don't really have any experience with KAREL's multitasking, but by the looks of it this might be worth looking into.

  • HawkME
    Reactions Received
    567
    Trophies
    10
    Posts
    3,268
    • November 16, 2023 at 4:20 PM
    • #5

    Skip is a good solution.

    A general solution would be using UOP to abort, reset, and prod start again, then have a robust recovery routine at the beginning of your main program.

  • TitusLepic
    Reactions Received
    112
    Trophies
    6
    Posts
    442
    • November 16, 2023 at 5:21 PM
    • #6

    Here's how I do it using bglogic and a macro in one of my robots - replace F[24] with your DI (I have a bit of logic requiring the button to be held for 3 seconds before triggering the robot to go home, which is why it's a F instead of DI in this code snippet).

    Code
      12:  !Auto-Homing ;
      13:  IF (F[24:Go Home]),F[14:Cycle stop]=PULSE,0.2sec ;
      14:  IF (UO[6:Fault] AND F[24:Go Home]),F[33:GoHome FaultClear]=PULSE,0.2sec ;
      15:  IF (F[33:GoHome FaultClear] OR F[40:FaultClear Delay]),F[40:FaultClear Delay]=PULSE,5.0sec ;
      16:  IF (F[24:Go Home] AND !F[14:Cycle stop] AND !F[40:FaultClear Delay] OR F[41:GoHome Trigger]),F[41:GoHome Trigger]=PULSE,1.0sec ;
      17:  IF (F[41:GoHome Trigger]),F[42:GoHome Delay]=PULSE,0.2sec ;
      18:  F[25:Call GoHome Macro]=(F[41:GoHome Trigger] AND !F[42:GoHome Delay]) ;
  • Sergei Troizky
    Reactions Received
    67
    Trophies
    6
    Posts
    650
    • November 16, 2023 at 5:56 PM
    • #7

    Without analizing your logic, I want to remind you that in BG Logic the pulse condition must remain true during entire duration of the pulse.

    Do it well right away. It will become bad by itself.

  • Online
    gpunkt
    Reactions Received
    119
    Trophies
    6
    Posts
    456
    • November 17, 2023 at 12:04 PM
    • #8
    Quote from HawkME

    Skip is a good solution.

    A general solution would be using UOP to abort, reset, and prod start again, then have a robust recovery routine at the beginning of your main program.

    Yes,
    Using UOP was my initial solution. However, if I'm not using it to start with, it's a dreadful door to open if I don't need it for other reasons. Also, would require more pushbuttons...

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • Safe Position after stoppage

    • ceilingwalker
    • June 24, 2023 at 4:18 AM
    • Fanuc Robot Forum
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download