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. Kawasaki 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

Restarting the main program

  • robocoder
  • March 17, 2024 at 2:07 PM
  • Thread is Unresolved
  • robocoder
    Reactions Received
    5
    Trophies
    3
    Posts
    51
    • March 17, 2024 at 2:07 PM
    • #1

    Hi!

    I need a way to go back to eg. line 10 of the main program before the main loop starts (an alternative may be to restart the main program entirely). This also needs to work from any called subprograms.

    Code
    MAIN PROGRAM
    
      INSTRUCTION1
    
      INSTRUCTION2
    
      ; Place to restart from
    
      ONI resetSignal CALL InterruptProgram
    
      INSTRUCTION3
    
    CYCLE:
    
      ; Main-loop
    
      CALL SubProgram ()
    
    GOTO CYCLE
    Display More

    I have thought about the following solutions and wonder what you may consider the most proper way of doing it or if you have any input:

    One solution may be to monitor the signal in a PC program, eg.

    Code
    PC PROGRAM
    
      ; Alternative 1
      IF SIG (resetSignal) THEN
        BRAKE
        HOLD
        KILL
        PRIME Main, -1
        CONTINUE
      END
    
      ; Alternative 2
      IF SIG (resetSignal) THEN
        BRAKE
        JUMP MainProgram
      END
    Display More

    I feel the first alternative is kind of a hack as it resets the execution stack which I feel is unnecessary? Alternative 2 feels more proper in a way? Another solution may be to use an ONI instruction and replicate the same ONI instruction in every subprogram called from the main program.

    Code
    MAINPROGRAM
    ------------
    
    ONI resetSignal CALL InterruptProgram
    ...
    
    SUBPROGRAM
    ----------
    
    ONI resetSignal CALL InterruptProgram
    ...
    
    INTERRUPTPROGRAM
    ----------------
    
    BRAKE
    JUMP MainProgram
    Display More

    The problem now is that I have to remember to put ONI instructions in every subprogram. The JUMP instruction also mentions that it may not jump to the source program, but I guess by calling it from within the InterruptProgram it might work as the MainProgram is then no longer the source program.

    I am not able to test this right now so I am just asking to verify if I am on the right track or if I should do something different that is more "proper".

    Thank you very much and sorry for the long post!

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,770
    • March 17, 2024 at 4:14 PM
    • #2
    Quote from robocoder

    I need a way to go back to eg. line 10 of the main program before the main loop starts

    Why?

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • robocoder
    Reactions Received
    5
    Trophies
    3
    Posts
    51
    • March 17, 2024 at 5:32 PM
    • #3

    I need to be able to cancel the current task (eg. if a box is dropped) and then go back to start and grab the next box.

    I can solve the go back to line 10 by moving the lines above in a separate program (eg. initialize). then initialize calls the main program.

  • Alexandru
    Reactions Received
    49
    Trophies
    6
    Posts
    407
    • March 17, 2024 at 7:18 PM
    • #4

    Is not mandatory to restart the program if, the robot dropped the box. You might have 2 options:

    1. The robot can continue the motions (for example there is no enough vacuum level and the box is still in the gripper, the operator placed the box in the gripper)

    2. The robot can pick another box (in this case, just make the program in such a way that the robot is able to go back at picking position)

  • saberlars
    Robot, beyond Human..
    Reactions Received
    22
    Posts
    225
    • March 17, 2024 at 8:19 PM
    • #5
    Quote from robocoder

    I need to be able to cancel the current task (eg. if a box is dropped) and then go back to start and grab the next box.

    I can solve the go back to line 10 by moving the lines above in a separate program (eg. initialize). then initialize calls the main program.

    There is no need to terminate the Program's Task. This is because you can exit again using Return instruction when the Sub Program is called.

    In general, forcefully terminating a task is mainly used for emergency situations such as forced homing or special event handlers. You don't need to consider it during normal automatic startup.

    ABB, FANUC, Hyundai, Kawasaki

  • kwakisaki
    Reactions Received
    694
    Trophies
    11
    Posts
    4,770
    • March 17, 2024 at 9:10 PM
    • #6
    Quote from robocoder

    I need to be able to cancel the current task (eg. if a box is dropped)

    So where is the location of the dropped box can you ensure the following:

    - Does it interfere with further robot motion.

    - Does it interfere with other cell peripheral operations.

    - Does it prevent the next box in from getting to the picked position.

    - Does it still remain in a position to be picked again.

    Not everything is solved with automatic return to pick next box.

    At some point, someone will need to clean up the mess of dropped boxes and ask questions.

    - Why was the box dropped in the first place - can this be engineered out instead.

    Consider creating not only a pick motion subroutine only, but also a gripper activation subroutine and gripper check subroutine with 'constant loop traps'.

    This way you can create simple checks and trap inside gripper subroutines using TIMERS/UTIMERS and PAUSES.

    Remember programming is about getting the operation working, not about elegance.

    Interrupts should be carefully studied in the AS Manual as there are several flavours with differences.

    An interrupt wants to return to the point of interruption.

    Consider this in relation to signal states, but importantly for return robot paths and trajectories.

    It is easy to implement an interrupt and also as easy to neglect the return path from the interrupt and wipe things out.

    Of course, an interrupt does not have to include a motion segment, just a simple pause command will do and upon pressing cycle start again, it will return to where it was interrupted from which will be the same place and can be just as effective as 'constant loop trap routines'.

    View my channel at Industrial Robotics Consultancy Limited - YouTube

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

  • Condition monitoring question

    • TitusLepic
    • April 28, 2023 at 6:54 PM
    • Fanuc Robot Forum
  • Touch sensing in Arc weld robot

    • arun_AR
    • September 30, 2021 at 5:44 PM
    • Kawasaki Robot Forum
  • Help With BG Logic/User Alarms

    • AutoMattic21
    • May 16, 2022 at 8:36 PM
    • Fanuc Robot Forum
  • KSS Main screen

    • Gocea
    • November 29, 2021 at 9:01 PM
    • KUKA Robot Forum
  • Constrain TCP in B and C movement due to singularities at axis 4. Tool is not allowed to be tilted in axis B and C doing movement, but direct SLIN movement causes singularities.

    • ChristianLiinHansen
    • January 17, 2022 at 11:36 AM
    • KUKA Robot Forum
  • Movement for home position

    • Neverine
    • November 2, 2021 at 7:17 AM
    • ABB Robot Forum
  • Sporadic EKI and Internal file error.

    • Joe Muller
    • July 15, 2020 at 7:32 PM
    • KUKA Robot Forum
  • HIGH SPEED UNCOMMANDED MOVE - KAWASAKI CP180

    • jeremyk
    • July 6, 2017 at 10:35 AM
    • Kawasaki Robot Forum

Tags

  • kawasaki
  • Kawasaki E Controller
  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