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

Cannot call EXECUTE from Main - KROSET

  • dhindhimathai
  • June 9, 2023 at 3:54 PM
  • Thread is Unresolved
  • dhindhimathai
    Reactions Received
    2
    Trophies
    1
    Posts
    15
    • June 9, 2023 at 3:54 PM
    • #1

    Dear guys,

    I'm coming to you again with another doubt.

    I'm using KROSET to simulate a RS013N and KIDE to code programs in AS language.

    When I try to use the instrution EXECUTE to call a program from my Main, it gives me the error P0111: Cannot use this command/instruction in current mode. This happens when I try to send the AS file to the robot (simulation).

    My code looks something like this:

    Code
    .PROGRAM Main () ; Main Program
      WHILE TRUE DO
        ; Call the communication program
        EXECUTE Communication
        ; Do something in a loop
        WHILE client_connected DO
          ; Execute commands
          PRINT "Executing..."
        END
        ; Do something else
        TWAIT 1.0
      END
    .END
    Display More

    Basically, I am trying to run the program Communication and then enter the WHILE after it.

    I assume it is something that has to do with the mode that has been set in KROSET. I have turned TEACH/REPEAT to REPEAT and also turned on the MOTOR...

    Is there something I am missing?

    Thank you so much again in advance.

    Edited once, last by dhindhimathai: Adding a missing detail. (June 9, 2023 at 4:54 PM).

  • Go to Best Answer
  • SkyeFire June 9, 2023 at 3:58 PM

    Approved the thread.
  • kwakisaki
    Reactions Received
    694
    Trophies
    12
    Posts
    4,770
    • June 9, 2023 at 7:02 PM
    • #2

    To execute a program in K-Roset requires:

    - Repeat Mode.

    - Motor Power On.

    - Or just use the K-Roset Controller (synchronization, simulator plugin outlined in the K-Roset Manual).

    Then you can either:

    - Using the terminal, type in EXECUTE program_name.

    - Use virtual teach pendant and prime the program and press the cycle start on the virtual pendant.

    Shelving that for a moment.

    There are many ways to answer your issue with your coding but fundamentally:

    If you have a look in the AS Manual, EXECUTE is a monitor command under program control.

    Monitor commands are direct entry commands from the terminal when you are online with the robot.

    They are not program commands so using it in the way your code is will never work.

    MC EXECUTE is a valid command, but as it's a monitor command, it can only be used in a PC TASK.

    (MC is abbreviation of Monitor Command).

    You can CALL programs in a main program in the program area.

    However a CALL will mean it branches to the CALL, executes it and returns to the next step after the CALL.

    However, if you are looking at executing just some communication program in parallel with the main, you use it as a PC TASK as a one shot routine and use:

    PCEXECUTE 1:communication

    This will then start it in the PC TASK area and the main program continues.

    However, you could just run that as a continuous PC TASK which is asynchronous to the main program area (assuming there are no motion commands in the communication program.

    What is your intention for the program called main - Can you be more specific?

    View my channel at Industrial Robotics Consultancy Limited - YouTube

  • dhindhimathai
    Reactions Received
    2
    Trophies
    1
    Posts
    15
    • June 10, 2023 at 4:16 PM
    • #3

    Hi kwakisaki

    Again, great and complete answer. I fully understood.

    Regarding your last question: the idea is to have two "threads": one for communication (send robot status and recieve commands) and a second to execute commands from a queue.

    So, at this point the idea would be to do the following: 1) Start the main and prepare necessary variables and initialize communication, 2) PCEXECUTE the communication "thread", and 3) after that in the main, use a WHILE loop execute commands. Something like this:

    Code
    .PROGRAM Main () ; Main Program
      CALL Initialization
      WHILE TRUE DO
        ; Call the communication program
        PCEXECUTE 1:Communication
        ; Execute commands in a loop
        WHILE client_connected DO
          ; Execute commands
          PRINT "Executing..."
        END
        ; Do something else
        TWAIT 1.0
      END
    .END
    Display More

    I implemented a binary semaphore on my own to manage the queue properly. Hope this works.

    Thank you again for all your help. :smiling_face:

  • kwakisaki
    Reactions Received
    694
    Trophies
    12
    Posts
    4,770
    • June 10, 2023 at 4:44 PM
    • Best Answer
    • #4
    Quote from dhindhimathai

    Regarding your last question: the idea is to have two "threads": one for communication (send robot status and recieve commands) and a second to execute commands from a queue.


    So, at this point the idea would be to do the following: 1) Start the main and prepare necessary variables and initialize communication, 2) PCEXECUTE the communication "thread", and 3) after that in the main, use a WHILE loop execute commands.

    Yes, I had a feeling this was your intention but didn't want to assume anything and possibly sending you down a rabbit hole.

    From your example code as it reads (I think you may be aware of this already), but I'll just highlight it anyway as a point to note regarding PC TASKING from the main program area whether just in K-Roset or in the live controller.

    When using PCEXECUTE from within a main routine, you need to ensure/manage that command is not executed again when it is already in execution or else it will error out and also to ensure ANY proceeding code that uses the information in the PC TASK does not execute before the PCTASK has been completed - if using it as a one shot to grab the data before actioning.

    Something to look into is the WHICHTASK or TASK command and using that in conjunction with a variable/flag that gets set and reset so that a simple handshake can be setup between processes.

    However, you could implement your own handshaking sequence without using any of the above.

    I may be telling you something that you've already considered and implemented already though, so if I have, please disregard.

    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

Tags

  • execute
  • teach pendant
  • modes
  • KROSET
  • KIDE
  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