Emergency Stop

Visual Components Essentials has been officially released, download link

Be sure to read the Forum Rules and Guidelines before start using the Forum.

Tagged: , ,

This topic contains 13 replies, has 5 voices, and was last updated by  LA-CU 2 days, 15 hours ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #3792

    LA-CU
    Participant

    Hi,

    i tried to interrupt the movejoint command but all my ideas went wrong. So is there a posibility to simulate an emergency stop or a stop by user at the current position ?

    Regards,

    LA-CU

    #3794
    zesty
    zesty
    Participant

    You want to stop a servo?

    #3798

    LA-CU
    Participant

    Ah sorry forgot to mention it. Yes i’d like to stop a servo under some circumstances.

    #3800
    zesty
    zesty
    Participant

    A servo executing a movement for joint is a time consuming process in API. So one “solution” is to use two scripts: one for moving joints, the other for stopping them. It might work in one script, but have not tested. All you are really doing is running the servo with a heartbeat/pulse and using an event handler to immediately move joints controlled by servo in zero simulation time. It won’t work if you disable servo, and I always use moveImmediate().

    Attachments:
    You must be logged in to view attached files.
    #3803
    Chungmin
    Chungmin
    Participant

    Slice one servo move to maybe 100 or 1000 steps.

    In each step, if emergency signal fired, then break the loop.

    #3805
    zesty
    zesty
    Participant

    Up vote for Chungmin’s answer. It is pretty straightforward to write a module for doing that, so you can import it in other scripts. Not sure though if performance of app is better with heartbeat approach or loop of steps…  😯

    #3811

    LA-CU
    Participant

    Your script works perfectly fine. I integrated your stopjointscript in movejoint with some additional changes, but my Simulation stops itself while im running the script.

    from vcScript import *
    comp = getComponent()
    servo = comp.findBehaviour(“ServoController”)
    app = getApplication()
    sim = app.getSimulation()
    sim.IgnoreEvents = True

    def OnSignal( signal ):
    value = servo.getJointValue(0)
    print signal.Value
    if signal.Value == True:
    servostop(value)
    else:
    sim.continueRun()

    def OnRun():
    servo.moveJoint(0,900)

    def servostop(value):
    servo.moveImmediate(value-0.01)

     

     

    #3814

    LA-CU
    Participant

    Tried something new:

     

    from vcScript import *
    comp = getComponent()
    servo = comp.findBehaviour(“ServoController”)
    stop = comp.findBehaviour(‘Stop’)
    start = comp.findBehaviour(‘Start’)

    def OnSignal( signal ):
    if(signal.Name == ‘Stop’):
    stop()

    def OnRun():
    triggerCondition(lambda:start.Value == True)
    servo.moveJoint(0,900)

    def stop():
    value = servo.getJointValue(0)
    print value
    servo.moveImmediate(value-0.01)

     

    same result. The Simulation stops automatically if i call the stop method. I have to reset the simulation afterwards.

     

    Regards

    #3837

    felix
    Participant

    I’ve tried both of your snippets both won’t stop the simulation in my case. Unfortunately I’m not able to tell you why. I’ve controlled the layout by PLC.

    You can find the layout in the attachment. It’s just the layout of zesty with your script(s) and some minor changes. I’ve disabled Heartbeat since your script’s wont use that anyway.

    Which VC Version are you using?

    Greetings Felix

    Attachments:
    You must be logged in to view attached files.
    #3841
    zesty
    zesty
    Participant

    @felix

    works fine for me in 4.0.5. tested your layout by adding extra script behavior with this code. of course, in this example the signal.signal() method is used. if you still get issues then try with OnValueChange event handler.

    ————

    from vcScript import *

    def OnSignal( signal ):
    pass

    def OnRun():
    delay(5)
    comp = getComponent()
    signal = comp.findBehaviour(“Stop”)
    signal.signal(True)

    ——————–

    #3843

    felix
    Participant

    @zesty

    Yeah, I guess that it works how it’s supposed to be in our cases, I’m just wondering why LA-CU got issues. One of my guesses would be a different VC Version. I’ve also used the official release version of 4.0.5 (build 77886).

    Greetings Felix

    #3845
    zesty
    zesty
    Participant

    @felix

    sorry, i misread your previous post.

    @la-cu

    click the Program tab, and then check the Limits group to see if any of those options are enabled.

    #3854

    Ralle
    Participant

    Forcing the servo movement to stop immediately is not so easy to model and unfortunately there is no standard api call at the moment. You always have to use scripting workarounds although this is a common requirement when doing virtual commissioning. I would recommand to use the suspendRun() and resumeRun() methods to interrupt and restart the servo movement.

     

    #3866

    LA-CU
    Participant

    @felix @zesty sorry couldn’t test your scripts. Unfortunately i’m not at work at the moment.

    @Ralle

    suspendRun() came also to my mind, but it doesn’t fit the requirements. An emergency stop was just an easy example to explain my problem, but i have to stop und start various servos at different positions and different times in the simulation.

     

    Regards

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.