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. Stäubli & Bosch 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

Would this be a good way to organize the program?

  • robotecnik
  • March 11, 2023 at 12:56 PM
  • Thread is Unresolved
  • robotecnik
    Reactions Received
    19
    Trophies
    4
    Posts
    568
    • March 11, 2023 at 12:56 PM
    • #1

    Hi all,

    I probably will have to program some CSC8 robots without pendant, this makes it a little stranger as no operator will be able to reset the program if needed.

    Thinking about it and the best way to do it and being completely newbie with Stäubli, I've thought on using this strategy:

    Create a program that will start at boot, that program will have an infinite loop that will handle the emergency stop signal (used to reset it all), then I plan to create a parallel task for each part the PLC requires to process so I will be able to kill those tasks in case of an emergency stop (as a rude mechanism to make it possible to reset the programs):

    Code
    begin
      while(true)
        // the emergency input is not OK, time to reset it all.
        if(!diEmgOK)
          // Initialize variables.
          
          // kill all part program tasks
          taskKill("part0")
          taskKill("part1")
    
        // The emergency input is OK, the motors power on input is true, the motors are powered up and no part tasks are running.
        elseIf((diMotorsOn) and (doMotorsOn) and (taskStatus("part0") == -1) and (taskStatus("part1") == -1))
          
          // If there is the Go Home trigger...
          if(diGoHome)
            call goHomeAuto()
            
          // otherwise, if there is the Go Maintenance trigger...
          elseIf(diGoMaintenance)
            call goMaintenance()
    
          // Otherwise, if there is the start signal active...
          elseIf(diStart)
            // if the PLC requires the robot to process part 0  
            if(diPart0)
              taskCreate "part0", 10, start()
                
              // if the PLC requires the robot to process part 1
            elseIf(diPart1)
              taskCreate "part1", 10, start()
            endIf
          endIf
        endIf
      endWhile
    end
    Display More

    part0 and part 1 will have all the cycle to pick and place parts from A to B, with all the logics and conditions, I could add a kind of error signal to let the main program know everything is running fine and in case it is not, inform the PLC about it, but that would be the design.

    Does this look good to you?

    Thank you in advance.

    http://www.robotecnik.com | Robots, CNC and PLC programming.

  • Galet
    Reactions Received
    19
    Trophies
    2
    Posts
    141
    • March 12, 2023 at 11:59 AM
    • #2

    Hello Robtecnic,

    2 or 3 small things :

    - You can't use the Start() program in your taskcreate ! (You can use the Start only if this program belongs to a library)

    - Take the habit, when you have a quick loop like While/Endwhile, to add automatically a Delay(0) (for example before the EndWhile.

    - After the taskKill, you can wait that the task is dead (taskStatus...)

    - Same thing before the task create (a small taskstatus and you control that the task don't exist already)

    - diEmOK : Look about esStatus function

    - You need to add ==True when you control an Input (like diGoHome). If you work with SRS you have a Syntax control button.

    Better than Taskill (kill the task anywhere), you can use a bool variable to give an order to the task. I think in all Partx program you have a loop. Stop the loop whith your Bool and the task will be stop imselfe...an properly.

    There is different ways to use the tasks and mostly the movments. The best is to use one task for all the movment (to be sure that you can't send different trajectories in the same time (In this case, your robot will be totaly crazy :(). Use the main program to take the big job (like a small PLC include), and a second task to control the robot. In this case, it will be easy to add asynchonous fonctionnality !

    ...

    Have a good day.

  • robotecnik
    Reactions Received
    19
    Trophies
    4
    Posts
    568
    • March 12, 2023 at 1:39 PM
    • #3

    Great points Galet ,

    - delay(0) I guess to avoid collapsing the CPU in case of infinite loops without much to do inside.

    - About sending a bool to the task to get it stopped itself... how this works? I mean, I understand a task as a function (that restarts automatically) and in case that task is controlling movements, I should be capable to check the variable only after each movement and only if I check it manually there... Could you post a small sample about that?

    Thanks again!

    http://www.robotecnik.com | Robots, CNC and PLC programming.

  • Galet
    Reactions Received
    19
    Trophies
    2
    Posts
    141
    • March 12, 2023 at 6:18 PM
    • #4
    Quote

    delay(0) I guess to avoid collapsing the CPU in case of infinite loops without much to do inside.

    Yes. Remember that the main task (Started with the running of Start program) have only 10 to priority.

    Quote

    About sending a bool to the task to get it stopped itself... how this works? I mean, I understand a task as a function (that restarts automatically) and in case that task is controlling movements, I should be capable to check the variable only after each movement and only if I check it manually there... Could you post a small sample about that?

    When the controler receive an Emergency Stop, the robot is stopped (Power off), and normaly, the pointer of the "robot task" is stopped on WaitEndMove() or something similar (waiting function). If you kill directly the task, you loose the pointer synchronisation and you need, to restart, to reset the point's memorization (ResetMotion), controle the actual robot's position and send the new trajectory. If you control, the Boolean variable, you can prepare the restart before loose the pointer.

    Like all the robot, it's easier after a issue, to controle the restart rather than to close all and search the next trajectory.

    Best regards,

  • robotecnik
    Reactions Received
    19
    Trophies
    4
    Posts
    568
    • March 12, 2023 at 6:43 PM
    • #5

    Understood, in this case I can afford to just cancel the movements as the robots will have to move upwards till a vertical coordinate and then move home, where they will release the part to fall in a box.

    So, in case esStatus returns something different than 0 in the main task, I will call resetmotion (maybe not needed as the emergency stop will have entered) and then kill the movement task and wait till it has completely disappeared. And at last wait for the PLC signal to restart the program to go HOME...

    Thank you again!

    http://www.robotecnik.com | Robots, CNC and PLC programming.

  • Galet
    Reactions Received
    19
    Trophies
    2
    Posts
    141
    • March 13, 2023 at 9:56 AM
    • #6
    Quote

    I will call resetmotion (maybe not needed as the emergency stop will have entered)

    Emergency stop don't reset the movment memory. It's the reason why, after an emergency stop, you can restart from the same position.

    Quote

    Understood, in this case I can afford to just cancel the movements as the robots will have to move upwards till a vertical coordinate and then move home, where they will release the part to fall in a box.

    Yes, It's very easy with a scara robot.

    Have a good day...

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
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • 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
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • Verify all code paths

    • Hes
    • September 9, 2022 at 10:11 PM
    • KUKA Robot Forum
  • Multiple instances of same OfficeLite?

    • bootsch
    • July 25, 2022 at 5:39 PM
    • KUKA Robot Forum
  • KUKA display signal names in program file

    • roboDan
    • February 11, 2021 at 6:13 PM
    • KUKA Robot Forum

Tags

  • Program
  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